mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
bc127ea819
Upstream has released updates that appear 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: eec4aab0 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent 205213c6 SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron CraftBukkit Changes: b8c522d5 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent f04a77dc SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron d1dbcebc SPIGOT-6653: Canceling snow bucket placement removes snow from bucket 4f34a67b #891: Fix scheduler task ID overflow and duplication issues Spigot Changes: d03d7f12 BUILDTOOLS-604: Rebuild patches
116 lines
4.1 KiB
Diff
116 lines
4.1 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/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
index f8b97aa5819e228f31c7953ee6e5c4e69fe55666..c3cc876d1cbbce490a40550dbd0f02e52f1fc1bc 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
@@ -96,6 +96,7 @@ public class Zombie extends Monster {
|
|
private int inWaterTime;
|
|
public int conversionTime;
|
|
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
|
+ private boolean shouldBurnInDay = true; // Paper
|
|
|
|
public Zombie(EntityType<? extends Zombie> type, Level world) {
|
|
super(type, world);
|
|
@@ -264,6 +265,12 @@ public class Zombie extends Monster {
|
|
super.aiStep();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public void stopDrowning() {
|
|
+ this.conversionTime = -1;
|
|
+ this.getEntityData().set(Zombie.DATA_DROWNED_CONVERSION_ID, false);
|
|
+ }
|
|
+ // Paper end
|
|
public void startUnderWaterConversion(int ticksUntilWaterConversion) {
|
|
this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
|
this.conversionTime = ticksUntilWaterConversion;
|
|
@@ -293,9 +300,15 @@ public class Zombie extends Monster {
|
|
}
|
|
|
|
public boolean isSunSensitive() {
|
|
- 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 hurt(DamageSource source, float amount) {
|
|
if (!super.hurt(source, amount)) {
|
|
@@ -415,6 +428,7 @@ public class Zombie extends Monster {
|
|
nbt.putBoolean("CanBreakDoors", this.canBreakDoors());
|
|
nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
|
|
nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
|
|
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper
|
|
}
|
|
|
|
@Override
|
|
@@ -426,6 +440,11 @@ public class Zombie extends Monster {
|
|
if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) {
|
|
this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime"));
|
|
}
|
|
+ // Paper start
|
|
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
|
|
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
|
+ }
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
|
index 2e643e92569512ac4e75c0ef2ee7aa4b688e7356..77e4875484bdaedfba576a6b008245c488b2a112 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
|
@@ -93,6 +93,42 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
|
@Override
|
|
public void setAgeLock(boolean b) {
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public boolean isDrowning() {
|
|
+ return getHandle().isUnderWaterConverting();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void startDrowning(int drownedConversionTime) {
|
|
+ getHandle().startUnderWaterConversion(drownedConversionTime);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void stopDrowning() {
|
|
+ getHandle().stopDrowning();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean shouldBurnInDay() {
|
|
+ return getHandle().isSunSensitive();
|
|
+ }
|
|
+
|
|
+ @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() {
|