|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: draycia <lonelyyordle@gmail.com> |
| 3 | +Date: Sun, 12 Apr 2020 20:41:59 -0700 |
| 4 | +Subject: [PATCH] Phantoms burn in light |
| 5 | + |
| 6 | + |
| 7 | +diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java |
| 8 | +index 438f09ef7b116352de1c75a04b42b6096bed8d87..e18301d69c60dbe8072dcf061beafd57e893da11 100644 |
| 9 | +--- a/net/minecraft/world/entity/monster/Phantom.java |
| 10 | ++++ b/net/minecraft/world/entity/monster/Phantom.java |
| 11 | +@@ -53,6 +53,7 @@ public class Phantom extends FlyingMob implements Enemy { |
| 12 | + public java.util.UUID spawningEntity; |
| 13 | + public boolean shouldBurnInDay = true; |
| 14 | + // Paper end |
| 15 | ++ 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 |
| 16 | + |
| 17 | + public Phantom(EntityType<? extends Phantom> entityType, Level level) { |
| 18 | + super(entityType, level); |
| 19 | +@@ -253,7 +254,11 @@ public class Phantom extends FlyingMob implements Enemy { |
| 20 | + |
| 21 | + @Override |
| 22 | + public void aiStep() { |
| 23 | +- if (this.isAlive() && this.shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API |
| 24 | ++ // Purpur start - Phantoms burn in light |
| 25 | ++ boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight; |
| 26 | ++ boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight; |
| 27 | ++ if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - shouldBurnInDay API |
| 28 | ++ // Purpur end - Phantoms burn in light |
| 29 | + if (getRider() == null || !this.isControllable()) // Purpur - Ridables |
| 30 | + this.igniteForSeconds(8.0F); |
| 31 | + } |
| 32 | +@@ -370,6 +375,7 @@ public class Phantom extends FlyingMob implements Enemy { |
| 33 | + List<Player> nearbyPlayers = serverLevel.getNearbyPlayers( |
| 34 | + this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0, 64.0, 16.0) |
| 35 | + ); |
| 36 | ++ if (level().purpurConfig.phantomIgnorePlayersWithTorch) nearbyPlayers.removeIf(human -> TORCH.test(human.getItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND)) || TORCH.test(human.getItemInHand(net.minecraft.world.InteractionHand.OFF_HAND))); // Purpur - Phantoms burn in light |
| 37 | + if (!nearbyPlayers.isEmpty()) { |
| 38 | + nearbyPlayers.sort(Comparator.<Player, Double>comparing(Entity::getY).reversed()); |
| 39 | + |
| 40 | +@@ -735,6 +741,12 @@ public class Phantom extends FlyingMob implements Enemy { |
| 41 | + return false; |
| 42 | + } else if (!target.isAlive()) { |
| 43 | + return false; |
| 44 | ++ // Purpur start - Phantoms burn in light |
| 45 | ++ } else if (level().purpurConfig.phantomBurnInLight > 0 && level().getLightEmission(new BlockPos(Phantom.this)) >= level().purpurConfig.phantomBurnInLight) { |
| 46 | ++ return false; |
| 47 | ++ } else if (level().purpurConfig.phantomIgnorePlayersWithTorch && (TORCH.test(target.getItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND)) || TORCH.test(target.getItemInHand(net.minecraft.world.InteractionHand.OFF_HAND)))) { |
| 48 | ++ return false; |
| 49 | ++ // Purpur end - Phantoms burn in light |
| 50 | + } else if (target instanceof Player player && (target.isSpectator() || player.isCreative())) { |
| 51 | + return false; |
| 52 | + } else if (!this.canUse()) { |
0 commit comments