2021-06-11 12:02:28 +00:00
|
|
|
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
|
2021-06-15 02:59:31 +00:00
|
|
|
index 6b4163f5601a0961055c8451ec7ef2204938cf69..c54a37516ef1d8a76f7161917bf448127cd98603 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
2021-06-15 02:59:31 +00:00
|
|
|
@@ -97,9 +97,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
2021-06-11 12:02:28 +00:00
|
|
|
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);
|
2021-06-15 02:59:31 +00:00
|
|
|
@@ -223,7 +229,16 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
|
|
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
|
|
|
super.readAdditionalSaveData(nbt);
|
2021-06-11 12:02:28 +00:00
|
|
|
this.reassessWeaponGoal();
|
2021-06-15 02:59:31 +00:00
|
|
|
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Paper
|
2021-06-11 12:02:28 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
2021-06-15 02:59:31 +00:00
|
|
|
+ public void addAdditionalSaveData(CompoundTag nbt) {
|
|
|
|
+ super.addAdditionalSaveData(nbt);
|
|
|
|
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
|
|
|
+ // 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
|
2021-06-16 00:50:38 +00:00
|
|
|
index 2257391ad42219efda0b6a11f1ca0f66e377e412..1ffe939bb66358391d92d3e5378865b1cc8690fd 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
2021-06-15 02:59:31 +00:00
|
|
|
@@ -145,7 +145,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
2021-06-11 12:02:28 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void aiStep() {
|
|
|
|
- if (this.isAlive() && this.isSunBurnTick()) {
|
|
|
|
+ if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning
|
|
|
|
this.setSecondsOnFire(8);
|
|
|
|
}
|
|
|
|
|
2021-06-15 02:59:31 +00:00
|
|
|
@@ -176,6 +176,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
|
|
if (nbt.hasUUID("Paper.SpawningEntity")) {
|
|
|
|
this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
2021-06-15 02:59:31 +00:00
|
|
|
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
2021-06-11 12:02:28 +00:00
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
|
2021-06-15 02:59:31 +00:00
|
|
|
@@ -190,6 +191,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
2021-06-11 12:02:28 +00:00
|
|
|
if (this.spawningEntity != null) {
|
2021-06-15 02:59:31 +00:00
|
|
|
nbt.setUUID("Paper.SpawningEntity", this.spawningEntity);
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
2021-06-15 02:59:31 +00:00
|
|
|
+ nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay);
|
2021-06-11 12:02:28 +00:00
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
|
2021-06-15 02:59:31 +00:00
|
|
|
@@ -249,6 +251,10 @@ public class Phantom extends FlyingMob implements Enemy {
|
2021-06-11 12:02:28 +00:00
|
|
|
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
|
2021-06-15 02:59:31 +00:00
|
|
|
private static enum AttackPhase {
|
2021-06-11 12:02:28 +00:00
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
2021-06-15 02:59:31 +00:00
|
|
|
index c9dab70b0b284fe1c1daafd3c1f5bd08b14fa35d..dce23f3878b1588c26b6116d80e597d08070edbc 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
2021-06-15 02:59:31 +00:00
|
|
|
@@ -40,5 +40,15 @@ public class CraftPhantom extends CraftFlying implements Phantom {
|
2021-06-11 12:02:28 +00:00
|
|
|
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
|
2021-06-15 02:59:31 +00:00
|
|
|
index 3b19cd5a232f38d373359072925be12f6c075d4a..a248774ead0afee576af291e70a9a05d12ca203b 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
2021-06-15 02:59:31 +00:00
|
|
|
@@ -51,4 +51,16 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton, co
|
|
|
|
public SkeletonType getSkeletonType() {
|
|
|
|
return SkeletonType.NORMAL;
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public boolean shouldBurnInDay() {
|
|
|
|
+ return getHandle().shouldBurnInDay();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|