mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
59 lines
3.4 KiB
Diff
59 lines
3.4 KiB
Diff
From 8c7730ed54e2578797421ec8818d507e7f353bb8 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Fri, 29 Nov 2019 20:33:41 -0600
|
|
Subject: [PATCH] Phantoms only attack insomniacs
|
|
|
|
---
|
|
src/main/java/net/minecraft/server/EntityPhantom.java | 1 +
|
|
src/main/java/net/minecraft/server/IEntitySelector.java | 1 +
|
|
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
|
|
3 files changed, 4 insertions(+)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
index c392085d0b..9d331f9ad6 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
@@ -296,6 +296,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
|
|
|
if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.a)) {
|
|
+ if (!world.purpurConfig.phantomOnlyAttackInsomniacs || IEntitySelector.isInsomniac.test(entityhuman)) // Purpur
|
|
EntityPhantom.this.setGoalTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason
|
|
return true;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
|
index a2d1ef3602..e1fdee2794 100644
|
|
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
|
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
|
@@ -23,6 +23,7 @@ public final class IEntitySelector {
|
|
public static final Predicate<Entity> f = (entity) -> {
|
|
return !entity.isSpectator();
|
|
};
|
|
+ public static Predicate<EntityHuman> isInsomniac = (player) -> MathHelper.clamp(((EntityPlayer) player).getStatisticManager().getStatisticValue(StatisticList.CUSTOM.b(StatisticList.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Purpur
|
|
|
|
public static Predicate<Entity> a(double d0, double d1, double d2, double d3) {
|
|
double d4 = d3 * d3;
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 451cc18b9a..12cd819635 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -403,6 +403,7 @@ public class PurpurWorldConfig {
|
|
public float phantomFlameDamage = 1.0F;
|
|
public int phantomFlameFireTime = 8;
|
|
public boolean phantomIgnoreCreative = false;
|
|
+ public boolean phantomOnlyAttackInsomniacs = false;
|
|
private void phantomSettings() {
|
|
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
|
|
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
|
|
@@ -411,6 +412,7 @@ public class PurpurWorldConfig {
|
|
phantomFlameDamage = (float) getDouble("mobs.phantom.flames.damage", phantomFlameDamage);
|
|
phantomFlameFireTime = getInt("mobs.phantom.flames.fire-time", phantomFlameFireTime);
|
|
phantomIgnoreCreative = getBoolean("mobs.phantom.do-not-spawn-on-creative-players", phantomIgnoreCreative);
|
|
+ phantomOnlyAttackInsomniacs = getBoolean("mobs.phantom.only-attack-insomniacs", phantomOnlyAttackInsomniacs);
|
|
}
|
|
|
|
public boolean pigRidable = false;
|
|
--
|
|
2.24.0
|
|
|