KubeJS (Old)

KubeJS (Old)

3M Downloads

Can't reload 0th index of player inventory

Preta-Crowz opened this issue ยท 1 comments

commented

Minecraft Version

1.19.2

KubeJS Version

1902.6.0-build.142

Rhino Version

1902.2.2-build.268

Architectury Version

6.5.77

Forge/Fabric Version

Fabric API 0.76.0, Loader 0.14.19, Server Launcher 0.11.2

Describe your issue

(migrated from discord, to keep track & discuss about issue)

On every tick, script reads entire player inventory and add tag if item isn't inited.
But script doesn't read 0th index, or 1st slot of hotbar while other slots are working right.

here's example script

PlayerEvents.tick(event => {
  const $p = event.player;
  let update = false;

  for (const $i of $p.inventory) {
    if ($i.id == "minecraft:air") continue;
    if ($i.hasNBT() && $i.nbt.inited) continue;

    if (!$i.hasNBT()) $i.nbt = {};

    $i.nbt.display = {
      Lore: ["\"inited!\""]
    }
    $i.nbt.inited = true;

    update = true;
  }
  if (update) $p.sendInventoryUpdate();
});

This scripts set lore to every item on inventory. But it doesn't add anything on 0th index.
image
image

Crash report/logs

No response

commented

Fix has been merged, closing.