Paper/patches/server/0680-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch
Jason bc127ea819
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6222)
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
2021-07-18 09:41:53 +02:00

133 lines
5.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MeFisto94 <MeFisto94@users.noreply.github.com>
Date: Tue, 11 May 2021 00:48:33 +0200
Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and
Skeletons
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index 6b4163f5601a0961055c8451ec7ef2204938cf69..cd75f895b6818fbb7ed4b0ef3df873f264bb2d1b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -97,9 +97,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
return MobType.UNDEAD;
}
+ // Paper start
+ private boolean shouldBurnInDay = true;
+ public boolean shouldBurnInDay() { return shouldBurnInDay; }
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
+ // Paper end
+
@Override
public void aiStep() {
- boolean flag = this.isSunBurnTick();
+ boolean flag = shouldBurnInDay && this.isSunBurnTick(); // Paper - Configurable Burning
if (flag) {
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
@@ -223,7 +229,20 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
public void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt);
this.reassessWeaponGoal();
+ // Paper start
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
+ }
+ // Paper end
+ }
+
+ // Paper start
+ @Override
+ public void addAdditionalSaveData(CompoundTag nbt) {
+ super.addAdditionalSaveData(nbt);
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
}
+ // Paper end
@Override
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 460a848bd2a417d05a0bbb084371c98b661a427f..39291a0cea465613733a905141b584f05e597b4c 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -145,7 +145,7 @@ public class Phantom extends FlyingMob implements Enemy {
@Override
public void aiStep() {
- if (this.isAlive() && this.isSunBurnTick()) {
+ if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning
this.setSecondsOnFire(8);
}
@@ -176,6 +176,9 @@ public class Phantom extends FlyingMob implements Enemy {
if (nbt.hasUUID("Paper.SpawningEntity")) {
this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
}
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
+ }
// Paper end
}
@@ -190,6 +193,7 @@ public class Phantom extends FlyingMob implements Enemy {
if (this.spawningEntity != null) {
nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
}
+ nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay);
// Paper end
}
@@ -249,6 +253,10 @@ public class Phantom extends FlyingMob implements Enemy {
return spawningEntity;
}
public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
+
+ private boolean shouldBurnInDay = true;
+ public boolean shouldBurnInDay() { return shouldBurnInDay; }
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
// Paper end
private static enum AttackPhase {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
index c9dab70b0b284fe1c1daafd3c1f5bd08b14fa35d..dce23f3878b1588c26b6116d80e597d08070edbc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
@@ -40,5 +40,15 @@ public class CraftPhantom extends CraftFlying implements Phantom {
public java.util.UUID getSpawningEntity() {
return getHandle().getSpawningEntity();
}
+
+ @Override
+ public boolean shouldBurnInDay() {
+ return getHandle().shouldBurnInDay();
+ }
+
+ @Override
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
+ }
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
index 78f736ed3abaab4cc8bf8b7b163e25c806f79f3c..61e2841fea6603e3e5fbd004de7ffdfb79fc9981 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
@@ -51,4 +51,16 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton {
public SkeletonType getSkeletonType() {
return SkeletonType.NORMAL;
}
+
+ // Paper start
+ @Override
+ public boolean shouldBurnInDay() {
+ return getHandle().shouldBurnInDay();
+ }
+
+ @Override
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
+ }
+ // Paper end
}