2021-06-11 14:02:28 +02: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-11-24 22:30:53 +01:00
|
|
|
index ecf12ed5014202181e78af051e4a9ca88a275794..e23fe546291e670f89447398507d08a0a07efa85 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
2021-11-24 22:30:53 +01:00
|
|
|
@@ -96,9 +96,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
2021-06-11 14:02:28 +02: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-11-24 22:30:53 +01:00
|
|
|
@@ -222,7 +228,20 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
2021-06-15 04:59:31 +02:00
|
|
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
|
|
|
super.readAdditionalSaveData(nbt);
|
2021-06-11 14:02:28 +02:00
|
|
|
this.reassessWeaponGoal();
|
2021-06-23 10:07:59 +02:00
|
|
|
+ // Paper start
|
|
|
|
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
|
|
|
|
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
2021-06-15 04:59:31 +02:00
|
|
|
+ public void addAdditionalSaveData(CompoundTag nbt) {
|
|
|
|
+ super.addAdditionalSaveData(nbt);
|
|
|
|
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
2021-06-11 14:02:28 +02: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
|
2022-03-01 04:25:13 +01:00
|
|
|
index ca9324381a60fc3072719c39918a1c16ac88799b..b55640ed068becd40cbb7d7507b4e67ae9ee792a 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
2021-11-24 22:30:53 +01:00
|
|
|
@@ -144,7 +144,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void aiStep() {
|
|
|
|
- if (this.isAlive() && this.isSunBurnTick()) {
|
|
|
|
+ if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning
|
|
|
|
this.setSecondsOnFire(8);
|
|
|
|
}
|
|
|
|
|
2021-11-24 22:30:53 +01:00
|
|
|
@@ -175,6 +175,9 @@ public class Phantom extends FlyingMob implements Enemy {
|
2021-06-15 04:59:31 +02:00
|
|
|
if (nbt.hasUUID("Paper.SpawningEntity")) {
|
|
|
|
this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
2021-06-23 10:07:59 +02:00
|
|
|
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
|
|
|
|
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
|
|
|
+ }
|
2021-06-11 14:02:28 +02:00
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
|
2021-11-24 22:30:53 +01:00
|
|
|
@@ -189,6 +192,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
2021-06-11 14:02:28 +02:00
|
|
|
if (this.spawningEntity != null) {
|
2021-06-17 23:39:36 +02:00
|
|
|
nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
2021-06-15 04:59:31 +02:00
|
|
|
+ nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay);
|
2021-06-11 14:02:28 +02:00
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
|
2021-11-24 22:30:53 +01:00
|
|
|
@@ -248,6 +252,10 @@ public class Phantom extends FlyingMob implements Enemy {
|
2021-06-11 14:02:28 +02: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 04:59:31 +02:00
|
|
|
private static enum AttackPhase {
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2021-12-22 01:31:33 +01:00
|
|
|
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();
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
2021-12-22 01:31:33 +01:00
|
|
|
// Paper end
|
|
|
|
+ // Paper start
|
2021-06-11 14:02:28 +02:00
|
|
|
+ @Override
|
|
|
|
+ public boolean shouldBurnInDay() {
|
|
|
|
+ return getHandle().shouldBurnInDay();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
|
|
|
|
+ }
|
2021-12-22 01:31:33 +01:00
|
|
|
+ // Paper end
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
2021-12-22 01:31:33 +01:00
|
|
|
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();
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean shouldBurnInDay() {
|
|
|
|
+ return getHandle().shouldBurnInDay();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
|
|
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
|
|
|
|
+ }
|
2021-12-22 01:31:33 +01:00
|
|
|
// Paper end
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|