SPIGOT-6831: Fix llama strength crash

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-12-06 15:15:09 +11:00
parent 24b8f3c641
commit 35fdc9103d
4 changed files with 16 additions and 19 deletions

View file

@ -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

View file

@ -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)));
}

View file

@ -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 @@
}

View file

@ -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();
}