How can I check if an item has inventory?

Started by kabutomiyatake on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I check if an item has inventory?
Mon, 11/17/2025 - 01:14 (edited)

I made a custom item that allows player to duplicate any item with a certain cost. However, I do not want it to be able to duplicate items with inventory(to be precise, I don't want to duplicate items inside the item's inventory).

How can I check if an item has inventory? Or, instead, how can I clear an item's inventory?

I am even thinking about setting empty itemstack in all slots of the item's inventory manually...

How it currently works is when the item duper is in off-hand and target item is in main-hand and player right-clicks, the player receives one same item as the one in main-hand and lose one item duper.

Using MCreator 2024.1 for Minecraft 1.20.1.

Edited by kabutomiyatake on Mon, 11/17/2025 - 01:14