You can get a player's inventory using the EntityPlayer#inventory field. You can use InventoryPlayer#setInventorySlotContents to replace the ItemStack in a slot of the player's inventory. The armour slots are 36-39.
To do this from a keybinding, you may need to send a packet to the server or use a Container. I'm not that familiar with the networking system, so I can't help you there.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
does anyone have any clue to do that? I have been looking for a while now with no luck.... also can someone tell me how to do this with armor?
for the item I would like that with a right mouse click. but with the armor I would appreciate with the push of a button (EXAMPLE the B key)
and the weapon with a key press as well..... sorry just trying to do this sort of style in a unique way
also the armor should be able to do this when worn
try something like
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player)
{
player.inventory.consumeInventoryItem(yourItem);
player.inventory.addItemStackToInventory(new ItemStack(newItem, quantity);
}
or if you need to make sure the player has it in their inventory make do
if(player.inventory.hasItem(yourItem) {
player.inventory.consumeInventoryItem(yourItem);
player.inventory.addItemStackToInventory(new ItemStack(newItem, quantity);
}
}
You can get a player's inventory using the EntityPlayer#inventory field. You can use InventoryPlayer#setInventorySlotContents to replace the ItemStack in a slot of the player's inventory. The armour slots are 36-39.
To do this from a keybinding, you may need to send a packet to the server or use a Container. I'm not that familiar with the networking system, so I can't help you there.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
okay thanks!
can you please send me to a tutorial that explains this further or something? that would be really nice right now