2019-06-25 01:47:58 +00:00
|
|
|
From fe2a4b3a0eb87faf8512700171147012ded647c5 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
|
2019-06-25 01:47:58 +00:00
|
|
|
index 4735f6e673..1a41a9c1d9 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-04-24 01:00:24 +00:00
|
|
|
@@ -70,6 +70,9 @@ public abstract class EntityHuman extends EntityLiving {
|
|
|
|
private final ItemCooldown bY;
|
2016-11-17 02:23:38 +00:00
|
|
|
@Nullable
|
|
|
|
public EntityFishingHook hookedFish;
|
2018-07-15 01:53:17 +00:00
|
|
|
+ // Paper start
|
2016-11-19 00:55:14 +00:00
|
|
|
+ public boolean affectsSpawning = true;
|
2018-07-15 01:53:17 +00:00
|
|
|
+ // Paper end
|
2016-11-17 02:23:38 +00:00
|
|
|
|
|
|
|
// CraftBukkit start
|
|
|
|
public boolean fauxSleeping;
|
2016-11-19 00:55:14 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2019-06-25 01:47:58 +00:00
|
|
|
index a2247fa1dd..4fa345db65 100644
|
2016-11-19 00:55:14 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2019-06-25 01:47:58 +00:00
|
|
|
@@ -610,7 +610,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
2019-04-24 01:00:24 +00:00
|
|
|
if (!this.isPersistent() && !this.I()) {
|
2016-11-19 00:55:14 +00:00
|
|
|
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
2016-11-17 02:23:38 +00:00
|
|
|
|
2016-11-19 00:55:14 +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
|
2016-11-19 00:55:14 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
2019-06-25 01:47:58 +00:00
|
|
|
index e66cdc49ca..2979cc8b66 100644
|
2016-11-19 00:55:14 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
2019-06-25 01:47:58 +00:00
|
|
|
@@ -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);
|
2018-07-15 01:53:17 +00:00
|
|
|
|
2016-11-19 00:55:14 +00:00
|
|
|
- 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
|
2019-06-25 01:47:58 +00:00
|
|
|
index c6daf693c5..00d6fc4b32 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
|
2019-06-25 01:47:58 +00:00
|
|
|
@@ -1651,7 +1651,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2017-05-28 04:25:17 +00:00
|
|
|
@Override
|
|
|
|
public String getLocale() {
|
|
|
|
return getHandle().locale;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
2018-07-15 01:53:17 +00:00
|
|
|
+ // 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
|
|
|
}
|
2018-07-15 01:53:17 +00:00
|
|
|
+ // Paper end
|
2017-05-28 04:25:17 +00:00
|
|
|
|
2018-08-12 06:08:09 +00:00
|
|
|
@Override
|
|
|
|
public void updateCommands() {
|
2016-11-17 02:23:38 +00:00
|
|
|
--
|
2019-06-25 01:47:58 +00:00
|
|
|
2.22.0
|
2016-11-17 02:23:38 +00:00
|
|
|
|