2021-06-11 14:02:28 +02:00
|
|
|
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
|
|
|
|
|
2022-11-20 00:53:20 +01:00
|
|
|
== AT ==
|
|
|
|
public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
2023-12-05 18:20:55 +01:00
|
|
|
index 0c9a91990376482bc16f74a8b183ebf049ee1949..39a508b2834e554e94d635abd0d4a549f317dee5 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
2023-09-22 00:26:51 +02:00
|
|
|
@@ -96,6 +96,7 @@ public class Zombie extends Monster {
|
2021-06-11 14:02:28 +02:00
|
|
|
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);
|
2023-09-22 00:26:51 +02:00
|
|
|
@@ -264,6 +265,12 @@ public class Zombie extends Monster {
|
2021-06-11 14:02:28 +02:00
|
|
|
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;
|
2023-09-22 00:26:51 +02:00
|
|
|
@@ -293,9 +300,15 @@ public class Zombie extends Monster {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-06-16 00:24:12 +02:00
|
|
|
public boolean isSunSensitive() {
|
2021-06-11 14:02:28 +02:00
|
|
|
- return true;
|
|
|
|
+ return this.shouldBurnInDay; // Paper - use api value instead
|
2021-06-13 10:26:58 +02:00
|
|
|
}
|
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start
|
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ this.shouldBurnInDay = shouldBurnInDay;
|
2021-06-13 10:26:58 +02:00
|
|
|
+ }
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper end
|
2021-06-13 10:26:58 +02:00
|
|
|
+
|
2021-06-11 14:02:28 +02:00
|
|
|
@Override
|
|
|
|
public boolean hurt(DamageSource source, float amount) {
|
2021-06-13 10:26:58 +02:00
|
|
|
if (!super.hurt(source, amount)) {
|
2023-09-22 00:26:51 +02:00
|
|
|
@@ -415,6 +428,7 @@ public class Zombie extends Monster {
|
2021-06-13 10:26:58 +02:00
|
|
|
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
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-09-22 00:26:51 +02:00
|
|
|
@@ -426,6 +440,11 @@ public class Zombie extends Monster {
|
2021-06-13 10:26:58 +02:00
|
|
|
if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) {
|
|
|
|
this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime"));
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+ // Paper start
|
2021-06-13 10:26:58 +02:00
|
|
|
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
|
|
|
|
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2021-06-13 10:26:58 +02:00
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
2023-12-05 18:20:55 +01:00
|
|
|
index 99dcaa827831a40ea46453f502d8b6ccb107f0ad..4412c913123f7521f449c98b60378e8d3b1671ce 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
2023-08-14 01:32:51 +02:00
|
|
|
@@ -87,6 +87,42 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
2021-06-11 14:02:28 +02:00
|
|
|
@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() {
|
2021-06-16 00:24:12 +02:00
|
|
|
+ return getHandle().isSunSensitive();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @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() {
|