2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 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
|
2021-02-21 21:55:01 +01:00
|
|
|
index 422632c9050d0bcc5398ac5d4cf51801cea9cdda..9b1297e564738eb40e6e9329817d8ebab11dce40 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
|
2019-07-28 16:32:14 +02:00
|
|
|
@@ -33,6 +33,7 @@ public class EntityZombie extends EntityMonster {
|
2020-08-25 04:22:08 +02:00
|
|
|
private int bt;
|
2019-05-05 13:12:32 +02:00
|
|
|
public int drownedConversionTime;
|
2018-11-25 18:51:11 +01:00
|
|
|
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
|
|
|
+ private boolean shouldBurnInDay = true; // Paper
|
|
|
|
|
2019-05-05 13:12:32 +02:00
|
|
|
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
2018-11-25 18:51:11 +01:00
|
|
|
super(entitytypes, world);
|
2020-08-25 04:22:08 +02:00
|
|
|
@@ -201,6 +202,12 @@ public class EntityZombie extends EntityMonster {
|
|
|
|
super.movementTick();
|
2018-11-25 18:51:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public void stopDrowning() {
|
2018-12-08 11:09:55 +01:00
|
|
|
+ this.drownedConversionTime = -1;
|
2019-05-05 13:12:32 +02:00
|
|
|
+ this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, false);
|
2018-11-25 18:51:11 +01:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2020-08-25 04:22:08 +02:00
|
|
|
public void startDrownedConversion(int i) {
|
|
|
|
this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
|
|
|
this.drownedConversionTime = i;
|
2021-02-21 21:55:01 +01:00
|
|
|
@@ -229,9 +236,16 @@ public class EntityZombie extends EntityMonster {
|
2020-06-25 16:09:55 +02:00
|
|
|
|
2018-11-25 18:51:11 +01:00
|
|
|
}
|
|
|
|
|
2020-08-25 04:22:08 +02:00
|
|
|
+ public boolean shouldBurnInDay() { return T_(); } // Paper - OBFHELPER
|
|
|
|
protected boolean T_() {
|
2020-09-01 22:25:06 +02:00
|
|
|
- return true;
|
|
|
|
+ return this.shouldBurnInDay; // Paper - use api value instead
|
|
|
|
+ }
|
|
|
|
+
|
2018-11-25 18:51:11 +01:00
|
|
|
+ // Paper start
|
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ this.shouldBurnInDay = shouldBurnInDay;
|
2020-09-01 22:25:06 +02:00
|
|
|
}
|
2018-11-25 18:51:11 +01:00
|
|
|
+ // Paper end
|
2020-09-01 22:25:06 +02:00
|
|
|
|
2019-05-05 13:12:32 +02:00
|
|
|
@Override
|
2018-11-25 18:51:11 +01:00
|
|
|
public boolean damageEntity(DamageSource damagesource, float f) {
|
2021-02-21 21:55:01 +01:00
|
|
|
@@ -352,6 +366,7 @@ public class EntityZombie extends EntityMonster {
|
2020-08-25 04:22:08 +02:00
|
|
|
nbttagcompound.setBoolean("CanBreakDoors", this.eU());
|
|
|
|
nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bt : -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
|
|
|
|
}
|
|
|
|
|
2019-05-05 13:12:32 +02:00
|
|
|
@Override
|
2021-02-21 21:55:01 +01:00
|
|
|
@@ -363,7 +378,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
|
|
|
|
}
|
|
|
|
|
2019-05-05 13:12:32 +02:00
|
|
|
@Override
|
2018-11-25 18:51:11 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index 2387f17acb0de1d1c297fd85217f514e7b4577f3..d334e656ea0f442a14864a05d4701df162487851 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
|
2020-08-25 04:22:08 +02:00
|
|
|
@@ -94,6 +94,42 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
|
|
|
@Override
|
|
|
|
public void setAgeLock(boolean b) {
|
2018-11-25 18:51:11 +01:00
|
|
|
}
|
|
|
|
+ // Paper start
|
2019-05-06 21:30:27 +02:00
|
|
|
+ @Override
|
2018-11-25 18:51:11 +01:00
|
|
|
+ public boolean isDrowning() {
|
2020-08-02 07:39:36 +02:00
|
|
|
+ return getHandle().isDrownConverting();
|
2018-11-25 18:51:11 +01:00
|
|
|
+ }
|
|
|
|
+
|
2019-05-06 21:30:27 +02:00
|
|
|
+ @Override
|
2018-11-25 18:51:11 +01:00
|
|
|
+ public void startDrowning(int drownedConversionTime) {
|
2019-01-01 04:15:55 +01:00
|
|
|
+ getHandle().startDrownedConversion(drownedConversionTime);
|
2018-11-25 18:51:11 +01:00
|
|
|
+ }
|
|
|
|
+
|
2019-05-06 21:30:27 +02:00
|
|
|
+ @Override
|
2018-11-25 18:51:11 +01:00
|
|
|
+ public void stopDrowning() {
|
|
|
|
+ getHandle().stopDrowning();
|
|
|
|
+ }
|
|
|
|
+
|
2019-05-06 21:30:27 +02:00
|
|
|
+ @Override
|
2018-11-25 18:51:11 +01:00
|
|
|
+ public boolean shouldBurnInDay() {
|
|
|
|
+ return getHandle().shouldBurnInDay();
|
|
|
|
+ }
|
|
|
|
+
|
2019-05-06 21:30:27 +02:00
|
|
|
+ @Override
|
|
|
|
+ public boolean isArmsRaised() {
|
2020-08-02 07:39:36 +02:00
|
|
|
+ return getHandle().isAggressive();
|
2019-05-06 21:30:27 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setArmsRaised(final boolean raised) {
|
2020-08-02 07:39:36 +02:00
|
|
|
+ getHandle().setAggressive(raised);
|
2019-05-06 21:30:27 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2018-11-25 18:51:11 +01:00
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2020-08-25 04:22:08 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean getAgeLock() {
|