
itemstack components are empty objects
Closed this issue ยท 0 comments
Minecraft Version
1.21.1
KubeJS Version
2101.7.1-build.181
Rhino Version
2101.2.7-build.74
Architectury Version
13.0.8
Forge/Fabric Version
Neoforge 21.1.186
Describe your issue
Accessing an itemstack's components through itemstack.components.get()
or itemstack.get()
returns an object with no properties or methods to access the component data, making them unusable to my knowledge.
The below, when placed in server_scripts will net us an object named BundleContents[2 minecraft:dirt]
for a player whose first slot contains a bundle with 2 dirt blocks inside.
PlayerEvents.chat(event => {
console.log(event.player.inventory.getStackInSlot(0).get('minecraft:bundle_contents'))
})
As the only other way to get component data is through itemstack.componentString
, we have to mutate a string into an array, then manipulate its values before replacing the bundle data with itemstack.setBundleContents()
Crash report/logs
No response