mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
Merge in Tuinity patches
This commit is contained in:
57
patches/server/0022-Phantoms-only-attack-insomniacs.patch
Normal file
57
patches/server/0022-Phantoms-only-attack-insomniacs.patch
Normal file
@@ -0,0 +1,57 @@
|
||||
From 1d5f101cc9db5a5e9a9d67499ec03bbe1f5fd783 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 c3a5e2461..6d2984c8d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
@@ -272,6 +272,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 a2d1ef360..e1fdee279 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 392936c34..5bb1b90b3 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -391,12 +391,14 @@ public class PurpurWorldConfig {
|
||||
public boolean phantomRequireShiftToMount = true;
|
||||
public double phantomMaxY = 256D;
|
||||
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);
|
||||
phantomRequireShiftToMount = getBoolean("mobs.phantom.require-shift-to-mount", phantomRequireShiftToMount);
|
||||
phantomMaxY = getDouble("mobs.phantom.ridable-max-y", phantomMaxY);
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user