Posted November 22, 201212 yr hi am am trying to make a new furnace style thingy but i only want certain item into certain slots i hav being trying this @Override public boolean isItemValid(ItemStack par1ItemStack, int Slot) { switch(Slot) { case 0: if(par1ItemStack.getItem() instanceof Item) return true; } return false; } But the problem is one it doesnt work and 2 that will let any item in i want it to only let blazerod in to the slot but if i do this case 0: if(par1ItemStack.getItem() instanceof Item.blazeRod) it errors out and says that it cant be done plz help
November 22, 201212 yr Override slotClicked and return null(maybe just return? can't remember) if that item shouldn't be placed in the slot number passed in, otherwise, call the super. You can get the itemstack that is currently stuck to the players mouse by doing a player.inventory.getItemStack() Edit: Return the ItemStack, not null. Returning Null will delete the item in their hand.
November 22, 201212 yr Author k thanks i understand what you are saying i just dont now how to right that in code even u just give a basic layout would be good thanks
November 22, 201212 yr Not be rude, by I really think that If you don't have at least a decent understanding in java you shouldn't be doing forge modding. The reason: case 0: if(par1ItemStack.getItem() instanceof Item.blazeRod) does not work is because instanceof is used to check if an Item is of the class type. Item.blazeRod isn't a class type but rather an instance of a class. To get it to work I would do case 0: if(par1ItemStack.getItem().shiftedIndex == Item.blazeRod.shiftedIndex){ //code in here }
November 22, 201212 yr Author k thanks for the advice but u could of just said to do that before thanks for the help tho
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.