Paper/Spigot-Server-Patches/0018-Player-affects-spawning-API.patch

74 lines
3.1 KiB
Diff
Raw Normal View History

From 72c98e1673f146a01c9e8ea3ca44cbd2e55e4a8c Mon Sep 17 00:00:00 2001
2016-11-17 03:23:38 +01: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 e0edea22f..51dcb5ff0 100644
2016-11-17 03:23:38 +01:00
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
2019-04-24 03:00:24 +02:00
@@ -70,6 +70,9 @@ public abstract class EntityHuman extends EntityLiving {
private final ItemCooldown bY;
2016-11-17 03:23:38 +01:00
@Nullable
public EntityFishingHook hookedFish;
+ // Paper start
+ public boolean affectsSpawning = true;
+ // Paper end
2016-11-17 03:23:38 +01: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 e9203479a..00b51d88b 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -609,7 +609,7 @@ public abstract class EntityInsentient extends EntityLiving {
2019-04-24 03:00:24 +02:00
if (!this.isPersistent() && !this.I()) {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
2016-11-17 03:23:38 +01:00
- if (entityhuman != null) {
+ if (entityhuman != null && entityhuman.affectsSpawning) { // Paper - Affects Spawning API
2019-04-24 03:00:24 +02: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 dbbc34d91..d823c6b6d 100644
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
2019-04-24 03:00:24 +02:00
@@ -106,7 +106,7 @@ public class EntitySilverfish extends EntityMonster {
if (super.a(generatoraccess, enummobspawn)) {
EntityHuman entityhuman = this.world.a(EntitySilverfish.b, (EntityLiving) this);
- return entityhuman == null;
+ return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API
} else {
return false;
2016-11-17 03:23:38 +01:00
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 8980de820..6085f293d 100644
2016-11-17 03:23:38 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2019-05-06 04:58:04 +02:00
@@ -1641,7 +1641,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2017-05-28 06:25:17 +02:00
@Override
public String getLocale() {
return getHandle().locale;
+
+ }
+
+ // Paper start
2016-11-17 03:23:38 +01:00
+ public void setAffectsSpawning(boolean affects) {
+ this.getHandle().affectsSpawning = affects;
+ }
+
+ @Override
+ public boolean getAffectsSpawning() {
+ return this.getHandle().affectsSpawning;
2017-05-28 06:25:17 +02:00
}
+ // Paper end
2017-05-28 06:25:17 +02:00
@Override
public void updateCommands() {
2016-11-17 03:23:38 +01:00
--
2.21.0
2016-11-17 03:23:38 +01:00