[SPIGOT-7666] Llama ArrayIndexOutOfBoundsException when doing Llama#getInventory#setDecor Created: 10/May/24  Updated: 25/Dec/24  Resolved: 10/May/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: HexedHero Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Version: This server is running CraftBukkit version 4161-Spigot-e2c1eee-6118e53 (MC: 1.20.6) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

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



 Comments   
Comment by HexedHero [ 10/May/24 ]

Wrong project, sorry. Dunno why it decided to do that.

Generated at Sat Dec 13 22:30:25 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.