From 02a1ec99a67ce0478e09e67f050ae89309517b33 Mon Sep 17 00:00:00 2001 From: Jedediah Smith 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 28791cca90..418e2fccdc 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -70,6 +70,9 @@ public abstract class EntityHuman extends EntityLiving { private final ItemCooldown bY; @Nullable public EntityFishingHook hookedFish; + // Paper start + public boolean affectsSpawning = true; + // Paper end // 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 d020414f98..0ecbf873bf 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 { if (!this.isPersistent() && !this.I()) { EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); - if (entityhuman != null) { + if (entityhuman != null && entityhuman.affectsSpawning) { // Paper - Affects Spawning API 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 dbbc34d91b..d823c6b6d9 100644 --- a/src/main/java/net/minecraft/server/EntitySilverfish.java +++ b/src/main/java/net/minecraft/server/EntitySilverfish.java @@ -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; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 037b0bc685..76728b1785 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1642,7 +1642,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { return getHandle().locale; + + } + + // Paper start + public void setAffectsSpawning(boolean affects) { + this.getHandle().affectsSpawning = affects; + } + + @Override + public boolean getAffectsSpawning() { + return this.getHandle().affectsSpawning; } + // Paper end @Override public void updateCommands() { -- 2.21.0