geforkt von Mirrors/Paper
d5f1ffc2e6
With the new chunk system it doesn't hurt too much to (temporarily) remove this until implemented in a safer manner
132 Zeilen
5.6 KiB
Diff
132 Zeilen
5.6 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 c2a26b91d9065fdb52a1ded6c3295093c244d7eb..b8abee145fc92faddef98da913eca7715b6bfc03 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);
|
|
@@ -225,7 +231,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 5432b3eff8ac09e45c7e118ddc1bc5303005412b..aa8734856ec7b90036afad13bfda46c02e548812 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
@@ -144,7 +144,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);
|
|
}
|
|
|
|
@@ -175,6 +175,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
|
|
}
|
|
|
|
@@ -189,6 +192,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
|
|
}
|
|
|
|
@@ -248,6 +252,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/CraftAbstractSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java
|
|
index 5ff566186431440c25a26900aba14e4adb642031..5beaa2bb0d58fe477ce8d2de8b77600d3b416d8c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java
|
|
@@ -20,4 +20,15 @@ public abstract class CraftAbstractSkeleton extends CraftMonster implements Abst
|
|
return (net.minecraft.world.entity.monster.AbstractSkeleton) super.getHandle();
|
|
}
|
|
// Paper end
|
|
+ // Paper start
|
|
+ @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/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
|
|
}
|