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
|
2024-10-23 20:15:25 +02:00
|
|
|
index 723a098eabcc632caeb096f39c90e4e0581edc35..0cb179bc28cc863b09a079b37b957744f26f3e1d 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
|
2024-10-23 20:15:25 +02:00
|
|
|
@@ -95,9 +95,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
2024-04-24 15:46:45 +02:00
|
|
|
|
|
|
|
abstract SoundEvent getStepSound();
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper start - shouldBurnInDay API
|
2021-06-11 14:02:28 +02:00
|
|
|
+ private boolean shouldBurnInDay = true;
|
|
|
|
+ public boolean shouldBurnInDay() { return shouldBurnInDay; }
|
|
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper end - shouldBurnInDay API
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public void aiStep() {
|
|
|
|
- boolean flag = this.isSunBurnTick();
|
2024-01-19 17:54:05 +01:00
|
|
|
+ boolean flag = shouldBurnInDay && this.isSunBurnTick(); // Paper - shouldBurnInDay API
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
|
2024-10-23 20:15:25 +02:00
|
|
|
@@ -236,7 +242,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();
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper start - shouldBurnInDay API
|
2021-06-23 10:07:59 +02:00
|
|
|
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
|
|
|
|
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
|
|
|
+ }
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper end - shouldBurnInDay API
|
2023-03-23 22:57:03 +01:00
|
|
|
+ }
|
|
|
|
+
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper start - shouldBurnInDay API
|
2021-06-11 14:02:28 +02:00
|
|
|
+ @Override
|
2021-06-15 04:59:31 +02:00
|
|
|
+ public void addAdditionalSaveData(CompoundTag nbt) {
|
|
|
|
+ super.addAdditionalSaveData(nbt);
|
|
|
|
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
2023-03-23 22:57:03 +01:00
|
|
|
}
|
2024-01-19 17:54:05 +01:00
|
|
|
+ // Paper end - shouldBurnInDay API
|
2023-03-23 22:57:03 +01:00
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
@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
|
2024-10-23 20:15:25 +02:00
|
|
|
index d0820b3a561db7e1e5667594b2b6ea13214dfa58..150fd890ac65097b5434fd88e8d2b24a89dca79a 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
|
2024-10-23 20:15:25 +02:00
|
|
|
@@ -139,7 +139,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()) {
|
2024-04-24 15:46:45 +02:00
|
|
|
+ if (this.isAlive() && this.shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API
|
2024-06-14 00:44:26 +02:00
|
|
|
this.igniteForSeconds(8.0F);
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2024-10-23 20:15:25 +02:00
|
|
|
@@ -165,6 +165,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
|
|
|
|
}
|
|
|
|
|
2024-10-23 20:15:25 +02:00
|
|
|
@@ -179,6 +182,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
|
|
|
|
}
|
|
|
|
|
2024-04-24 15:46:45 +02:00
|
|
|
@@ -238,6 +242,9 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
|
|
return this.spawningEntity;
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
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
|
|
|
|
|
2024-04-24 15:46:45 +02:00
|
|
|
private static enum AttackPhase {
|
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
|
2023-08-14 01:32:51 +02:00
|
|
|
index 305a635b049741ac5e2670060c6818cb2c07e5ab..9304e201db1ec96d0916aa8ea781f3e4bc7991e6 100644
|
2021-12-22 01:31:33 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
2023-08-14 01:32:51 +02:00
|
|
|
@@ -34,5 +34,15 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
|
2021-12-22 01:31:33 +01:00
|
|
|
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
|
|
|
}
|