[Unsolved] Adding Item Inventory to Vanilla Items

Started by joshh131 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Unsolved] Adding Item Inventory to Vanilla Items

This might be a difficult question to answer. I'm making a mod loosely based on tabletop role playing games. I've added stats and a system to allow "Magic Items" to be dropped in game (Basically when the player picks up the generic Magic Item (item_drop), it converts itself into a new_item of that type (ie armor_drop becomes diamond_boots). The new_item then goes through a series of functions that generate random numbers to determine which enchantments or buffs to assign to the item. Now I'm trying to add a chance for augmentation slots to be added to the item, but I'm running into a problem. I don't have a way of assigning an itemstack as an nbt value. What can I do?

I tried to give the item_drop an inventory, but when it converts to the new vanilla item it no longer has inventory...so the contents and the inventory capability doesn't transfer.

 


Image of Character GUI of my mod, for those interested.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Looks really cool! To the…
Tue, 01/02/2024 - 12:56

Looks really cool! To the best of my knowledge, you can't do itemstacks as NBT data because itemstacks can themselves contain NBT data. You can, however, make modded items with an inventory, so your best bet may be to subtly replace magical items with a modded variant that looks and behaves identically, but also has an inventory. (And then replace it again if the effect is removed.) This may or may not be a viable option, of course, depending on how many different items the effect can be applied to, though I may or may not have wound up doing something very similar for a smithing mod...