Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7666

Llama ArrayIndexOutOfBoundsException when doing Llama#getInventory#setDecor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • This server is running CraftBukkit version 4161-Spigot-e2c1eee-6118e53 (MC: 1.20.6) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
    • Yes

      Doing:
      else if (args[0].equalsIgnoreCase("test"))

      {

       

      final Llama llama = (Llama) ((Player) sender).getWorld().spawnEntity(((Player) sender).getLocation(), EntityType.LLAMA);

      llama.getInventory().setDecor(new ItemStack(Material.GREEN_CARPET)); // Problematic code

       

      }

      Causes:

      Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
          at java.base/java.util.Arrays$ArrayList.set(Arrays.java:4271) ~[?:?]
          at net.minecraft.core.NonNullList.set(SourceFile:54) ~[spigot-1.20.6-R0.1-SNAPSHOT.jar:4161-Spigot-e2c1eee-6118e53]
          at net.minecraft.world.InventorySubcontainer.a(InventorySubcontainer.java:202) ~[spigot-1.20.6-R0.1-SNAPSHOT.jar:4161-Spigot-e2c1eee-6118e53]
          at org.bukkit.craftbukkit.v1_20_R4.inventory.CraftInventory.setItem(CraftInventory.java:101) ~[spigot-1.20.6-R0.1-SNAPSHOT.jar:4161-Spigot-e2c1eee-6118e53]
          at org.bukkit.craftbukkit.v1_20_R4.inventory.CraftInventoryLlama.setDecor(CraftInventoryLlama.java:20) ~[spigot-1.20.6-R0.1-SNAPSHOT.jar:4161-Spigot-e2c1eee-6118e53]
          at me.hexedhero.pp.commands.PinataPartyCommand.execute(PinataPartyCommand.java:354) ~[?:?]
          at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.20.6-R0.1-SNAPSHOT.jar:?]
          ... 26 more

            Unassigned Unassigned
            HexedHero HexedHero
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: