Paper/Spigot-Server-Patches/0317-Add-more-Zombie-API.patch
Jake Potrebic 899bc53b79
Updated Upstream (Bukkit/CraftBukkit) (#4779)
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:
f47abd88 SPIGOT-6242: Fix some file line endings
de96535b SPIGOT-6234: enum classes don't serialize properly when implementing ConfigurationSerializable

CraftBukkit Changes:
4475707d SPIGOT-6244: /spawnpoint ignores angle
8b3b096d SPIGOT-6242: Fix some file line endings
4b33c749 SPIGOT-6186: Canceling a CreatureSpawnEvent​ results in a "Unable to summon entity due to duplicate UUIDs" error
2b3ca726 SPIGOT-6236: Vehicle passenger portal cooldown does not change
2020-11-17 22:45:18 -05:00

118 Zeilen
4.2 KiB
Diff

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/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index d07847876e22971b4a90f67d8281bf08361424e0..8c4a27721b66800c2d9b7bc6c1878b73b76b0df1 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 bt;
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);
@@ -201,6 +202,12 @@ public class EntityZombie extends EntityMonster {
super.movementTick();
}
+ // Paper start
+ public void stopDrowning() {
+ this.drownedConversionTime = -1;
+ this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, false);
+ }
+ // Paper end
public void startDrownedConversion(int i) {
this.lastTick = MinecraftServer.currentTick; // CraftBukkit
this.drownedConversionTime = i;
@@ -226,9 +233,16 @@ public class EntityZombie extends EntityMonster {
}
+ public boolean shouldBurnInDay() { return T_(); } // Paper - OBFHELPER
protected boolean T_() {
- return true;
+ return this.shouldBurnInDay; // Paper - use api value instead
+ }
+
+ // Paper start
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ this.shouldBurnInDay = shouldBurnInDay;
}
+ // Paper end
@Override
public boolean damageEntity(DamageSource damagesource, float f) {
@@ -349,6 +363,7 @@ public class EntityZombie extends EntityMonster {
nbttagcompound.setBoolean("CanBreakDoors", this.eU());
nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bt : -1);
nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1);
+ nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper
}
@Override
@@ -360,7 +375,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 2387f17acb0de1d1c297fd85217f514e7b4577f3..d334e656ea0f442a14864a05d4701df162487851 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
@@ -94,6 +94,42 @@ public class CraftZombie extends CraftMonster implements Zombie {
@Override
public void setAgeLock(boolean b) {
}
+ // Paper start
+ @Override
+ public boolean isDrowning() {
+ return getHandle().isDrownConverting();
+ }
+
+ @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().isAggressive();
+ }
+
+ @Override
+ public void setArmsRaised(final boolean raised) {
+ getHandle().setAggressive(raised);
+ }
+
+ @Override
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
+ }
+ // Paper end
@Override
public boolean getAgeLock() {