KubeJS

KubeJS

61M Downloads

Forge 1.19.2 - Modded Items Not Working with item.of() / unable to rename modded items

sharkweekthings opened this issue ยท 4 comments

commented

Minecraft Version

1.19.2

KubeJS Version

1902.6.2-build.27 - build.33

Rhino Version

rhino-forge-1902.2.2-build.280

Architectury Version

architectury-6.5.85-forge

Forge/Fabric Version

43.3.2

Describe your issue

ClientEvents.lang('en_us', event => {
const rename = (item, newName) => {
let stack = Item.of(item);
event.add(stack.item.descriptionId, newName)
}

// AD ASTRA
rename('ad_astra:venus_coal_ore', "Rich Coal Ore")
rename('ad_astra:mercury_iron_ore', "Rich Iron Ore")

})

When attempting this code to rename ad astra venus coal I get the attached error in the Client.log:

client.log

Another user in the KubeJS Discord tested as well: https://discord.com/channels/303440391124942858/1166044977319649330/1166154668313944114

There are many various tests that we ran leading up to him thinking it has something to do with modded item names and item.of.

Crash report/logs

No response

commented

The error in the log you posted seems to be coming directly from calling console.log, which isn't in the script you posted.
Are you sure exactly that script produces that error?

commented

The error in the log you posted seems to be coming directly from calling console.log, which isn't in the script you posted. Are you sure exactly that script produces that error?

There was a lot to unpack in what you said, and since you also posted this comment in the KubeJS Discord, I responded there.

For anyone looking for additional information on this, it starts here:

https://discord.com/channels/303440391124942858/1166044977319649330/1166364181818261524

commented

I added new methods to lang event, event.renameItem(item, newName), event.renameBlock(block, newName), try those

Thanks I used event.renameItem(item, newName) and that worked for my needs!

commented

I added new methods to lang event, event.renameItem(item, newName), event.renameBlock(block, newName), try those