Files
Purpur/patches/server/0093-Phantoms-burn-in-light.patch
jmp c7b279fe1b Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
05af2837c [CI-SKIP] Improved the annotation test output
586966949 abstract custom set tags, add entity tags
c7667378e Added PlayerLoomPatternSelectEvent
00972e80d Reimplement GS4QueryEvent
544c5c278 Re-add coral block tags (#4987)
7d56c8deb Added PlayerLecternPageChangeEvent
c7cdf255b Add BlockFailedDispenseEvent
c8a8d6fbe Added world settings for mobs picking up loot
91eda5bd3 Added ServerResourcesReloadedEvent
be81b4f5c Add a Enchantable MaterialTag
975d18703 Add doors to material tags
d075e748e colorful itemdump
f3ba3dee0 Added WorldGameRuleChangeEvent
086d20118 Guardian beam workaround
b63c890ec Support spawning item stacks
d7d74c552 added height config for bamboo
7878e3bc2 Use setAmount for Recipe Amount
50e70697b Add EntityLoadCrossbowEvent
f344e092c Add Anti-Xray bypass permission
9fd31e675 fix for nerfed slime mobs splitting
4a7962cd1 Zombie API - breaking doors
5650a41f5 Fix interact event not being called in adventure
2c9ed4335 Add PlayerFlowerPotManipulateEvent
1f32290b6 [Auto] Updated Upstream (CraftBukkit)
d87694a20 Redact Velocity forwarding secret properly (#4980)
24a0b0206 [Auto] Updated Upstream (CraftBukkit)
7681042ef [Auto] Updated Upstream (Bukkit/CraftBukkit)
7dea3dba6 [Auto] Updated Upstream (CraftBukkit)
4b3792920 JavaDoc fixes
f13b4727e Allow disabling mob spawner spawn egg transformation
525b50737 Cache burn durations
2c37d1077 Optimized tick ready check
b4000b01a Add API to get the Material of Boats and Minecarts
f1317386d Fix sign lazy initialisation
9f61759d9 Updated Upstream (CraftBukkit/Spigot) (#4972)
aaff430b6 [CI-SKIP] Use GitHub Actions for build status
9f4055d99 Fix harming potion dupe
7bfb781ff Additional Block Material API's
0eaffd008 Micro Optimize DataBits

Tuinity Changes:
9e5cabb6e Port starlight changes
2021-01-04 15:21:27 -08:00

96 lines
6.9 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/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
index dfce36368da9bdd9285c490a802f7a0cc4a339f6..bdfe073dcd255a7359127f9ae3a962642be5526d 100644
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
@@ -13,6 +13,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
private BlockPosition d; public void setHome(BlockPosition home) { this.d = home; } public BlockPosition getHome() { return this.d; } // Purpur - OBFHELPER
private EntityPhantom.AttackPhase bo; public AttackPhase getAttackPhase() { return this.bo; } // Purpur - OBFHELPER
private Vec3D crystalPosition; // Purpur
+ private static final RecipeItemStack TORCH = RecipeItemStack.a(Items.torch(), Items.soulTorch()); // Purpur
public EntityPhantom(EntityTypes<? extends EntityPhantom> entitytypes, World world) {
super(entitytypes, world);
@@ -125,7 +126,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public void movementTick() {
- if (this.isAlive() && this.eG()) {
+ if (this.isAlive() && ((world.purpurConfig.phantomBurnInDaylight && this.isInDaylight()) || (world.purpurConfig.phantomBurnInLight > 0 && world.getLightLevel(new BlockPosition(this)) >= world.purpurConfig.phantomBurnInLight))) { // Purpur
this.setOnFire(8);
}
@@ -374,7 +375,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
} else {
this.c = 60;
List<EntityHuman> list = EntityPhantom.this.world.a(this.b, (EntityLiving) EntityPhantom.this, EntityPhantom.this.getBoundingBox().grow(16.0D, 64.0D, 16.0D));
-
+ if (world.purpurConfig.phantomIgnorePlayersWithTorch) list.removeIf(human -> TORCH.test(human.getItemInHand(EnumHand.MAIN_HAND)) || TORCH.test(human.getItemInHand(EnumHand.OFF_HAND)));// Purpur
if (!list.isEmpty()) {
list.sort(Comparator.comparing(Entity::locY).reversed());
Iterator iterator = list.iterator();
@@ -473,6 +474,12 @@ public class EntityPhantom extends EntityFlying implements IMonster {
return false;
} else if (entityliving instanceof EntityHuman && (((EntityHuman) entityliving).isSpectator() || ((EntityHuman) entityliving).isCreative())) {
return false;
+ // Purpur start
+ } else if (world.purpurConfig.phantomBurnInLight > 0 && world.getLightLevel(new BlockPosition(EntityPhantom.this)) >= world.purpurConfig.phantomBurnInLight) {
+ return false;
+ } else if (world.purpurConfig.phantomIgnorePlayersWithTorch && (TORCH.test(entityliving.getItemInHand(EnumHand.MAIN_HAND)) || TORCH.test(entityliving.getItemInHand(EnumHand.OFF_HAND)))) {
+ return false;
+ // Purpur end
} else if (!this.a()) {
return false;
} else {
diff --git a/src/main/java/net/minecraft/server/Items.java b/src/main/java/net/minecraft/server/Items.java
index 4c379916d8d7797038d2980761c49f44c010dea8..ea6b61c9b88f33d29f7266d7614c80372db31b72 100644
--- a/src/main/java/net/minecraft/server/Items.java
+++ b/src/main/java/net/minecraft/server/Items.java
@@ -173,7 +173,7 @@ public class Items {
public static final Item cm = a(Blocks.BOOKSHELF, CreativeModeTab.b);
public static final Item cn = a(Blocks.MOSSY_COBBLESTONE, CreativeModeTab.b);
public static final Item co = a(Blocks.OBSIDIAN, CreativeModeTab.b);
- public static final Item cp = a((ItemBlock) (new ItemBlockWallable(Blocks.TORCH, Blocks.WALL_TORCH, (new Item.Info()).a(CreativeModeTab.c))));
+ public static final Item cp = a((ItemBlock) (new ItemBlockWallable(Blocks.TORCH, Blocks.WALL_TORCH, (new Item.Info()).a(CreativeModeTab.c)))); public static final Item torch() { return cp; } // Purpur - OBFHELPER
public static final Item cq = a(Blocks.END_ROD, CreativeModeTab.c);
public static final Item cr = a(Blocks.CHORUS_PLANT, CreativeModeTab.c);
public static final Item cs = a(Blocks.CHORUS_FLOWER, CreativeModeTab.c);
@@ -225,7 +225,7 @@ public class Items {
public static final Item dm = a(Blocks.SOUL_SOIL, CreativeModeTab.b);
public static final Item dn = a(Blocks.BASALT, CreativeModeTab.b);
public static final Item do_ = a(Blocks.cP, CreativeModeTab.b);
- public static final Item dp = a((ItemBlock) (new ItemBlockWallable(Blocks.SOUL_TORCH, Blocks.SOUL_WALL_TORCH, (new Item.Info()).a(CreativeModeTab.c))));
+ public static final Item dp = a((ItemBlock) (new ItemBlockWallable(Blocks.SOUL_TORCH, Blocks.SOUL_WALL_TORCH, (new Item.Info()).a(CreativeModeTab.c)))); public static final Item soulTorch() { return dp; } // Purpur - OBFHELPER
public static final Item dq = a(Blocks.GLOWSTONE, CreativeModeTab.b);
public static final Item dr = a(Blocks.JACK_O_LANTERN, CreativeModeTab.b);
public static final Item ds = a(Blocks.OAK_TRAPDOOR, CreativeModeTab.d);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index c66aa809024cc351d68693c899f7741516555f4e..3ce43e93f07cf728c9b0cf6f717d9ec7342bcb9e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -392,6 +392,9 @@ public class PurpurWorldConfig {
public int phantomSpawnOverheadRadius = 10;
public int phantomSpawnMinPerAttempt = 1;
public int phantomSpawnMaxPerAttempt = -1;
+ public int phantomBurnInLight = 0;
+ public boolean phantomIgnorePlayersWithTorch = false;
+ public boolean phantomBurnInDaylight = true;
private void phantomSettings() {
phantomAttackedByCrystalRadius = getDouble("mobs.phantom.attacked-by-crystal-range", phantomAttackedByCrystalRadius);
phantomAttackedByCrystalDamage = (float) getDouble("mobs.phantom.attacked-by-crystal-damage", phantomAttackedByCrystalDamage);
@@ -408,6 +411,9 @@ public class PurpurWorldConfig {
phantomSpawnOverheadRadius = getInt("mobs.phantom.spawn.overhead.radius", phantomSpawnOverheadRadius);
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 pigGiveSaddleBack = false;