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
|
2020-08-02 07:39:36 +02:00
|
|
|
index bb7f62fa52b758ed83db7def9053b79da3d97dcd..641d0b462d326dc9b5f6ce2d7f620e428dc25539 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-06-25 16:09:55 +02:00
|
|
|
private int bA;
|
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-02 07:39:36 +02:00
|
|
|
@@ -206,6 +207,13 @@ public class EntityZombie extends EntityMonster {
|
2019-01-01 04:15:55 +01:00
|
|
|
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;
|
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-06-25 16:09:55 +02:00
|
|
|
protected void eQ() {
|
|
|
|
this.c(EntityTypes.DROWNED);
|
|
|
|
if (!this.isSilent()) {
|
2020-08-02 07:39:36 +02:00
|
|
|
@@ -225,10 +233,17 @@ public class EntityZombie extends EntityMonster {
|
2020-06-25 16:09:55 +02:00
|
|
|
|
2018-11-25 18:51:11 +01:00
|
|
|
}
|
|
|
|
|
2020-06-25 16:09:55 +02:00
|
|
|
+ public boolean shouldBurnInDay() { return U_(); } // Paper - OBFHELPER
|
|
|
|
protected boolean U_() {
|
2018-11-25 18:51:11 +01:00
|
|
|
- return true;
|
2019-05-05 13:12:32 +02:00
|
|
|
+ return shouldBurnInDay;
|
2018-11-25 18:51:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ this.shouldBurnInDay = shouldBurnInDay;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2019-05-05 13:12:32 +02:00
|
|
|
@Override
|
2018-11-25 18:51:11 +01:00
|
|
|
public boolean damageEntity(DamageSource damagesource, float f) {
|
|
|
|
if (super.damageEntity(damagesource, f)) {
|
2020-08-02 07:39:36 +02:00
|
|
|
@@ -348,6 +363,7 @@ public class EntityZombie extends EntityMonster {
|
2020-06-25 16:09:55 +02:00
|
|
|
nbttagcompound.setBoolean("CanBreakDoors", this.eV());
|
|
|
|
nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bA : -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
|
2020-08-02 07:39:36 +02:00
|
|
|
@@ -362,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-02 07:39:36 +02:00
|
|
|
index 0429cf020e462d3655bf1159ec857cad33544b71..30004ea3a36029827e90e587017a1dad2ede4435 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
|
2019-05-06 21:30:27 +02:00
|
|
|
@@ -80,4 +80,41 @@ 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
|
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
|
|
|
|
}
|