From 8ec886dde0916ea3b979b33030a9c11c152061f4 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 242129ae42..26adb55409 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -71,6 +71,9 @@ public abstract class EntityHuman extends EntityLiving { private final ItemCooldown bW; @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 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 { } else 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 102b3a3c48..08c2a22f7a 100644 --- a/src/main/java/net/minecraft/server/EntitySilverfish.java +++ b/src/main/java/net/minecraft/server/EntitySilverfish.java @@ -99,7 +99,7 @@ public class EntitySilverfish extends EntityMonster { if (d(entitytypes, generatoraccess, enummobspawn, blockposition, random)) { 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; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index d7a4e50f23..ae2c1b97ad 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1626,7 +1626,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.25.1