From d9363f29795232507a2731a85231d180df3cd5fc Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 29 Sep 2018 16:00:55 -0400 Subject: [PATCH] Fix slime pathfinding when loaded from NBT GH-1507 The canWander property is initialized to true by default, however when loaded from NBT, if the key doesn't exist the property will be set to false. The correct solution is to ensure the key exists before setting the property. --- .../0339-Slime-Pathfinder-Events.patch | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Spigot-Server-Patches/0339-Slime-Pathfinder-Events.patch b/Spigot-Server-Patches/0339-Slime-Pathfinder-Events.patch index ac311516ffe..739be12a7fc 100644 --- a/Spigot-Server-Patches/0339-Slime-Pathfinder-Events.patch +++ b/Spigot-Server-Patches/0339-Slime-Pathfinder-Events.patch @@ -1,11 +1,11 @@ -From b128c99c11c451eb05ae62b6585e565e90939db5 Mon Sep 17 00:00:00 2001 +From 94377d65907b8bb20d19f0a357e1d37b851b68f6 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 24 Aug 2018 08:18:42 -0500 Subject: [PATCH] Slime Pathfinder Events diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index 238f3c7926..cfa4710b78 100644 +index 238f3c792..586b9a3a6 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java @@ -57,6 +57,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { @@ -16,15 +16,19 @@ index 238f3c7926..cfa4710b78 100644 } public void a(NBTTagCompound nbttagcompound) { -@@ -69,6 +70,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -69,6 +70,11 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.setSize(i + 1, false); this.bD = nbttagcompound.getBoolean("wasOnGround"); -+ this.canWander = nbttagcompound.getBoolean("Paper.canWander"); // Paper ++ // Paper start - check exists before loading or this will be loaded as false ++ if (nbttagcompound.hasKey("Paper.canWander")) { ++ this.canWander = nbttagcompound.getBoolean("Paper.canWander"); ++ } ++ // Paper end } public boolean dy() { -@@ -308,7 +310,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -308,7 +314,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { } public boolean a() { @@ -33,7 +37,7 @@ index 238f3c7926..cfa4710b78 100644 } public void e() { -@@ -327,7 +329,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -327,7 +333,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { } public boolean a() { @@ -42,7 +46,7 @@ index 238f3c7926..cfa4710b78 100644 } public void e() { -@@ -351,13 +353,17 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -351,13 +357,17 @@ public class EntitySlime extends EntityInsentient implements IMonster { } public boolean a() { @@ -62,7 +66,7 @@ index 238f3c7926..cfa4710b78 100644 } ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.b, false); -@@ -377,7 +383,16 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -377,7 +387,16 @@ public class EntitySlime extends EntityInsentient implements IMonster { public boolean a() { EntityLiving entityliving = this.a.getGoalTarget(); @@ -80,7 +84,7 @@ index 238f3c7926..cfa4710b78 100644 } public void c() { -@@ -388,7 +403,16 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -388,7 +407,16 @@ public class EntitySlime extends EntityInsentient implements IMonster { public boolean b() { EntityLiving entityliving = this.a.getGoalTarget(); @@ -98,7 +102,7 @@ index 238f3c7926..cfa4710b78 100644 } public void e() { -@@ -452,4 +476,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -452,4 +480,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { } } } @@ -115,7 +119,7 @@ index 238f3c7926..cfa4710b78 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java -index 18e7ef80ac..8403c1e01c 100644 +index 18e7ef80a..8403c1e01 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -33,4 +33,14 @@ public class CraftSlime extends CraftMob implements Slime {