aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0399-Add-more-Zombie-API.patch
blob: 66eae073612010274908af811a43f544444fe7ca (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
140
141
142
143
144
145
146
147
148
From 71f4a80d0a3fa035ed1bee5c0539f65f0a4b9639 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/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 81cc0c3b33..24bc3e0f08 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -21,8 +21,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);
-    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
     private final PathfinderGoalBreakDoor bG;
     private boolean bH;
     private int bI;
@@ -30,6 +30,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);
@@ -78,14 +79,22 @@ 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);
     }
 
+    public void setArmsRaised(boolean raised) { s(raised); } // Paper - OBFHELPER
     public void s(boolean flag) {
         this.getDataWatcher().set(EntityZombie.bE, flag);
     }
 
+    // Paper start
+    public boolean isArmsRaised() {
+        return ((Boolean) this.getDataWatcher().get(EntityZombie.armsRaised)).booleanValue();
+    }
+    // Paper end
+
     public boolean dH() {
         return this.bH;
     }
@@ -207,6 +216,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.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);
@@ -245,10 +261,17 @@ public class EntityZombie extends EntityMonster {
         }
     }
 
+    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();
@@ -361,6 +384,7 @@ public class EntityZombie extends EntityMonster {
         nbttagcompound.setBoolean("CanBreakDoors", this.dH());
         nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bI : -1);
         nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1);
+        nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper
     }
 
     public void a(NBTTagCompound nbttagcompound) {
@@ -374,7 +398,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
     }
 
     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
index e93ecb076b..c516d34759 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
@@ -77,4 +77,34 @@ public class CraftZombie extends CraftMonster implements Zombie {
             getHandle().startDrownedConversion(time);
         }
     }
+
+    // Paper start
+    public boolean isDrowning() {
+        return getHandle().isDrowning();
+    }
+
+    public void startDrowning(int drownedConversionTime) {
+        getHandle().startDrownedConversion(drownedConversionTime);
+    }
+
+    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
 }
-- 
2.21.0