Jump to content

Guff

Members
  • Posts

    159
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Guff

  1. Yeah lol I kept trying it with something similar and I took it out and it worked.
  2. It is NOT only called in the hotbar. I am testing this as we speak with a shield and it constantly updates as long as it is in your inventory, any slot. Javadoc: Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and update it's contents.
  3. It is called so long as it is in your inventory. But yes, checking if the currently held item is the passed stack will keep it from humming constantly unless it is otherwise in your hand.
  4. Don't return a null itemstack. I attempted that at first but I had him change it since it was giving a NPE. The crafting bench attempts to check for item damage already for some reason, and if you return null and it tries to check it, it doesn't protect itself against NPE. Damaging the item and returning the stack will suffice. If you didn't get a NPE then that's just weird because I had to trace it back to this and remove setting the return to null.
  5. onUpdate(ItemStack, World, Entity) The only downside to this is that it will constantly play while the item is in inventory.
  6. You need a World object as well as the coordinates: if(!world.getBlockMaterial(i, j, k).isSolid()) { //movement code here }
  7. I did this with an item that has 2048 max damage just to help him, and it doesn't make the crafting table lag. The only time it lags is if you shift-click the output.
  8. It works for me. It's strange that it's not working. Are you sure it's not just exiting to your inventory?
  9. You're not going to be able to use metadata for items that take damage such as armor, tools, sword, etc. They need the damage values for the damaged versions of themselves, so this won't even work for your Redstone Helmet.
  10. By damage value I mean the metadata value that the sub-item is identified by. IE, bonemeal is identified by 351:15, whereas ink sac is identified by 351:0.
  11. Your knife has to have a maxDamage lol. In the constructor or the initialization, add: setMaxDamage(maxDmgInteger); Also, unless you make a new IRecipe instance, you'll have to do this to add your recipes: for(int i = 0; i < knife.getMaxDamage(); i++) { GameRegistry.addRecipe(new ItemStack(myCarvedItem), new Object[] { "top", "mid", "bot", 't', new ItemStack(knife, 1, i) }); } Obviously that wouldn't be your recipe but any character that represents your knife will need to use i as the damage. This will actually add as many recipes as your item has max damage. Remove: if(alter > stack.getMaxDamage()) { return null; }
  12. new ItemStack(item, 1, dmgValue) will give an ItemStack of the specified Item having the specific damage value.
  13. Look at the important parts: In the constructor: this.setHasSubtypes(true); This should indicate the obvious. This method: public String getUnlocalizedName(ItemStack par1ItemStack) { int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 15); return super.getUnlocalizedName() + "." + dyeColorNames[i]; } This is necessary if you want your sub-items to have different names. dyeColorNames is just a String array with different unlocalized names to append to the return String for that method. These methods: public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) { for (int j = 0; j < 16; ++j) { par3List.add(new ItemStack(par1, 1, j)); } } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.field_94594_d = new Icon[field_94595_b.length]; for (int i = 0; i < field_94595_b.length; ++i) { this.field_94594_d[i] = par1IconRegister.registerIcon(this.func_111208_A() + "_" + field_94595_b[i]); } } The first will compile all of the different items that should be displayed on the creative tab, in other words damage values 0 through 15 (all 16 dye colors). The second will register the individual icons for each dye. These icons are retrieved in getIconFromDamage() when rendering. All of the other methods are for applying dyes to sheep and fertilizing plants, which is something your item probably will not even do. You should easily be able to basically copy everything I just gave you, put it where it needs to go, and make a new item with damage values by adapting the information to fit your needs.
  14. Study that file. Metadata is extra data that is saved to other data. For example, the data value for dyes is 351. They contain extra data, such as 0, 1, 2, . . ., 15.
  15. Did you take a look at ItemDye.java?
  16. I think I said to do that earlier but regardless, glad you got it working!
  17. Once you start to get somewhere, come back and I'll help you.
  18. Here's your problem: You are using the directory "resources/assets/. . ." Up the folder and delete resources. Instead, it should be "assets/textures/. . ."
  19. See what methods you can override in your class, and see what you need to do.
  20. Again, you're using a String as the first parameter, and you need an Item, Block, or ItemStack. Change: LanguageRegistry.addName(ItemInfo.BEDROCKSWORD_UNLOCALIZED_NAME, ItemInfo.BEDROCKSWORD_NAME); to LanguageRegistry.addName(bedrockPickaxe, ItemInfo.BEDROCKSWORD_NAME);
  21. Don't use "/texture/. . .", use "textures" for your GUI.
  22. Ctrl+A, Ctrl+X, Ctrl+S, Ctrl+V, Ctrl+S. Try it.
  23. Guff

    NBT Help?

    Woops! Change: if (mode < modes.length) to if (mode < modes.length - 1)
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.