testserver/Spigot-Server-Patches/0020-Player-affects-spawnin...

74 lines
3.3 KiB
Diff
Raw Normal View History

From d3732c933f94b0e8ce9b4e46a381652c73e38ef9 Mon Sep 17 00:00:00 2001
2016-11-17 02:23:38 +00:00
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Tue, 1 Mar 2016 14:47:52 -0600
Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 242129ae42..26adb55409 100644
2016-11-17 02:23:38 +00:00
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
2019-07-20 04:01:24 +00:00
@@ -71,6 +71,9 @@ public abstract class EntityHuman extends EntityLiving {
2019-12-11 00:56:03 +00:00
private final ItemCooldown bW;
2016-11-17 02:23:38 +00:00
@Nullable
public EntityFishingHook hookedFish;
+ // Paper start
+ public boolean affectsSpawning = true;
+ // Paper end
2016-11-17 02:23:38 +00:00
// CraftBukkit start
public boolean fauxSleeping;
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 23995b68a1..1732c1ae95 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -627,7 +627,7 @@ public abstract class EntityInsentient extends EntityLiving {
2019-12-11 00:56:03 +00:00
} else if (!this.isPersistent() && !this.I()) {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
2016-11-17 02:23:38 +00:00
- if (entityhuman != null) {
+ if (entityhuman != null && entityhuman.affectsSpawning) { // Paper - Affects Spawning API
2019-04-24 01:00:24 +00:00
double d0 = entityhuman.h(this);
if (d0 > world.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
index 102b3a3c48..08c2a22f7a 100644
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
2019-07-20 04:01:24 +00:00
@@ -99,7 +99,7 @@ public class EntitySilverfish extends EntityMonster {
if (d(entitytypes, generatoraccess, enummobspawn, blockposition, random)) {
2019-07-20 04:01:24 +00:00
EntityHuman entityhuman = generatoraccess.a((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0D, true);
- return entityhuman == null;
+ return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API
} else {
return false;
2016-11-17 02:23:38 +00:00
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 35dbed40df..f7a4fdb833 100644
2016-11-17 02:23:38 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1661,7 +1661,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2017-05-28 04:25:17 +00:00
@Override
public String getLocale() {
return getHandle().locale;
+
+ }
+
+ // Paper start
2016-11-17 02:23:38 +00:00
+ public void setAffectsSpawning(boolean affects) {
+ this.getHandle().affectsSpawning = affects;
+ }
+
+ @Override
+ public boolean getAffectsSpawning() {
+ return this.getHandle().affectsSpawning;
2017-05-28 04:25:17 +00:00
}
+ // Paper end
2017-05-28 04:25:17 +00:00
@Override
public void updateCommands() {
2016-11-17 02:23:38 +00:00
--
2.25.1
2016-11-17 02:23:38 +00:00