Files
Purpur/patches/server/0075-Phantoms-burn-in-light.patch
granny 236b06a2a3 Updated Upstream (Paper & Pufferfish)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@5e73c55 [ci skip] Add more identifying patch comments
PaperMC/Paper@3e20d3a [ci skip] Add more identifying patch comments
PaperMC/Paper@f61ebdc Fix issue with kick event causes being passed improperly
PaperMC/Paper@106c67a [ci skip] Add more identifying patch comments
PaperMC/Paper@cc693ce [ci skip] Add more identifying patch comments, merge related patches
PaperMC/Paper@eeb6afc [ci skip] Add more identifying patch comments, merge related patches
PaperMC/Paper@1c956ab [ci skip] Add more identifying patch comments, merge related patches
PaperMC/Paper@42e88a8 [ci skip] Add more identifying patch comments
PaperMC/Paper@8e41ef4 Add visual blockdata api for primed tnt (#10146)
PaperMC/Paper@68c3297 [ci skip] Add more identifying patch comments
PaperMC/Paper@4a98986 Add back Reduce allocation of Vec3D by entity tracker patch (#10179)
PaperMC/Paper@b48d737 Async world data IO saving (#10171)
PaperMC/Paper@8d94596 [ci skip] Add more identifying patch comments
PaperMC/Paper@f7dd304 [ci skip] Add more identifying patch comments
PaperMC/Paper@98e6d20 [ci skip] Add more identifying patch comments
PaperMC/Paper@e9e0bc1 [ci skip] Add more identifying patch comments
PaperMC/Paper@d9df6bc [ci skip] Add more patch identifying comments, cleanup
PaperMC/Paper@27cabc1 [ci skip] Add more patch identifying comments

Pufferfish Changes:
pufferfish-gg/Pufferfish@8e208d3 Fix Async World Saving attribution
2024-01-21 20:50:22 -08:00

78 lines
5.2 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/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 4153b621c04168f1f78c526f31a46d9b1fecf3a7..fd9cb719c0380993a506bd803128cb2d7f0c37cb 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 {
Vec3 moveTargetPoint;
public BlockPos anchorPoint;
Phantom.AttackPhase attackPhase;
+ 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
Vec3 crystalPosition; // Purpur
public Phantom(EntityType<? extends Phantom> type, Level world) {
@@ -247,7 +248,12 @@ public class Phantom extends FlyingMob implements Enemy {
@Override
public void aiStep() {
- if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API
+ // Purpur start
+ boolean burnFromDaylight = this.shouldBurnInDay && 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
+ if (getRider() == null || !this.isControllable())
+ // Purpur end
if (getRider() == null || !this.isControllable()) // Purpur
this.setSecondsOnFire(8);
}
@@ -660,6 +666,12 @@ public class Phantom extends FlyingMob implements Enemy {
return false;
} else if (!entityliving.isAlive()) {
return false;
+ // Purpur start
+ } else if (level().purpurConfig.phantomBurnInLight > 0 && level().getLightEmission(new BlockPos(Phantom.this)) >= level().purpurConfig.phantomBurnInLight) {
+ return false;
+ } else if (level().purpurConfig.phantomIgnorePlayersWithTorch && (TORCH.test(entityliving.getItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND)) || TORCH.test(entityliving.getItemInHand(net.minecraft.world.InteractionHand.OFF_HAND)))) {
+ return false;
+ // Purpur end
} else {
if (entityliving instanceof Player) {
Player entityhuman = (Player) entityliving;
@@ -805,6 +817,7 @@ public class Phantom extends FlyingMob implements Enemy {
this.nextScanTick = reducedTickDelay(60);
List<Player> list = Phantom.this.level().getNearbyPlayers(this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
+ if (level().purpurConfig.phantomIgnorePlayersWithTorch) list.removeIf(human -> TORCH.test(human.getItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND)) || TORCH.test(human.getItemInHand(net.minecraft.world.InteractionHand.OFF_HAND)));// Purpur
if (!list.isEmpty()) {
list.sort(Comparator.comparing((Entity e) -> { return e.getY(); }).reversed()); // CraftBukkit - decompile error
Iterator iterator = list.iterator();
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index c87c7feb140864771cbef3dcee1f89319c9a1f83..a0477b47563214152483423121523f836827306b 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1123,6 +1123,9 @@ public class PurpurWorldConfig {
public double phantomSpawnLocalDifficultyChance = 3.0D;
public int phantomSpawnMinPerAttempt = 1;
public int phantomSpawnMaxPerAttempt = -1;
+ public int phantomBurnInLight = 0;
+ public boolean phantomIgnorePlayersWithTorch = false;
+ public boolean phantomBurnInDaylight = true;
private void phantomSettings() {
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
@@ -1153,6 +1156,9 @@ public class PurpurWorldConfig {
phantomSpawnLocalDifficultyChance = getDouble("mobs.phantom.spawn.local-difficulty-chance", phantomSpawnLocalDifficultyChance);
phantomSpawnMinPerAttempt = getInt("mobs.phantom.spawn.per-attempt.min", phantomSpawnMinPerAttempt);
phantomSpawnMaxPerAttempt = getInt("mobs.phantom.spawn.per-attempt.max", phantomSpawnMaxPerAttempt);
+ phantomBurnInLight = getInt("mobs.phantom.burn-in-light", phantomBurnInLight);
+ phantomBurnInDaylight = getBoolean("mobs.phantom.burn-in-daylight", phantomBurnInDaylight);
+ phantomIgnorePlayersWithTorch = getBoolean("mobs.phantom.ignore-players-with-torch", phantomIgnorePlayersWithTorch);
}
public boolean pigRidable = false;