aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0323-Add-more-Zombie-API.patch
blob: b1b358f7146077fdc1fb09594d8796171c7821fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index e0ecdb8f87ec82b97a056c8f6d91d6a86f37bd34..5e9a05dfe822c42b83da84a154fe881d57ac1689 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1418,6 +1418,8 @@ public abstract class EntityInsentient extends EntityLiving {
         this.datawatcher.set(EntityInsentient.b, flag ? (byte) (b0 | 2) : (byte) (b0 & -3));
     }
 
+    public boolean isArmsRaisedZombie() { return (this.datawatcher.get(EntityInsentient.b) & 4) != 0; } // Paper - OBFHELPER
+    public void setArmsRaisedZombie(boolean flag) { this.setAggressive(flag); } // Paper - OBFHELPER
     public void setAggressive(boolean flag) {
         byte b0 = (Byte) this.datawatcher.get(EntityInsentient.b);
 
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index bb7f62fa52b758ed83db7def9053b79da3d97dcd..c9f212b586662856f1503bb0ca8d91900f2e9c5f 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -33,6 +33,7 @@ public class EntityZombie extends EntityMonster {
     private int bA;
     public int drownedConversionTime;
     private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
+    private boolean shouldBurnInDay = true; // Paper
 
     public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
         super(entitytypes, world);
@@ -74,6 +75,7 @@ public class EntityZombie extends EntityMonster {
         this.getDataWatcher().register(EntityZombie.DROWN_CONVERTING, false);
     }
 
+    public boolean isDrowning() { return isDrownConverting(); } // Paper - OBFHELPER
     public boolean isDrownConverting() {
         return (Boolean) this.getDataWatcher().get(EntityZombie.DROWN_CONVERTING);
     }
@@ -206,6 +208,13 @@ public class EntityZombie extends EntityMonster {
         this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true);
     }
 
+    // Paper start
+    public void stopDrowning() {
+        this.drownedConversionTime = -1;
+        this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, false);
+    }
+    // Paper end
+
     protected void eQ() {
         this.c(EntityTypes.DROWNED);
         if (!this.isSilent()) {
@@ -225,10 +234,17 @@ public class EntityZombie extends EntityMonster {
 
     }
 
+    public boolean shouldBurnInDay() { return U_(); } // Paper - OBFHELPER
     protected boolean U_() {
-        return true;
+        return shouldBurnInDay;
     }
 
+    // Paper start
+    public void setShouldBurnInDay(boolean shouldBurnInDay) {
+        this.shouldBurnInDay = shouldBurnInDay;
+    }
+    // Paper end
+
     @Override
     public boolean damageEntity(DamageSource damagesource, float f) {
         if (super.damageEntity(damagesource, f)) {
@@ -348,6 +364,7 @@ public class EntityZombie extends EntityMonster {
         nbttagcompound.setBoolean("CanBreakDoors", this.eV());
         nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bA : -1);
         nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1);
+        nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper
     }
 
     @Override
@@ -362,7 +379,11 @@ public class EntityZombie extends EntityMonster {
         if (nbttagcompound.hasKeyOfType("DrownedConversionTime", 99) && nbttagcompound.getInt("DrownedConversionTime") > -1) {
             this.startDrownedConversion(nbttagcompound.getInt("DrownedConversionTime"));
         }
-
+        // Paper start
+        if (nbttagcompound.hasKey("Paper.ShouldBurnInDay")) {
+            shouldBurnInDay = nbttagcompound.getBoolean("Paper.ShouldBurnInDay");
+        }
+        // Paper end
     }
 
     @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
index 0429cf020e462d3655bf1159ec857cad33544b71..c4320dbb67059be9456b0eef700a5f3e83c7c75b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
@@ -80,4 +80,41 @@ public class CraftZombie extends CraftMonster implements Zombie {
             getHandle().startDrownedConversion(time);
         }
     }
+
+    // Paper start
+    @Override
+    public boolean isDrowning() {
+        return getHandle().isDrowning();
+    }
+
+    @Override
+    public void startDrowning(int drownedConversionTime) {
+        getHandle().startDrownedConversion(drownedConversionTime);
+    }
+
+    @Override
+    public void stopDrowning() {
+        getHandle().stopDrowning();
+    }
+
+    @Override
+    public boolean shouldBurnInDay() {
+        return getHandle().shouldBurnInDay();
+    }
+
+    @Override
+    public boolean isArmsRaised() {
+        return getHandle().isArmsRaisedZombie();
+    }
+
+    @Override
+    public void setArmsRaised(final boolean raised) {
+        getHandle().setArmsRaisedZombie(raised);
+    }
+
+    @Override
+    public void setShouldBurnInDay(boolean shouldBurnInDay) {
+        getHandle().setShouldBurnInDay(shouldBurnInDay);
+    }
+    // Paper end
 }