Posted August 23, 201312 yr Hi All! I made my slot for ContainerPlayer.java, but when I put back an item that item appears in the slot for a helmet. SlotBackpack package net.minecraft.inventory; import mods.AdventureCraft.src.BackpackItem; import net.minecraft.item.ItemStack; class SlotBackpack extends Slot { final ContainerPlayer inventory; SlotBackpack(ContainerPlayer containerplayer, IInventory iinventory, int i, int j, int k, int l) { super(iinventory, i, j, k); inventory = containerplayer; } public int getSlotStackLimit() { return 1; } public boolean isItemValid(ItemStack itemstack) { return itemstack.getItem() instanceof BackpackItem; } } Add my slot in ContainerPlayer.java for (i = 0; i < 1; ++i) { this.addSlotToContainer(new SlotBackpack(this, par1InventoryPlayer, par1InventoryPlayer.getSizeInventory() - 1, 60, 8 + 2 * 18, 100)); } Please, help me. And sorry for my bad English
September 12, 201312 yr I guess you are setting slot index same as the helmet slot index. Try setting a negative number.
September 15, 201312 yr Might I suggest opening a custom Gui with your Item Backpack rather than editing the base inventory gui? For an example of this, check out my tutorial on creating an Item that stores an Inventory: http://www.minecraftforum.net/topic/1949352-creating-an-item-that-stores-an-inventory/ If you want an extra inventory slot to store the item, like I see you are doing, you could store it in IExtendedEntityProperties and assign a special key to open your custom player inventory to allow access to your custom slot. If you need help with IExtendedEntityProperties, I also have a tutorial on that: http://www.minecraftforum.net/topic/1952901-eventhandler-and-iextendedentityproperties/#entry24051513 I've done this exact thing helping out some guys making a Naruto mod - they needed custom inventory slots for Sharingan Eyes, and I did it like I outlined above. http://i.imgur.com/NdrFdld.png[/img]
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.