2019-01-01 04:15:55 +01:00
From 0dbdf509a59f03e4dafe9b932f2d09bd969a8a45 Mon Sep 17 00:00:00 2001
2018-11-25 18:51:11 +01:00
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 7 Oct 2018 04:29:59 -0500
Subject: [PATCH] Add more Zombie API
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
2019-01-01 04:15:55 +01:00
index 92ad1ad15..85465879d 100644
2018-11-25 18:51:11 +01:00
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -22,8 +22,8 @@ public class EntityZombie extends EntityMonster {
private final AttributeModifier babyModifier = new AttributeModifier(EntityZombie.a, "Baby speed boost", world.paperConfig.babyZombieMovementSpeed, 1); // Paper - Remove static - Make baby speed configurable
private static final DataWatcherObject<Boolean> bC = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Integer> bD = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b);
- private static final DataWatcherObject<Boolean> bE = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i);
2019-01-01 04:15:55 +01:00
- public static final DataWatcherObject<Boolean> DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i);
+ private static final DataWatcherObject<Boolean> bE = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> armsRaised = bE; // Paper - OBFHELPER
+ public static final DataWatcherObject<Boolean> DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> drowning = DROWN_CONVERTING; // Paper - OBFHELPER
2018-11-25 18:51:11 +01:00
private final PathfinderGoalBreakDoor bG;
private boolean bH;
private int bI;
@@ -31,6 +31,7 @@ public class EntityZombie extends EntityMonster {
private float bK;
private float bL;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
+ private boolean shouldBurnInDay = true; // Paper
public EntityZombie(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
@@ -79,14 +80,22 @@ public class EntityZombie extends EntityMonster {
2019-01-01 04:15:55 +01:00
this.getDataWatcher().register(EntityZombie.DROWN_CONVERTING, false);
2018-11-25 18:51:11 +01:00
}
2018-12-08 11:09:55 +01:00
+ public boolean isDrowning() { return isDrownConverting(); } // Paper - OBFHELPER
public boolean isDrownConverting() {
2019-01-01 04:15:55 +01:00
return (Boolean) this.getDataWatcher().get(EntityZombie.DROWN_CONVERTING);
2018-11-25 18:51:11 +01:00
}
+ public void setArmsRaised(boolean raised) { s(raised); } // Paper - OBFHELPER
public void s(boolean flag) {
2018-12-08 11:09:55 +01:00
this.getDataWatcher().set(EntityZombie.bE, flag);
2018-11-25 18:51:11 +01:00
}
+ // Paper start
+ public boolean isArmsRaised() {
+ return ((Boolean) this.getDataWatcher().get(EntityZombie.armsRaised)).booleanValue();
+ }
+ // Paper end
+
public boolean dH() {
return this.bH;
}
2019-01-01 04:15:55 +01:00
@@ -215,6 +224,13 @@ public class EntityZombie extends EntityMonster {
this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true);
2018-11-25 18:51:11 +01:00
}
+ // Paper start
+ public void stopDrowning() {
2018-12-08 11:09:55 +01:00
+ this.drownedConversionTime = -1;
2018-11-25 18:51:11 +01:00
+ this.getDataWatcher().set(EntityZombie.drowning, Boolean.valueOf(false));
+ }
+ // Paper end
+
protected void dE() {
this.a((EntityZombie) EntityTypes.DROWNED.create(world)); // Paper
this.world.a((EntityHuman) null, 1040, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0);
2019-01-01 04:15:55 +01:00
@@ -253,10 +269,17 @@ public class EntityZombie extends EntityMonster {
2018-11-25 18:51:11 +01:00
}
}
+ public boolean shouldBurnInDay() { return L_(); } // Paper - OBFHELPER
protected boolean L_() {
- return true;
+ return shouldBurnInDay; // Paper
}
+ // Paper start
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ this.shouldBurnInDay = shouldBurnInDay;
+ }
+ // Paper end
+
public boolean damageEntity(DamageSource damagesource, float f) {
if (super.damageEntity(damagesource, f)) {
EntityLiving entityliving = this.getGoalTarget();
2019-01-01 04:15:55 +01:00
@@ -369,6 +392,7 @@ public class EntityZombie extends EntityMonster {
2018-11-25 18:51:11 +01:00
nbttagcompound.setBoolean("CanBreakDoors", this.dH());
nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bI : -1);
2018-12-08 11:09:55 +01:00
nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1);
2018-11-25 18:51:11 +01:00
+ nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper
}
public void a(NBTTagCompound nbttagcompound) {
2019-01-01 04:15:55 +01:00
@@ -382,7 +406,11 @@ public class EntityZombie extends EntityMonster {
2018-11-25 18:51:11 +01:00
if (nbttagcompound.hasKeyOfType("DrownedConversionTime", 99) && nbttagcompound.getInt("DrownedConversionTime") > -1) {
2019-01-01 04:15:55 +01:00
this.startDrownedConversion(nbttagcompound.getInt("DrownedConversionTime"));
2018-11-25 18:51:11 +01:00
}
-
+ // Paper start
+ if (nbttagcompound.hasKey("Paper.ShouldBurnInDay")) {
+ shouldBurnInDay = nbttagcompound.getBoolean("Paper.ShouldBurnInDay");
+ }
+ // Paper end
}
public void b(EntityLiving entityliving) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
2019-01-01 04:15:55 +01:00
index e93ecb076..c516d3475 100644
2018-11-25 18:51:11 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
2018-12-17 06:18:06 +01:00
@@ -77,4 +77,34 @@ public class CraftZombie extends CraftMonster implements Zombie {
2019-01-01 04:15:55 +01:00
getHandle().startDrownedConversion(time);
2018-12-17 06:18:06 +01:00
}
2018-11-25 18:51:11 +01:00
}
+
+ // Paper start
+ public boolean isDrowning() {
+ return getHandle().isDrowning();
+ }
+
+ public void startDrowning(int drownedConversionTime) {
2019-01-01 04:15:55 +01:00
+ getHandle().startDrownedConversion(drownedConversionTime);
2018-11-25 18:51:11 +01:00
+ }
+
+ public void stopDrowning() {
+ getHandle().stopDrowning();
+ }
+
+ public void setArmsRaised(boolean raised) {
+ getHandle().setArmsRaised(raised);
+ }
+
+ public boolean isArmsRaised() {
+ return getHandle().isArmsRaised();
+ }
+
+ public boolean shouldBurnInDay() {
+ return getHandle().shouldBurnInDay();
+ }
+
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
+ }
+ // Paper end
}
--
2018-12-23 18:04:13 +01:00
2.20.1
2018-11-25 18:51:11 +01:00