mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 02:47:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@ffcb7b22 Update Parchment (#13177) PaperMC/Paper@c33a9ce1 Fix incorrect variable use in Entity#startRiding PaperMC/Paper@c710b667 Add MapPalette.getNearestColor (#13104) PaperMC/Paper@b57d6410 Expose isReplaceable on BlockData (#13180) PaperMC/Paper@af1823d4 Reduce impact of tick time calculations (#13188) PaperMC/Paper@89ca94ab [ci/skip] Rebuild patches PaperMC/Paper@e5cc2560 [ci/skip] Update CONTRIBUTING.md for Gradle and Windows Docs (#13190) PaperMC/Paper@ab99393c Fix charged creeper explosions not dropping mob skulls (#13167) PaperMC/Paper@81b7a578 Fixed Ender Dragon using wrong tracking range (#13046)
53 lines
3.5 KiB
Diff
53 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: draycia <lonelyyordle@gmail.com>
|
|
Date: Sun, 12 Apr 2020 20:41:59 -0700
|
|
Subject: [PATCH] Phantoms burn in light
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
|
|
index 81f7223d49eac01899c877ba7e47515c17269151..42089b34a1a1927247953b54cdc3300e1b600a90 100644
|
|
--- a/net/minecraft/world/entity/monster/Phantom.java
|
|
+++ b/net/minecraft/world/entity/monster/Phantom.java
|
|
@@ -55,6 +55,7 @@ public class Phantom extends Mob implements Enemy {
|
|
public java.util.UUID spawningEntity;
|
|
public boolean shouldBurnInDay = true;
|
|
// 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
|
|
|
|
public Phantom(EntityType<? extends Phantom> type, Level level) {
|
|
super(type, level);
|
|
@@ -238,7 +239,11 @@ public class Phantom extends Mob implements Enemy {
|
|
|
|
@Override
|
|
public void aiStep() {
|
|
- if (this.isAlive() && this.shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API
|
|
+ // Purpur start - Phantoms burn in light
|
|
+ boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
|
|
+ boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
|
|
+ if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - shouldBurnInDay API
|
|
+ // Purpur end - Phantoms burn in light
|
|
if (getRider() == null || !this.isControllable()) // Purpur - Ridables
|
|
this.igniteForSeconds(8.0F);
|
|
}
|
|
@@ -370,6 +375,7 @@ public class Phantom extends Mob implements Enemy {
|
|
List<Player> nearbyPlayers = serverLevel.getNearbyPlayers(
|
|
this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0, 64.0, 16.0)
|
|
);
|
|
+ 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
|
|
if (!nearbyPlayers.isEmpty()) {
|
|
nearbyPlayers.sort(Comparator.<Player, Double>comparing(Entity::getY).reversed());
|
|
|
|
@@ -740,6 +746,12 @@ public class Phantom extends Mob implements Enemy {
|
|
return false;
|
|
} else if (!target.isAlive()) {
|
|
return false;
|
|
+ // Purpur start - Phantoms burn in light
|
|
+ } else if (level().purpurConfig.phantomBurnInLight > 0 && level().getLightEmission(new BlockPos(Phantom.this)) >= level().purpurConfig.phantomBurnInLight) {
|
|
+ return false;
|
|
+ } 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)))) {
|
|
+ return false;
|
|
+ // Purpur end - Phantoms burn in light
|
|
} else if (target instanceof Player player && (target.isSpectator() || player.isCreative())) {
|
|
return false;
|
|
} else if (!this.canUse()) {
|