2019-06-14 10:27:40 +08:00
|
|
|
From cc47ad5f4d7d034bf30c6dd92d532560110005cf Mon Sep 17 00:00:00 2001
|
2018-11-26 01:51:11 +08:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Sun, 7 Oct 2018 04:29:59 -0500
|
|
|
|
Subject: [PATCH] Add more Zombie API
|
|
|
|
|
|
|
|
|
2019-05-07 03:30:27 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2019-06-06 23:36:57 +08:00
|
|
|
index c81e530902..48ce154848 100644
|
2019-05-07 03:30:27 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2019-05-19 11:16:22 +08:00
|
|
|
@@ -1246,6 +1246,8 @@ public abstract class EntityInsentient extends EntityLiving {
|
2019-05-07 03:30:27 +08:00
|
|
|
this.datawatcher.set(EntityInsentient.b, flag ? (byte) (b0 | 2) : (byte) (b0 & -3));
|
|
|
|
}
|
|
|
|
|
2019-05-13 09:04:29 +08:00
|
|
|
+ public boolean isArmsRaisedZombie() { return (this.datawatcher.get(EntityInsentient.b) & 4) != 0; } // Paper - OBFHELPER
|
|
|
|
+ public void setArmsRaisedZombie(boolean flag) { this.q(flag); } // Paper - OBFHELPER
|
2019-05-07 03:30:27 +08:00
|
|
|
public void q(boolean flag) {
|
|
|
|
byte b0 = (Byte) this.datawatcher.get(EntityInsentient.b);
|
|
|
|
|
2018-11-26 01:51:11 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
2019-06-06 23:36:57 +08:00
|
|
|
index 171c1ae4ad..b20fe8e521 100644
|
2018-11-26 01:51:11 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
2019-05-05 19:12:32 +08:00
|
|
|
@@ -31,6 +31,7 @@ public class EntityZombie extends EntityMonster {
|
|
|
|
private int bF;
|
|
|
|
public int drownedConversionTime;
|
2018-11-26 01:51:11 +08:00
|
|
|
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
|
|
|
+ private boolean shouldBurnInDay = true; // Paper
|
|
|
|
|
2019-05-05 19:12:32 +08:00
|
|
|
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
2018-11-26 01:51:11 +08:00
|
|
|
super(entitytypes, world);
|
2019-05-05 19:12:32 +08:00
|
|
|
@@ -78,6 +79,7 @@ public class EntityZombie extends EntityMonster {
|
2019-01-01 11:15:55 +08:00
|
|
|
this.getDataWatcher().register(EntityZombie.DROWN_CONVERTING, false);
|
2018-11-26 01:51:11 +08:00
|
|
|
}
|
|
|
|
|
2018-12-08 18:09:55 +08:00
|
|
|
+ public boolean isDrowning() { return isDrownConverting(); } // Paper - OBFHELPER
|
|
|
|
public boolean isDrownConverting() {
|
2019-01-01 11:15:55 +08:00
|
|
|
return (Boolean) this.getDataWatcher().get(EntityZombie.DROWN_CONVERTING);
|
2018-11-26 01:51:11 +08:00
|
|
|
}
|
2019-05-05 19:12:32 +08:00
|
|
|
@@ -209,6 +211,13 @@ public class EntityZombie extends EntityMonster {
|
2019-01-01 11:15:55 +08:00
|
|
|
this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true);
|
2018-11-26 01:51:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public void stopDrowning() {
|
2018-12-08 18:09:55 +08:00
|
|
|
+ this.drownedConversionTime = -1;
|
2019-05-05 19:12:32 +08:00
|
|
|
+ this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, false);
|
2018-11-26 01:51:11 +08:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2019-05-05 19:12:32 +08:00
|
|
|
protected void eb() {
|
|
|
|
this.b(EntityTypes.DROWNED);
|
2019-05-14 10:20:58 +08:00
|
|
|
this.world.a((EntityHuman) null, 1040, new BlockPosition(this), 0);
|
2019-05-05 19:12:32 +08:00
|
|
|
@@ -253,10 +262,17 @@ public class EntityZombie extends EntityMonster {
|
2018-11-26 01:51:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-05 19:12:32 +08:00
|
|
|
+ public boolean shouldBurnInDay() { return J_(); } // Paper - OBFHELPER
|
|
|
|
protected boolean J_() {
|
2018-11-26 01:51:11 +08:00
|
|
|
- return true;
|
2019-05-05 19:12:32 +08:00
|
|
|
+ return shouldBurnInDay;
|
2018-11-26 01:51:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ this.shouldBurnInDay = shouldBurnInDay;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2019-05-05 19:12:32 +08:00
|
|
|
@Override
|
2018-11-26 01:51:11 +08:00
|
|
|
public boolean damageEntity(DamageSource damagesource, float f) {
|
|
|
|
if (super.damageEntity(damagesource, f)) {
|
2019-05-05 19:12:32 +08:00
|
|
|
@@ -374,6 +390,7 @@ public class EntityZombie extends EntityMonster {
|
|
|
|
nbttagcompound.setBoolean("CanBreakDoors", this.ef());
|
|
|
|
nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bF : -1);
|
2018-12-08 18:09:55 +08:00
|
|
|
nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1);
|
2018-11-26 01:51:11 +08:00
|
|
|
+ nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper
|
|
|
|
}
|
|
|
|
|
2019-05-05 19:12:32 +08:00
|
|
|
@Override
|
|
|
|
@@ -388,7 +405,11 @@ public class EntityZombie extends EntityMonster {
|
2018-11-26 01:51:11 +08:00
|
|
|
if (nbttagcompound.hasKeyOfType("DrownedConversionTime", 99) && nbttagcompound.getInt("DrownedConversionTime") > -1) {
|
2019-01-01 11:15:55 +08:00
|
|
|
this.startDrownedConversion(nbttagcompound.getInt("DrownedConversionTime"));
|
2018-11-26 01:51:11 +08:00
|
|
|
}
|
|
|
|
-
|
|
|
|
+ // Paper start
|
|
|
|
+ if (nbttagcompound.hasKey("Paper.ShouldBurnInDay")) {
|
|
|
|
+ shouldBurnInDay = nbttagcompound.getBoolean("Paper.ShouldBurnInDay");
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
2019-05-05 19:12:32 +08:00
|
|
|
@Override
|
2018-11-26 01:51:11 +08:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
2019-06-06 23:36:57 +08:00
|
|
|
index 0429cf020e..c4320dbb67 100644
|
2018-11-26 01:51:11 +08:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
2019-05-07 03:30:27 +08:00
|
|
|
@@ -80,4 +80,41 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
2019-01-01 11:15:55 +08:00
|
|
|
getHandle().startDrownedConversion(time);
|
2018-12-17 13:18:06 +08:00
|
|
|
}
|
2018-11-26 01:51:11 +08:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
2019-05-07 03:30:27 +08:00
|
|
|
+ @Override
|
2018-11-26 01:51:11 +08:00
|
|
|
+ public boolean isDrowning() {
|
|
|
|
+ return getHandle().isDrowning();
|
|
|
|
+ }
|
|
|
|
+
|
2019-05-07 03:30:27 +08:00
|
|
|
+ @Override
|
2018-11-26 01:51:11 +08:00
|
|
|
+ public void startDrowning(int drownedConversionTime) {
|
2019-01-01 11:15:55 +08:00
|
|
|
+ getHandle().startDrownedConversion(drownedConversionTime);
|
2018-11-26 01:51:11 +08:00
|
|
|
+ }
|
|
|
|
+
|
2019-05-07 03:30:27 +08:00
|
|
|
+ @Override
|
2018-11-26 01:51:11 +08:00
|
|
|
+ public void stopDrowning() {
|
|
|
|
+ getHandle().stopDrowning();
|
|
|
|
+ }
|
|
|
|
+
|
2019-05-07 03:30:27 +08:00
|
|
|
+ @Override
|
2018-11-26 01:51:11 +08:00
|
|
|
+ public boolean shouldBurnInDay() {
|
|
|
|
+ return getHandle().shouldBurnInDay();
|
|
|
|
+ }
|
|
|
|
+
|
2019-05-07 03:30:27 +08:00
|
|
|
+ @Override
|
|
|
|
+ public boolean isArmsRaised() {
|
2019-05-13 09:04:29 +08:00
|
|
|
+ return getHandle().isArmsRaisedZombie();
|
2019-05-07 03:30:27 +08:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setArmsRaised(final boolean raised) {
|
2019-05-13 09:04:29 +08:00
|
|
|
+ getHandle().setArmsRaisedZombie(raised);
|
2019-05-07 03:30:27 +08:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2018-11-26 01:51:11 +08:00
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
--
|
2019-05-05 19:32:20 +08:00
|
|
|
2.21.0
|
2018-11-26 01:51:11 +08:00
|
|
|
|