Block Entity inventory inputfilter dont work with custom items
DevDyna opened this issue ยท 1 comments
Minecraft Version
1.20.1
KubeJS Version
kubejs-forge-2001.6.4-build.138
Rhino Version
rhino-forge-2001.2.2-build.18
Architectury Version
architectury-9.2.14-forge
Forge/Fabric Version
Forge - 47.2.20
Describe your issue
when used on .inventory()
a custom item as input filter , it deny all items included input filter
script used:
StartupEvents.registry("item", (event) => {
event.create("kubejs:star")
})
StartupEvents.registry("block", (event) => {
event.create('block_id').blockEntity((be) => {
be.inventory(9, 1, 'kubejs:star');
be.rightClickOpensInventory();
})
})
Crash report/logs
No response
Looks like the callback gets called immediately, which causes the string to try resolve into an Item immediately, which fails to catch custom items (and probably most modded items too) cause the registry events are still processing.
KubeJS/common/src/main/java/dev/latvian/mods/kubejs/block/BlockBuilder.java
Lines 760 to 765 in d1aad04
To fix this the callback should be stored instead and only called when the block entity type is being created/registered (which is guaranteed to happen after item reg). It can't be called in block reg cause that happens before item reg (due to BlockItems needing a Block reference).