Jump to content

Recommended Posts

Posted
4 minutes ago, diesieben07 said:

InventoryPlayer is the player inventory, you can access it via EntityPlayer::inventory. Then just call setInventorySlotContents to change the contents of a slot.

Could you write me example of this code? I'm new to modding

Posted
4 minutes ago, diesieben07 said:

If you need an example of how to access a field and how to call a method you are not "new to modding", you are new to Java, in which case you need to go and learn Java before making a mod.

I was not sure that I would succeed and therefore asked for help. But this code works !

((EntityPlayer) entity).inventory.setInventorySlotContents(5, null);

Thank you!

Posted

Which version of Minecraft are you using?

 

In 1.11+, ItemStacks can no longer be null; the default value is now the empty ItemStack (ItemStack#isEmpty). The ItemStack.EMPTY field contains an ItemStack that's always empty.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
Just now, Choonster said:

Which version of Minecraft are you using?

 

In 1.11+, ItemStacks can no longer be null; the default value is now the empty ItemStack (ItemStack#isEmpty). The ItemStack.EMPTY field contains an ItemStack that's always empty.

1.7.10

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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