From 35fdc9103d586e4c72e0b7d867fe58fc33b7967a Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 6 Dec 2021 15:15:09 +1100 Subject: [PATCH] SPIGOT-6831: Fix llama strength crash By: md_5 --- .../net/minecraft/world/entity/Entity.patch | 9 --------- .../world/entity/animal/horse/EntityLlama.patch | 15 +++++++++++++++ .../world/entity/npc/EntityVillager.patch | 9 --------- .../org/bukkit/craftbukkit/entity/CraftLlama.java | 2 +- 4 files changed, 16 insertions(+), 19 deletions(-) create mode 100644 paper-server/nms-patches/net/minecraft/world/entity/animal/horse/EntityLlama.patch diff --git a/paper-server/nms-patches/net/minecraft/world/entity/Entity.patch b/paper-server/nms-patches/net/minecraft/world/entity/Entity.patch index 6b72780138..07ea2feb72 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/Entity.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/Entity.patch @@ -60,15 +60,6 @@ protected static final Logger LOGGER = LogManager.getLogger(); public static final String ID_TAG = "id"; public static final String PASSENGERS_TAG = "Passengers"; -@@ -156,7 +207,7 @@ - public float yRotO; - public float xRotO; - private AxisAlignedBB bb; -- protected boolean onGround; -+ public boolean onGround; - public boolean horizontalCollision; - public boolean verticalCollision; - public boolean minorHorizontalCollision; @@ -228,6 +279,23 @@ public boolean hasVisualFire; @Nullable diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/horse/EntityLlama.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/horse/EntityLlama.patch new file mode 100644 index 0000000000..32d0e444c5 --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/horse/EntityLlama.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/world/entity/animal/horse/EntityLlama.java ++++ b/net/minecraft/world/entity/animal/horse/EntityLlama.java +@@ -78,6 +78,12 @@ + return false; + } + ++ // CraftBukkit start ++ public void setStrengthPublic(int i) { ++ this.setStrength(i); ++ } ++ // CraftBukkit end ++ + private void setStrength(int i) { + this.entityData.set(EntityLlama.DATA_STRENGTH_ID, Math.max(1, Math.min(5, i))); + } diff --git a/paper-server/nms-patches/net/minecraft/world/entity/npc/EntityVillager.patch b/paper-server/nms-patches/net/minecraft/world/entity/npc/EntityVillager.patch index b2a64d7c15..fd8b3f2af5 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/npc/EntityVillager.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/npc/EntityVillager.patch @@ -58,15 +58,6 @@ Logger logger = EntityVillager.LOGGER; Objects.requireNonNull(logger); -@@ -630,7 +645,7 @@ - super.die(damagesource); - } - -- private void releaseAllPois() { -+ public void releaseAllPois() { - this.releasePoi(MemoryModuleType.HOME); - this.releasePoi(MemoryModuleType.JOB_SITE); - this.releasePoi(MemoryModuleType.POTENTIAL_JOB_SITE); @@ -816,7 +831,12 @@ } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java index 190ae459b2..f5447991ff 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java @@ -47,7 +47,7 @@ public class CraftLlama extends CraftChestedHorse implements Llama { public void setStrength(int strength) { Preconditions.checkArgument(1 <= strength && strength <= 5, "strength must be [1,5]"); if (strength == getStrength()) return; - getHandle().setStrength(strength); + getHandle().setStrengthPublic(strength); getHandle().createInventory(); }