KubeJS-Mods / KubeJS

https://kubejs.com
GNU Lesser General Public License v3.0
313 stars 91 forks source link

modifyCreativeTab example doesn't work and causes crash when using removeDisplay #925

Open micka190 opened 1 week ago

micka190 commented 1 week ago

Minecraft Version

1.20.1

KubeJS Version

2001.6.5-build.16

Rhino Version

2001.2.3-build.6

Architectury Version

9.2.14

Forge/Fabric Version

47.3.0

Describe your issue

Trying to use KubeJS to hide certain modded items from a creative tab, since they're disabled in the modpack.

Saw that the documentation had an example for just that:

StartupEvents.modifyCreativeTab('minecraft:redstone_blocks', event => {
    // Adds example item after redstone
    event.addAfter('minecraft:redstone', 'kubejs:example_item')
    // Removes redstone
    event.removeDisplay('minecraft:redstone');
})

I tried it in my modpack, and it seemed like removeDisplay(...) did nothing. I confirmed I had the correct creative tab selected by changing its icon and name (which worked). Decided to make a fresh instance with only KubeJS and its dependencies in case it was a problem with some other mod.

The above example results in a crash when opening my creative inventory in-game with only KubeJS and its dependencies insalled.

I assumed that maybe the addAfter(...) call was the problem, since I don't have the kubejs:example_item defined anywhere, but the following also causes a crash when opening the creative mode inventory:

StartupEvents.modifyCreativeTab('minecraft:redstone_blocks', event => {
    event.removeDisplay('minecraft:redstone');
})

I've attached a crash log pastebin below.


Is removeDisplay(...) still supposed to work? I've seen some posts online about the functionality no longer being supported, but it's still documented, so I assume it's supposed to work?

Crash report/logs

https://pastebin.com/EZAQtM8e