KubeJS

KubeJS

69M Downloads

BlockEntity Slot Crash

EvanHsieh0415 opened this issue · 2 comments

commented

Minecraft Version

1.20.1

KubeJS Version

2001.6.3-Build.47

Rhino Version

2001.2.2-build.6

Architectury Version

9.1.12

Forge/Fabric Version

Forge 47.1.47

Describe your issue

event.create("test:block_entity_2")
    .textureAll("minecraft:block/redstone_block")
    .blockEntity((entityInfo) => {
      entityInfo.inventory(1, 1);
      entityInfo.rightClickOpensInventory();
      entityInfo.serverTick(1, 0, (entity) => {
        entity.inventory.insertItem("stick", false);
      })
    })

Crash when placing items into slots that should not be there
圖片
圖片

Crash report/logs

https://mclo.gs/dHdkvhP

commented

iirc mr crayfish backpack mod has a functionality that let's its backpacks have a customizable number of slots
the screen of the backpack will change to make it work
maybe you could take a look at it idk
see here: https://github.com/MrCrayfish/Backpacked/blob/multiloader/1.20.X/common/src/main/java/com/mrcrayfish/backpacked/client/gui/screen/inventory/BackpackScreen.java#L119-L142

commented

Unfortunately there's no way to display only 1x1 inventory currently, so you have to use 9xN. This probably won't be fixed for a while, it would require me to add a whole gui system in backend