2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-11-25 17:51:11 +00:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Sun, 7 Oct 2018 04:29:59 -0500
|
|
|
|
Subject: [PATCH] Add more Zombie API
|
|
|
|
|
|
|
|
|
2019-05-06 19:30:27 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2020-06-26 12:04:38 +00:00
|
|
|
index 7c9b437d950623a978ca3d45c8ca57b39a897179..dbd7850df45fb9ee550ce33f97bdfe9cf5bfcd34 100644
|
2019-05-06 19:30:27 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2020-06-25 14:09:55 +00:00
|
|
|
@@ -1423,6 +1423,8 @@ public abstract class EntityInsentient extends EntityLiving {
|
2019-05-06 19:30:27 +00:00
|
|
|
this.datawatcher.set(EntityInsentient.b, flag ? (byte) (b0 | 2) : (byte) (b0 & -3));
|
|
|
|
}
|
|
|
|
|
2019-05-13 01:04:29 +00:00
|
|
|
+ public boolean isArmsRaisedZombie() { return (this.datawatcher.get(EntityInsentient.b) & 4) != 0; } // Paper - OBFHELPER
|
2020-06-25 14:09:55 +00:00
|
|
|
+ public void setArmsRaisedZombie(boolean flag) { this.setAggressive(flag); } // Paper - OBFHELPER
|
|
|
|
public void setAggressive(boolean flag) {
|
2019-05-06 19:30:27 +00:00
|
|
|
byte b0 = (Byte) this.datawatcher.get(EntityInsentient.b);
|
|
|
|
|
2018-11-25 17:51:11 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
2020-06-25 14:09:55 +00:00
|
|
|
index 3f16f9b34a75db6dc977cb0dc1603db34dd8ddc3..18705e1e2a04ec2790b104a290b9edc8e9fb4f1a 100644
|
2018-11-25 17:51:11 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
2019-07-28 14:32:14 +00:00
|
|
|
@@ -33,6 +33,7 @@ public class EntityZombie extends EntityMonster {
|
2020-06-25 14:09:55 +00:00
|
|
|
private int bA;
|
2019-05-05 11:12:32 +00:00
|
|
|
public int drownedConversionTime;
|
2018-11-25 17:51:11 +00:00
|
|
|
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
|
|
|
+ private boolean shouldBurnInDay = true; // Paper
|
|
|
|
|
2019-05-05 11:12:32 +00:00
|
|
|
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
2018-11-25 17:51:11 +00:00
|
|
|
super(entitytypes, world);
|
2020-06-25 14:09:55 +00:00
|
|
|
@@ -74,6 +75,7 @@ public class EntityZombie extends EntityMonster {
|
2019-01-01 03:15:55 +00:00
|
|
|
this.getDataWatcher().register(EntityZombie.DROWN_CONVERTING, false);
|
2018-11-25 17:51:11 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 10:09:55 +00:00
|
|
|
+ public boolean isDrowning() { return isDrownConverting(); } // Paper - OBFHELPER
|
|
|
|
public boolean isDrownConverting() {
|
2019-01-01 03:15:55 +00:00
|
|
|
return (Boolean) this.getDataWatcher().get(EntityZombie.DROWN_CONVERTING);
|
2018-11-25 17:51:11 +00:00
|
|
|
}
|
2020-06-25 14:09:55 +00:00
|
|
|
@@ -206,6 +208,13 @@ public class EntityZombie extends EntityMonster {
|
2019-01-01 03:15:55 +00:00
|
|
|
this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true);
|
2018-11-25 17:51:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public void stopDrowning() {
|
2018-12-08 10:09:55 +00:00
|
|
|
+ this.drownedConversionTime = -1;
|
2019-05-05 11:12:32 +00:00
|
|
|
+ this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, false);
|
2018-11-25 17:51:11 +00:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2020-06-25 14:09:55 +00:00
|
|
|
protected void eQ() {
|
|
|
|
this.c(EntityTypes.DROWNED);
|
|
|
|
if (!this.isSilent()) {
|
|
|
|
@@ -225,10 +234,17 @@ public class EntityZombie extends EntityMonster {
|
|
|
|
|
2018-11-25 17:51:11 +00:00
|
|
|
}
|
|
|
|
|
2020-06-25 14:09:55 +00:00
|
|
|
+ public boolean shouldBurnInDay() { return U_(); } // Paper - OBFHELPER
|
|
|
|
protected boolean U_() {
|
2018-11-25 17:51:11 +00:00
|
|
|
- return true;
|
2019-05-05 11:12:32 +00:00
|
|
|
+ return shouldBurnInDay;
|
2018-11-25 17:51:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ this.shouldBurnInDay = shouldBurnInDay;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2019-05-05 11:12:32 +00:00
|
|
|
@Override
|
2018-11-25 17:51:11 +00:00
|
|
|
public boolean damageEntity(DamageSource damagesource, float f) {
|
|
|
|
if (super.damageEntity(damagesource, f)) {
|
2020-06-25 14:09:55 +00:00
|
|
|
@@ -348,6 +364,7 @@ public class EntityZombie extends EntityMonster {
|
|
|
|
nbttagcompound.setBoolean("CanBreakDoors", this.eV());
|
|
|
|
nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bA : -1);
|
2018-12-08 10:09:55 +00:00
|
|
|
nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1);
|
2018-11-25 17:51:11 +00:00
|
|
|
+ nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper
|
|
|
|
}
|
|
|
|
|
2019-05-05 11:12:32 +00:00
|
|
|
@Override
|
2020-06-25 14:09:55 +00:00
|
|
|
@@ -362,7 +379,11 @@ public class EntityZombie extends EntityMonster {
|
2018-11-25 17:51:11 +00:00
|
|
|
if (nbttagcompound.hasKeyOfType("DrownedConversionTime", 99) && nbttagcompound.getInt("DrownedConversionTime") > -1) {
|
2019-01-01 03:15:55 +00:00
|
|
|
this.startDrownedConversion(nbttagcompound.getInt("DrownedConversionTime"));
|
2018-11-25 17:51:11 +00:00
|
|
|
}
|
|
|
|
-
|
|
|
|
+ // Paper start
|
|
|
|
+ if (nbttagcompound.hasKey("Paper.ShouldBurnInDay")) {
|
|
|
|
+ shouldBurnInDay = nbttagcompound.getBoolean("Paper.ShouldBurnInDay");
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
2019-05-05 11:12:32 +00:00
|
|
|
@Override
|
2018-11-25 17:51:11 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
2020-05-06 09:48:49 +00:00
|
|
|
index 0429cf020e462d3655bf1159ec857cad33544b71..c4320dbb67059be9456b0eef700a5f3e83c7c75b 100644
|
2018-11-25 17:51:11 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
2019-05-06 19:30:27 +00:00
|
|
|
@@ -80,4 +80,41 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
2019-01-01 03:15:55 +00:00
|
|
|
getHandle().startDrownedConversion(time);
|
2018-12-17 05:18:06 +00:00
|
|
|
}
|
2018-11-25 17:51:11 +00:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
2019-05-06 19:30:27 +00:00
|
|
|
+ @Override
|
2018-11-25 17:51:11 +00:00
|
|
|
+ public boolean isDrowning() {
|
|
|
|
+ return getHandle().isDrowning();
|
|
|
|
+ }
|
|
|
|
+
|
2019-05-06 19:30:27 +00:00
|
|
|
+ @Override
|
2018-11-25 17:51:11 +00:00
|
|
|
+ public void startDrowning(int drownedConversionTime) {
|
2019-01-01 03:15:55 +00:00
|
|
|
+ getHandle().startDrownedConversion(drownedConversionTime);
|
2018-11-25 17:51:11 +00:00
|
|
|
+ }
|
|
|
|
+
|
2019-05-06 19:30:27 +00:00
|
|
|
+ @Override
|
2018-11-25 17:51:11 +00:00
|
|
|
+ public void stopDrowning() {
|
|
|
|
+ getHandle().stopDrowning();
|
|
|
|
+ }
|
|
|
|
+
|
2019-05-06 19:30:27 +00:00
|
|
|
+ @Override
|
2018-11-25 17:51:11 +00:00
|
|
|
+ public boolean shouldBurnInDay() {
|
|
|
|
+ return getHandle().shouldBurnInDay();
|
|
|
|
+ }
|
|
|
|
+
|
2019-05-06 19:30:27 +00:00
|
|
|
+ @Override
|
|
|
|
+ public boolean isArmsRaised() {
|
2019-05-13 01:04:29 +00:00
|
|
|
+ return getHandle().isArmsRaisedZombie();
|
2019-05-06 19:30:27 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setArmsRaised(final boolean raised) {
|
2019-05-13 01:04:29 +00:00
|
|
|
+ getHandle().setArmsRaisedZombie(raised);
|
2019-05-06 19:30:27 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2018-11-25 17:51:11 +00:00
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|