fix mobs not burning in daylight (#1689)

This commit is contained in:
MXU
2025-07-07 00:46:51 +01:00
committed by GitHub
parent 8734844b1c
commit 09ea9cb927
2 changed files with 32 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ index 34e0fbef06b0c7aededf27fe9dc64f3f6f33e3ae..ce3e5ec505ac37c820436bcf7c7d6452
this.type = entityType; this.type = entityType;
this.level = level; this.level = level;
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 385f7664d51056efd47f685514a98b71784e8ba3..4bd5e7cbaab0998e782bc67d3ba079a80ac40789 100644 index f22862464068180a4276175bf79c40394523703f..3d93e89e7bad80cd5b5c7ccbb738980f4b3469bc 100644
--- a/net/minecraft/world/entity/LivingEntity.java --- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java
@@ -286,6 +286,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin @@ -286,6 +286,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -58,7 +58,7 @@ index 385f7664d51056efd47f685514a98b71784e8ba3..4bd5e7cbaab0998e782bc67d3ba079a8
} // Paper - The sleeping pos will always also set the actual pos, so a desync suggests something is wrong } // Paper - The sleeping pos will always also set the actual pos, so a desync suggests something is wrong
}, this::clearSleepingPos); }, this::clearSleepingPos);
input.read("Brain", Codec.PASSTHROUGH).ifPresent(dynamic -> this.brain = this.makeBrain((Dynamic<?>)dynamic)); input.read("Brain", Codec.PASSTHROUGH).ifPresent(dynamic -> this.brain = this.makeBrain((Dynamic<?>)dynamic));
+ this.shouldBurnInDay = input.getBooleanOr("Purpur.ShouldBurnInDay", false); // Purpur - API for any mob to burn daylight + this.shouldBurnInDay = input.getBooleanOr("Purpur.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - API for any mob to burn daylight
this.lastHurtByPlayer = EntityReference.read(input, "last_hurt_by_player"); this.lastHurtByPlayer = EntityReference.read(input, "last_hurt_by_player");
this.lastHurtByPlayerMemoryTime = input.getIntOr("last_hurt_by_player_memory_time", 0); this.lastHurtByPlayerMemoryTime = input.getIntOr("last_hurt_by_player_memory_time", 0);
this.lastHurtByMob = EntityReference.read(input, "last_hurt_by_mob"); this.lastHurtByMob = EntityReference.read(input, "last_hurt_by_mob");
@@ -207,9 +207,18 @@ index 9baec22561093d64157d93449e84c23b3f238b39..3f331215ef49c52fa3a53bcf744159d2
@Override @Override
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
index 67dc738faef3ab414bf791692090aaea3dbe7385..2c7f11e165ea9f59dca6de559c7bcba39977cb19 100644 index 67dc738faef3ab414bf791692090aaea3dbe7385..512195d639e84684a32ad6fb53e527996b0a4d21 100644
--- a/net/minecraft/world/entity/monster/Phantom.java --- a/net/minecraft/world/entity/monster/Phantom.java
+++ b/net/minecraft/world/entity/monster/Phantom.java +++ b/net/minecraft/world/entity/monster/Phantom.java
@@ -53,7 +53,7 @@ public class Phantom extends Mob implements Enemy {
// Paper start
@Nullable
public java.util.UUID spawningEntity;
- public boolean shouldBurnInDay = true;
+ //public boolean shouldBurnInDay = true; // Purpur - API for any mob to burn daylight
// Paper end
private static final net.minecraft.world.item.crafting.Ingredient TORCH = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.item.Items.TORCH, net.minecraft.world.item.Items.SOUL_TORCH); // Purpur - Phantoms burn in light
@@ -62,6 +62,7 @@ public class Phantom extends Mob implements Enemy { @@ -62,6 +62,7 @@ public class Phantom extends Mob implements Enemy {
this.xpReward = 5; this.xpReward = 5;
this.moveControl = new Phantom.PhantomMoveControl(this); this.moveControl = new Phantom.PhantomMoveControl(this);
@@ -266,7 +275,7 @@ index 67dc738faef3ab414bf791692090aaea3dbe7385..2c7f11e165ea9f59dca6de559c7bcba3
// Paper start // Paper start
output.storeNullable("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity); output.storeNullable("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity);
- output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); - output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight + //output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
// Paper end // Paper end
} }

View File

@@ -44,3 +44,22 @@ index 69d92e708bac7925ff30e403e94200236536b670..fc4fa99a993a017676da2be3cb254399
+ } + }
+ // Purpur end - API for any mob to burn daylight + // Purpur end - API for any mob to burn daylight
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
index cabdcbef0e6f7ca41ff5677bc2e6a81665ca812d..c47ca9ab164b6abd28e979c94456918162e49214 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
@@ -35,12 +35,12 @@ public class CraftPhantom extends CraftMob implements Phantom, CraftEnemy {
@Override
public boolean shouldBurnInDay() {
- return this.getHandle().shouldBurnInDay;
+ return this.getHandle().shouldBurnInDay(); // Purpur - API for any mob to burn daylight
}
@Override
public void setShouldBurnInDay(boolean shouldBurnInDay) {
- this.getHandle().shouldBurnInDay = shouldBurnInDay;
+ this.getHandle().setShouldBurnInDay(shouldBurnInDay); // Purpur - API for any mob to burn daylight
}
@Override