CryptoMorin / XSeries

Library for cross-version Minecraft Bukkit support and various efficient API methods.
https://www.spigotmc.org/threads/378136/
MIT License
403 stars 126 forks source link

Error with equipment drop chance with armor stands #224

Closed ImSpooks closed 1 year ago

ImSpooks commented 1 year ago

Whenever loading an Armor Stand entity with equipment, throws an error. By checking if the entity is a Mob instance prevents this error being thrown.

java.lang.IllegalArgumentException: Cannot set drop chance for non-Mob entity
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
    at org.bukkit.craftbukkit.v1_20_R1.inventory.CraftEntityEquipment.setDropChance(CraftEntityEquipment.java:260) ~[paper-1.20.1.jar:git-Paper-169]
    at org.bukkit.craftbukkit.v1_20_R1.inventory.CraftEntityEquipment.setHelmetDropChance(CraftEntityEquipment.java:215) ~[paper-1.20.1.jar:git-Paper-169]
    at com.cryptomorin.xseries.XEntity.edit(XEntity.java:213) ~[SnapSkyBlock-2.0.0-SNAPSHOT.jar:?]
    at com.cryptomorin.xseries.XEntity.spawn(XEntity.java:121) ~[SnapSkyBlock-2.0.0-SNAPSHOT.jar:?]

Used yaml to deserialize entity:


entity:
  type: ARMOR_STAND
  gravity: false
  equipment:
    helmet:
      item:
        material: LEATHER_HELMET
    chestplate:
      item:
        material: LEATHER_CHESTPLATE
    leggings:
      item:
        material: LEATHER_LEGGINGS
    boots:
      item:
        material: LEATHER_BOOTS```
CryptoMorin commented 1 year ago

Nice, thanks!