mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
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.
This commit is contained in:
parent
cfc7baeefb
commit
d9363f2979
1 changed files with 15 additions and 11 deletions
|
@ -1,11 +1,11 @@
|
|||
From b128c99c11c451eb05ae62b6585e565e90939db5 Mon Sep 17 00:00:00 2001
|
||||
From 94377d65907b8bb20d19f0a357e1d37b851b68f6 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue