Posted December 6, 201311 yr So I decided to try start up modding to be ready to begin a proper mod with the 1.7.2 release. I've been trying to achieve fairly simple things, but one thing is wrong for sure. My main class: public class FrozenWorld { public static final String modID = "FrozenWorld"; public static int SaphireOreID = 899; public static int SaphireIID = 900; //Creating the Forge instance @Instance(value = "FrozenWorld") public static FrozenWorld instance; //Says where client and server proxy files are located @SidedProxy(clientSide="mods.danilafe.frozenworld.client.ClientProxy",serverSide="mods.danilafe.frozenworld.common.CommonProxy") public static mods.danilafe.frozenworld.common.CommonProxy proxy; @EventHandler // used in 1.6.2 public void preInit(FMLPreInitializationEvent event) { } @EventHandler public void preInit(FMLInitializationEvent event){ Block SaphireOre = new SaphireOre(SaphireOreID, Material.rock) .setHardness(0.5F) .setStepSound(Block.soundStoneFootstep) .setUnlocalizedName("SaphireOre") .setCreativeTab(CreativeTabs.tabBlock); Item SaphireI = new SaphireI(900) .setCreativeTab(CreativeTabs.tabMisc) .setMaxStackSize(64) .setUnlocalizedName("SaphireI"); GameRegistry.registerBlock(SaphireOre, "SaphireOre"); GameRegistry.registerItem(SaphireI, "SaphireI"); LanguageRegistry.addName(SaphireI, "Saphire"); LanguageRegistry.addName(SaphireOre, "Saphire Ore"); MinecraftForge.setBlockHarvestLevel(SaphireOre, "pickaxe", 2); } @EventHandler public void load(FMLInitializationEvent event) { proxy.registerRenderers(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { // Stub Method } } My SaphireOre block class: public class SaphireOre extends Block{ public SaphireOre(int par1, Material par2Material) { super(par1, par2Material); } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("FrozenWorld" + ":" + (this.getUnlocalizedName().substring(5))); } public int idDropped(int i, Random rand, int j){ return mods.danilafe.frozenworld.FrozenWorld.SaphireIID; } public int quantityDropped(Random rand){ return 1; } } Now as you can see, I have it try to drop SaphireIID, from the main class. The SaphireI item should have the id 900. BUT. It has an id of 1156. 256 more. And the same happens when I change is to, for example, 545. The id becomes 801. Please not this does not happen with the block. PLEASE HELP! “Since when did you start modding?” “Last night"
December 6, 201311 yr bitshifting or somthing CreepyPastaCraft git | SCPCraft git Keep an eye on them, see that I'm still working on it
December 6, 201311 yr Simple problem, fortunately! Vanilla minecraft automatically shifts every single item ID by 256. Originally, those first 256 ID slots were reserved for blocks. You can change the drop to what you want like this: public int idDropped(int par1, Random par2Random, int par3) { return yourpackage.youritem.itemID; } EDIT: Sorry, missed that you put that in there! In any case, yes, minecraft does this on purpose, but worst comes to worst, just put in return (SaphireIID + 256) EDIT (Man, I've got to stop editing): Also, the first few thousand slots are often for blocks and the later slots are for items. For example, my mod sets block IDs starting at 2500 and item IDs starting at 5000. You can google a list of what mods use what IDs in forge for a general idea of what's good to use and also use a config file to make your ID range fully customizable.
December 6, 201311 yr Do not mess with the item IDs, just don't. You don't need to. You will never encounter problems unless you're doing bad practice. Whereas if you do subtract the 256 back out, you will have problems with compatibility with other mods (because they won't subtract 256 and thus their config will look like it has a different ID than your mod to the player, but! it will conflict anyway). Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 6, 201311 yr Do not mess with the item IDs, just don't. You don't need to. You will never encounter problems unless you're doing bad practice. ^ Sums up all I had to say If you guys dont get it.. then well ya.. try harder...
December 6, 201311 yr Author What do you mean "not mess with the IDs"? Since the variable and the id are different, and it's the variable that's stored in the config, the config and the item would have different values, right? I don't have a config yet anyway, anyone remind me of how to do it? “Since when did you start modding?” “Last night"
December 7, 201311 yr What do you mean "not mess with the IDs"? Since the variable and the id are different, and it's the variable that's stored in the config, the config and the item would have different values, right? Yes. They would. AND THEY SHOULD. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 7, 201311 yr Author Ok this might seem a stupid question but - how would I make a block drop the selected item? By using "return SaphireIID +256"? “Since when did you start modding?” “Last night"
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.