The Meaning of Life, the Universe, and Everything.
Location:
Watching You
Join Date:
7/9/2014
Posts:
61
Location:
Right Behind You
Minecraft:
Rippingtax
Member Details
I made a custom Ingot called celestial bronze Ingot, and then I wanted to make celestial bronze tools. So I changed the type of celestial bronze from Item to ToolMaterial. When I tried to make the celestial bronze ore drop the celestial bronze ingot, it gave me an error and told me that it could only drop items. Help!
Items need to extend Item (or something else that extends Item). ToolMaterial does not. You create a tool material like so:
public static final ItemTool.ToolMaterial NAME = EnumHelper.addToolMaterial("MATERIAL_NAME", harvestLevel, maxUses, efficiency, damage, enchantability);
When extending ItemTool, you can set a ToolMaterial.
ToolMaterial is something that you use in code but does not and should not ever actually appear in the game.
For example, vanilla has an IRON tool material, but this is not the same thing as the item 'iron ingot'. You need to make an Item to represent the tool material that is used in your crafting recipes, but the tool material itself cannot be dropped.
In sum:
// This one is NOT an Item and cannot be dropped or otherwise used in-game
public static ToolMaterial yourMaterial = (your tool material definition goes here);
// This is what players will interact with in-game:
public static Item ingotOfYourMaterial = (a new Item that you can use in ItemStacks, recipes, drops, etc. goes here);
Now you can make a new ItemSword with your material:
public static Item newSword = new ItemSword(yourMaterial);
Looks correct. Only thought I have is that you must initialize your creative tab before you initialize your items, otherwise they will be pointing to 'null'.
The Meaning of Life, the Universe, and Everything.
Location:
Watching You
Join Date:
7/9/2014
Posts:
61
Location:
Right Behind You
Minecraft:
Rippingtax
Member Details
Thank you to everyone who helped me with my various problems. Can I have another bit of advice?
What the crap does this
---- Minecraft Crash Report ----
// This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]
Time: 1/10/15 4:55 PM
Description: Initializing game
java.lang.ClassCastException: net.minecraft.client.renderer.texture.TextureAtlasSprite cannot be cast to javax.swing.Icon
at com.example.percyjackson.GreekBow.registerIcons(GreekBow.java:173)
at net.minecraft.client.renderer.texture.TextureMap.registerIcons(TextureMap.java:331)
at net.minecraft.client.renderer.texture.TextureMap.<init>(TextureMap.java:57)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:570)
at net.minecraft.client.Minecraft.run(Minecraft.java:880)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at com.example.percyjackson.GreekBow.registerIcons(GreekBow.java:173)
at net.minecraft.client.renderer.texture.TextureMap.registerIcons(TextureMap.java:331)
at net.minecraft.client.renderer.texture.TextureMap.<init>(TextureMap.java:57)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:570)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:880)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Mac OS X (x86_64) version 10.10.1
Java Version: 1.7.0_71, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 694848920 bytes (662 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 6 mods loaded, 6 mods active
mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{7.2.211.1121} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized
Forge{10.12.2.1121} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized
CodeChickenCore{1.0.2.10} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed->Pre-initialized
NotEnoughItems{1.0.2.14} [Not Enough Items] (NotEnoughItems-1.7.2-1.0.2.14-universal.jar) Unloaded->Constructed->Pre-initialized
percyjackson{0.1} [The Percy Jackson Mod] (bin) Unloaded->Constructed->Pre-initialized
Launched Version: 1.6
LWJGL: 2.9.1
OpenGL: NVIDIA GeForce GT 330M OpenGL Engine GL version 2.1 NVIDIA-10.0.19 310.90.10.05b12, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: ~~ERROR~~ NullPointerException: null
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Anisotropic Filtering: Off (1)
You've probably imported that Swing Icon class instead of Minecraft's IIcon interface.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Items need to extend Item (or something else that extends Item). ToolMaterial does not. You create a tool material like so:
When extending ItemTool, you can set a ToolMaterial.
EDIT: My class OreCBronze gives me this error: Type mismatch: cannot convert from Item.ToolMaterial to Item
With this code:
@Override
public Item getItemDropped(int metadata, Random random, int fortune) {
return Percyjackson.CBronzeIngot;
}
The error is in red.
For example, vanilla has an IRON tool material, but this is not the same thing as the item 'iron ingot'. You need to make an Item to represent the tool material that is used in your crafting recipes, but the tool material itself cannot be dropped.
In sum:
Now you can make a new ItemSword with your material:
Does that make sense now?
Doesn't work..... I have this code for CBronzeAxe
[quote] package com.example.percyjackson;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
public class CBronzeAxe extends ItemAxe {
public CBronzeAxe(ToolMaterial CBronzeIngot) {
super(CBronzeIngot);
this.setCreativeTab(Percyjackson.toolTab);
this.setTextureName(Percyjackson.MODID + ":" + "CAxe");
}
}
@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
return Percyjackson.CBronzeAxe;
}
};
You are already doing so in your code, just put it before your preInit method in your main mod class.
it is before it though, which is funny because it's still not working.
What the crap does this
---- Minecraft Crash Report ----
// This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]
Time: 1/10/15 4:55 PM
Description: Initializing game
java.lang.ClassCastException: net.minecraft.client.renderer.texture.TextureAtlasSprite cannot be cast to javax.swing.Icon
at com.example.percyjackson.GreekBow.registerIcons(GreekBow.java:173)
at net.minecraft.client.renderer.texture.TextureMap.registerIcons(TextureMap.java:331)
at net.minecraft.client.renderer.texture.TextureMap.<init>(TextureMap.java:57)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:570)
at net.minecraft.client.Minecraft.run(Minecraft.java:880)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at com.example.percyjackson.GreekBow.registerIcons(GreekBow.java:173)
at net.minecraft.client.renderer.texture.TextureMap.registerIcons(TextureMap.java:331)
at net.minecraft.client.renderer.texture.TextureMap.<init>(TextureMap.java:57)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:570)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:880)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Mac OS X (x86_64) version 10.10.1
Java Version: 1.7.0_71, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 694848920 bytes (662 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 6 mods loaded, 6 mods active
mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{7.2.211.1121} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized
Forge{10.12.2.1121} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized
CodeChickenCore{1.0.2.10} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed->Pre-initialized
NotEnoughItems{1.0.2.14} [Not Enough Items] (NotEnoughItems-1.7.2-1.0.2.14-universal.jar) Unloaded->Constructed->Pre-initialized
percyjackson{0.1} [The Percy Jackson Mod] (bin) Unloaded->Constructed->Pre-initialized
Launched Version: 1.6
LWJGL: 2.9.1
OpenGL: NVIDIA GeForce GT 330M OpenGL Engine GL version 2.1 NVIDIA-10.0.19 310.90.10.05b12, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: ~~ERROR~~ NullPointerException: null
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Anisotropic Filtering: Off (1)
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
What do I import?