Paper/Spigot-Server-Patches/0410-Add-more-Zombie-API.patch
Shane Freeder 3496f2d7e4
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Developers!: You will need to clean up your work/Minecraft/1.13.2 folder for this

Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
b850a822 SPIGOT-4526: Add conversion time API for Zombie & subclasses

CraftBukkit Changes:
38cf676e SPIGOT-4534: CreatureSpawnEvent not being called for CHUNK_GEN
b446cb5d SPIGOT-4527: Fix sponges with waterlogged blocks
6ec8ea5c SPIGOT-4526: Add conversion time API for Zombie & subclasses
c64fe508 Mappings Update
a3c2ec03 Fix missing ServerListPingEvent call for legacy pings

Spigot Changes:
1dc156ce Rebuild patches
140f654d Mappings Update
2018-12-17 05:19:39 +00:00

155 lines
6.3 KiB
Diff

From 33e6d336c29648d4c515229c8d8d83df8aa15be7 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 f25bcfd8f..72ea3ba76 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -22,8 +22,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> bF = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); // PAIL
+ 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> bF = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> drowning = bF; // Paper - OBFHELPER
private final PathfinderGoalBreakDoor bG;
private boolean bH;
private int bI;
@@ -31,6 +31,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);
@@ -79,14 +80,22 @@ public class EntityZombie extends EntityMonster {
this.getDataWatcher().register(EntityZombie.bF, false);
}
+ public boolean isDrowning() { return isDrownConverting(); } // Paper - OBFHELPER
public boolean isDrownConverting() {
return (Boolean) this.getDataWatcher().get(EntityZombie.bF);
}
+ 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;
}
@@ -210,11 +219,19 @@ public class EntityZombie extends EntityMonster {
super.movementTick();
}
+ public void startDrowning(int drownedConversionTime) { a(drownedConversionTime); } // Paper - OBFHELPER
public void a(int i) { // PAIL
this.drownedConversionTime = i;
this.getDataWatcher().set(EntityZombie.bF, 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);
@@ -253,10 +270,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();
@@ -369,6 +393,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) {
@@ -382,7 +407,11 @@ public class EntityZombie extends EntityMonster {
if (nbttagcompound.hasKeyOfType("DrownedConversionTime", 99) && nbttagcompound.getInt("DrownedConversionTime") > -1) {
this.a(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 7af4ea9f8..4d4c50212 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().a(time);
}
}
+
+ // Paper start
+ public boolean isDrowning() {
+ return getHandle().isDrowning();
+ }
+
+ public void startDrowning(int drownedConversionTime) {
+ getHandle().startDrowning(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.20.0