mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
50 lines
3.3 KiB
Diff
50 lines
3.3 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 6c41a2cc9a772c216abfc2b241429ec712119bb4..eaa5f2db1bc6b01ef6a508cc5a60ff1e252c2360 100644
|
|
--- a/net/minecraft/world/entity/monster/Phantom.java
|
|
+++ b/net/minecraft/world/entity/monster/Phantom.java
|
|
@@ -54,6 +54,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
public java.util.UUID spawningEntity;
|
|
public boolean shouldBurnInDay = true;
|
|
+ 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> entityType, Level level) {
|
|
super(entityType, level);
|
|
@@ -254,7 +255,11 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
|
|
@Override
|
|
public void aiStep() {
|
|
+ // 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;
|
|
+ // Purpur end - Phantoms burn in light
|
|
if (getRider() == null || !this.isControllable()) // Purpur - Ridables
|
|
this.igniteForSeconds(8.0F);
|
|
}
|
|
@@ -363,6 +368,7 @@ public class Phantom extends FlyingMob 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());
|
|
|
|
@@ -732,6 +738,12 @@ public class Phantom extends FlyingMob 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()) {
|