From fe2a4b3a0eb87faf8512700171147012ded647c5 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 4735f6e673..1a41a9c1d9 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 a2247fa1dd..4fa345db65 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -610,7 +610,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 e66cdc49ca..2979cc8b66 100644 --- a/src/main/java/net/minecraft/server/EntitySilverfish.java +++ b/src/main/java/net/minecraft/server/EntitySilverfish.java @@ -100,7 +100,7 @@ public class EntitySilverfish extends EntityMonster { if (d(entitytypes, generatoraccess, enummobspawn, blockposition, random)) { EntityHuman entityhuman = generatoraccess.a(EntitySilverfish.b, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D); - 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 c6daf693c5..00d6fc4b32 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1651,7 +1651,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.22.0