From 414cf7d035cfecf8c15a0e8643ff80e5603f58b1 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Tue, 25 Jan 2022 17:31:31 -0600 Subject: [PATCH] Fix #868 --- patches/server/0006-Ridables.patch | 15 +++--- ...ed-to-crystals-and-crystals-shoot-ph.patch | 4 +- .../server/0082-Phantoms-burn-in-light.patch | 18 +++++--- ...oggle-for-water-sensitive-mob-damage.patch | 46 +++++++++++++++++-- ...187-API-for-any-mob-to-burn-daylight.patch | 44 ++++++++++++------ .../0260-Configurable-phantom-size.patch | 4 +- 6 files changed, 94 insertions(+), 37 deletions(-) diff --git a/patches/server/0006-Ridables.patch b/patches/server/0006-Ridables.patch index 83f22dff6..79dfda19a 100644 --- a/patches/server/0006-Ridables.patch +++ b/patches/server/0006-Ridables.patch @@ -3694,7 +3694,7 @@ index 2ffe85ee5565bcae56b8a64567c34eeed71e4e4b..d111d6afb7c0937e48f7d212dec5f2d4 @Override 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 5c35b73c13c3826be9705e05154076810a78d147..60aab3964ebd180b52b57fba0705a63445a349bc 100644 +index 5c35b73c13c3826be9705e05154076810a78d147..28660b9e8ead72638fea3f9adf8cd95cbc820170 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -60,6 +60,64 @@ public class Phantom extends FlyingMob implements Enemy { @@ -3774,16 +3774,15 @@ index 5c35b73c13c3826be9705e05154076810a78d147..60aab3964ebd180b52b57fba0705a634 this.targetSelector.addGoal(1, new Phantom.PhantomAttackPlayerTargetGoal()); } -@@ -144,7 +204,7 @@ public class Phantom extends FlyingMob implements Enemy { - +@@ -145,6 +205,7 @@ public class Phantom extends FlyingMob implements Enemy { @Override public void aiStep() { -- if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning -+ if (this.isAlive() && (getRider() == null || !this.isControllable()) && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning // Purpur + if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning ++ if (getRider() == null || !this.isControllable()) // Purpur this.setSecondsOnFire(8); } -@@ -264,7 +324,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -264,7 +325,7 @@ public class Phantom extends FlyingMob implements Enemy { private AttackPhase() {} } @@ -3792,7 +3791,7 @@ index 5c35b73c13c3826be9705e05154076810a78d147..60aab3964ebd180b52b57fba0705a634 private float speed = 0.1F; -@@ -272,8 +332,19 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -272,8 +333,19 @@ public class Phantom extends FlyingMob implements Enemy { super(entity); } @@ -3813,7 +3812,7 @@ index 5c35b73c13c3826be9705e05154076810a78d147..60aab3964ebd180b52b57fba0705a634 if (Phantom.this.horizontalCollision) { Phantom.this.setYRot(Phantom.this.getYRot() + 180.0F); this.speed = 0.1F; -@@ -319,14 +390,20 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -319,14 +391,20 @@ public class Phantom extends FlyingMob implements Enemy { } } diff --git a/patches/server/0073-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch b/patches/server/0073-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch index d86cfdd3e..8078c875a 100644 --- a/patches/server/0073-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch +++ b/patches/server/0073-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch @@ -73,7 +73,7 @@ index d8c4f36ae0e65c6d0398fac80c93b78646bdf6a4..f8863cabad1bd0c3c2c62b8e17612d95 @Override protected void addAdditionalSaveData(CompoundTag nbt) { 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 c6fc7042386c98debf9b6e4614aca99d391d7e38..7361634f6eb65be5f04c00686be30e3e12d1bc0e 100644 +index f4c14777f912451e4316c0a3b5006fad83b0b98d..843c5bdc58a09aadab8d90f254e61a5cebe6388f 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -49,6 +49,7 @@ public class Phantom extends FlyingMob implements Enemy { @@ -132,7 +132,7 @@ index c6fc7042386c98debf9b6e4614aca99d391d7e38..7361634f6eb65be5f04c00686be30e3e this.targetSelector.addGoal(1, new Phantom.PhantomAttackPlayerTargetGoal()); } -@@ -342,6 +367,124 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -343,6 +368,124 @@ public class Phantom extends FlyingMob implements Enemy { private AttackPhase() {} } diff --git a/patches/server/0082-Phantoms-burn-in-light.patch b/patches/server/0082-Phantoms-burn-in-light.patch index 00c974515..cb283a1d1 100644 --- a/patches/server/0082-Phantoms-burn-in-light.patch +++ b/patches/server/0082-Phantoms-burn-in-light.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Phantoms burn in light 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 7361634f6eb65be5f04c00686be30e3e12d1bc0e..20ff9c65f89635a4b91d334775b3ac380b5ccbac 100644 +index 843c5bdc58a09aadab8d90f254e61a5cebe6388f..7e13097bb30578a9d083197dce06eecade4febf3 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -50,6 +50,7 @@ public class Phantom extends FlyingMob implements Enemy { @@ -16,16 +16,22 @@ index 7361634f6eb65be5f04c00686be30e3e12d1bc0e..20ff9c65f89635a4b91d334775b3ac38 public Phantom(EntityType type, Level world) { super(type, world); -@@ -247,7 +248,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -247,8 +248,12 @@ public class Phantom extends FlyingMob implements Enemy { @Override public void aiStep() { -- if (this.isAlive() && (getRider() == null || !this.isControllable()) && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning // Purpur -+ if (this.isAlive() && (getRider() == null || !this.isControllable()) && (((shouldBurnInDay && level.purpurConfig.phantomBurnInDaylight) && this.isSunBurnTick()) || (level.purpurConfig.phantomBurnInLight > 0 && level.getMaxLocalRawBrightness(blockPosition()) >= level.purpurConfig.phantomBurnInLight))) { // Paper - Configurable Burning // Purpur +- if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning +- if (getRider() == null || !this.isControllable()) // Purpur ++ // Purpur start ++ boolean burnFromDaylight = this.shouldBurnInDay && this.level.purpurConfig.phantomBurnInDaylight && this.isSunBurnTick(); ++ boolean burnFromLightSource = this.level.purpurConfig.phantomBurnInLight > 0 && this.level.getMaxLocalRawBrightness(blockPosition()) >= this.level.purpurConfig.phantomBurnInLight; ++ if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - Configurable Burning ++ if (getRider() == null || !this.isControllable()) ++ // Purpur end this.setSecondsOnFire(8); } -@@ -651,6 +652,12 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -652,6 +657,12 @@ public class Phantom extends FlyingMob implements Enemy { return false; } else if (!entityliving.isAlive()) { return false; @@ -38,7 +44,7 @@ index 7361634f6eb65be5f04c00686be30e3e12d1bc0e..20ff9c65f89635a4b91d334775b3ac38 } else { if (entityliving instanceof Player) { Player entityhuman = (Player) entityliving; -@@ -796,6 +803,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -797,6 +808,7 @@ public class Phantom extends FlyingMob implements Enemy { this.nextScanTick = reducedTickDelay(60); List list = Phantom.this.level.getNearbyPlayers(this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D)); diff --git a/patches/server/0138-Toggle-for-water-sensitive-mob-damage.patch b/patches/server/0138-Toggle-for-water-sensitive-mob-damage.patch index 5933dcfbb..6e09617b6 100644 --- a/patches/server/0138-Toggle-for-water-sensitive-mob-damage.patch +++ b/patches/server/0138-Toggle-for-water-sensitive-mob-damage.patch @@ -37,9 +37,18 @@ index 1fbe37705556e62752be4719994e1cde96f3434d..f6b289cea5962ef56e5c9daa1122989b @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index a7dce3d3a0266bacd1883bfe8b47af79defcd95b..0c0c900d07d2869baa5fdd669ceecf4ad3477807 100644 +index a7dce3d3a0266bacd1883bfe8b47af79defcd95b..8501fd8a512182c7e58894576b54ce16408825a6 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java +@@ -177,7 +177,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + // Paper end + this.lookControl = new Bee.BeeLookControl(this); + this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, -1.0F); +- this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); ++ if (isSensitiveToWater()) this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); // Purpur + this.setPathfindingMalus(BlockPathTypes.WATER_BORDER, 16.0F); + this.setPathfindingMalus(BlockPathTypes.COCOA, -1.0F); + this.setPathfindingMalus(BlockPathTypes.FENCE, -1.0F); @@ -225,6 +225,11 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { public int getPurpurBreedTime() { return this.level.purpurConfig.beeBreedingTicks; @@ -578,9 +587,18 @@ index 99b901f1ee202213dae3ab1930342920bbfe3d7a..93a431247b28bcb8cc974f2dfafe1dab @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/Blaze.java b/src/main/java/net/minecraft/world/entity/monster/Blaze.java -index 1fc653194718eb4698450af5d1865a6da090c76d..8cebcc68839a510fee3ff085e9308f6d351f51e8 100644 +index 1fc653194718eb4698450af5d1865a6da090c76d..081f9ff6edf17a1588649cc69f48b2f577ce809f 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Blaze.java +++ b/src/main/java/net/minecraft/world/entity/monster/Blaze.java +@@ -33,7 +33,7 @@ public class Blaze extends Monster { + public Blaze(EntityType type, Level world) { + super(type, world); + this.moveControl = new org.purpurmc.purpur.controller.FlyingWithSpacebarMoveControllerWASD(this, 0.3F); // Purpur +- this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); ++ if (isSensitiveToWater()) this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); // Purpur + this.setPathfindingMalus(BlockPathTypes.LAVA, 8.0F); + this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, 0.0F); + this.setPathfindingMalus(BlockPathTypes.DAMAGE_FIRE, 0.0F); @@ -143,7 +143,7 @@ public class Blaze extends Monster { @Override @@ -655,9 +673,18 @@ index 25fab7497a80a8fa65bd9cd9bdb0cd498f240bd1..2800594fea055d75268531d8ad3fef99 public static AttributeSupplier.Builder createAttributes() { diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index 8f8a5db7231c1ec69ac8b94b16447321fc89618a..a02e04ed34de9d87066b202cf747f927b55cfb76 100644 +index 8f8a5db7231c1ec69ac8b94b16447321fc89618a..eb0c73cb96e94079ac010c8ae4999206ad988cdf 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +@@ -85,7 +85,7 @@ public class EnderMan extends Monster implements NeutralMob { + public EnderMan(EntityType type, Level world) { + super(type, world); + this.maxUpStep = 1.0F; +- this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); ++ if (isSensitiveToWater()) this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); // Purpur + } + + // Purpur start @@ -298,7 +298,7 @@ public class EnderMan extends Monster implements NeutralMob { @Override @@ -796,7 +823,7 @@ index d4ce48a99fad5e9a26f8e057d91c712b8d8623b0..d5039d0a5e8a35cb7ce43792c909b21d public static AttributeSupplier.Builder createAttributes() { 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 c01820307fa6d476402632d44b65ada164a5aded..18b0a62a7ae7cf2413c319f402672ef2a6ee415f 100644 +index 5d9e6945ebdda73a77f048dfb91bfeb561e0eb5f..3122f7b826605f171bc1c88de89b358bd2e7118c 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -151,6 +151,11 @@ public class Phantom extends FlyingMob implements Enemy { @@ -940,9 +967,18 @@ index b54368f53d3cf87f35132f811f8a917999968c1e..4888502f99e0a9db246f9714a4d75348 public static boolean checkStraySpawnRules(EntityType type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) { diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java -index cfa355d99d5f8aaefe4cf0c10805ef7b51a0224a..ead0c2c900fbfabef478b200e954d7388860249d 100644 +index cfa355d99d5f8aaefe4cf0c10805ef7b51a0224a..a58800a7b06f662c7b3fc876ae78fb2880d3ddbc 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Strider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java +@@ -91,7 +91,7 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { + super(type, world); + this.steering = new ItemBasedSteering(this.entityData, Strider.DATA_BOOST_TIME, Strider.DATA_SADDLE_ID); + this.blocksBuilding = true; +- this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); ++ if (isSensitiveToWater()) this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); // Purpur + this.setPathfindingMalus(BlockPathTypes.LAVA, 0.0F); + this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, 0.0F); + this.setPathfindingMalus(BlockPathTypes.DAMAGE_FIRE, 0.0F); @@ -413,7 +413,7 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { @Override diff --git a/patches/server/0187-API-for-any-mob-to-burn-daylight.patch b/patches/server/0187-API-for-any-mob-to-burn-daylight.patch index 550302624..131c45eb1 100644 --- a/patches/server/0187-API-for-any-mob-to-burn-daylight.patch +++ b/patches/server/0187-API-for-any-mob-to-burn-daylight.patch @@ -209,7 +209,7 @@ index 065005c13c2bff341402fc962d19148da27bc3c2..e394b6427329f48a85a277eeb8336b12 @Override 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 18b0a62a7ae7cf2413c319f402672ef2a6ee415f..2ae234b2e3f7949fe852d341a5feca9a6738075a 100644 +index 3122f7b826605f171bc1c88de89b358bd2e7118c..0c55953301d1d48f93dda432c22ac2798d1c3c2e 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -60,6 +60,7 @@ public class Phantom extends FlyingMob implements Enemy { @@ -220,25 +220,33 @@ index 18b0a62a7ae7cf2413c319f402672ef2a6ee415f..2ae234b2e3f7949fe852d341a5feca9a } // Purpur start -@@ -254,7 +255,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -254,15 +255,7 @@ public class Phantom extends FlyingMob implements Enemy { @Override public void aiStep() { -- if (this.isAlive() && (getRider() == null || !this.isControllable()) && (((shouldBurnInDay && level.purpurConfig.phantomBurnInDaylight) && this.isSunBurnTick()) || (level.purpurConfig.phantomBurnInLight > 0 && level.getMaxLocalRawBrightness(blockPosition()) >= level.purpurConfig.phantomBurnInLight))) { // Paper - Configurable Burning // Purpur -+ if (this.isAlive() && (getRider() == null || !this.isControllable()) && (((shouldBurnInDay() && level.purpurConfig.phantomBurnInDaylight) && this.isSunBurnTick()) || (level.purpurConfig.phantomBurnInLight > 0 && level.getMaxLocalRawBrightness(blockPosition()) >= level.purpurConfig.phantomBurnInLight))) { // Paper - Configurable Burning // Purpur - this.setSecondsOnFire(8); - } +- // Purpur start +- boolean burnFromDaylight = this.shouldBurnInDay && this.level.purpurConfig.phantomBurnInDaylight && this.isSunBurnTick(); +- boolean burnFromLightSource = this.level.purpurConfig.phantomBurnInLight > 0 && this.level.getMaxLocalRawBrightness(blockPosition()) >= this.level.purpurConfig.phantomBurnInLight; +- if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - Configurable Burning +- if (getRider() == null || !this.isControllable()) +- // Purpur end +- this.setSecondsOnFire(8); +- } +- ++ // Purpur - moved down to shouldBurnInDay() + super.aiStep(); + } -@@ -286,7 +287,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -290,7 +283,7 @@ 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"); -+ // this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Purpur - implemented in LivingEntity +- if (nbt.contains("Paper.ShouldBurnInDay")) { ++ if (false && nbt.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity + this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); } // Paper end - } -@@ -302,7 +303,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -307,7 +300,7 @@ public class Phantom extends FlyingMob implements Enemy { if (this.spawningEntity != null) { nbt.putUUID("Paper.SpawningEntity", this.spawningEntity); } @@ -247,15 +255,23 @@ index 18b0a62a7ae7cf2413c319f402672ef2a6ee415f..2ae234b2e3f7949fe852d341a5feca9a // Paper end } -@@ -363,7 +364,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -368,8 +361,14 @@ public class Phantom extends FlyingMob implements Enemy { } public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; } - private boolean shouldBurnInDay = true; +- public boolean shouldBurnInDay() { return shouldBurnInDay; } + // private boolean shouldBurnInDay = true; // Purpur - moved to LivingEntity - keep methods for ABI compatibility - public boolean shouldBurnInDay() { return shouldBurnInDay; } ++ // Purpur start ++ public boolean shouldBurnInDay() { ++ boolean burnFromDaylight = this.shouldBurnInDay && this.level.purpurConfig.phantomBurnInDaylight && this.isSunBurnTick(); ++ boolean burnFromLightSource = this.level.purpurConfig.phantomBurnInLight > 0 && this.level.getMaxLocalRawBrightness(blockPosition()) >= this.level.purpurConfig.phantomBurnInLight; ++ return burnFromDaylight || burnFromLightSource; ++ } ++ // Purpur End public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Paper end + private static enum AttackPhase { diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java index 4b288fe8923bb4beefb88e8196bfb4d5d2b10b8b..e4e357af439c9a02b8013ce3349ff582495ee80e 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java diff --git a/patches/server/0260-Configurable-phantom-size.patch b/patches/server/0260-Configurable-phantom-size.patch index 617e0bec2..689127f87 100644 --- a/patches/server/0260-Configurable-phantom-size.patch +++ b/patches/server/0260-Configurable-phantom-size.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable phantom size 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 9d83b50d43edc7bfd857daab7be90558d86ca334..c12fbc6a8ba9fd6807a5d43c49881ea4e5c016e1 100644 +index 3b14a9b0ae1d0dc918552c91cb8f82db7ac00cbf..32ba17f4098382cc8d8d278378ca00211209b8ae 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -@@ -275,7 +275,11 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -272,7 +272,11 @@ public class Phantom extends FlyingMob implements Enemy { @Override public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) { this.anchorPoint = this.blockPosition().above(5);