Posted January 11, 201510 yr How would you return an item (say a saw) used in crafting to the player without any durability Thanks, -Whyneb360
January 11, 201510 yr Author I'm not sure I understand what you mean. I have done this, and it doesn't let me put the @Override in. public class BoardProp extends BlockContainer{ public BoardProp(Material material) { super(material); this.setCreativeTab(DesconCreativeTabs.tabGeneral); this.setHarvestLevel("axe", 1); this.setHardness(1F); this.setBlockBounds(0F, 0F, 1F, 1F, 1F, 0.875F); this.setBlockTextureName(Main.modID + ":" + "textures/blocks/board.png"); } @Override public void getContainerItem() { } @Override public void hasContainerItem() { }
January 11, 201510 yr and it doesn't let me put the @Override in. Then you did it wrong. I love how your "get this thing" function returns void. 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.
January 11, 201510 yr Pro tip when someone says to override method x dont just blindly create a method called x and expect it to work because in most cases it wont (unless you are given the full method) Look it up in the super class and override it properly. You should be able to just type the first few letters of the method and your ide will give you a list of methods to override. I am the author of Draconic Evolution
January 11, 201510 yr Author Thanks for the advice. I managed to figure it out based on what you said and got the following code for anyone else who wants it: public class YourClassHere extends Item{ @Override public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) { return false; } //Change this to make the item not stay in the crafting grid @Override public ItemStack getContainerItem(ItemStack itemstack) { return itemstack; } @Override public boolean hasContainerItem(ItemStack itemstack) { return true; } }
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.