2019-12-11 01:56:03 +01:00
|
|
|
From 85be01721ad128b46f13a6b97181aae6b1555119 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
|
2019-12-11 01:56:03 +01:00
|
|
|
index ce6e4395d..761fe32ba 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-07-20 06:01:24 +02:00
|
|
|
@@ -71,6 +71,9 @@ public abstract class EntityHuman extends EntityLiving {
|
2019-12-11 01:56:03 +01:00
|
|
|
private final ItemCooldown bW;
|
2016-11-17 03:23:38 +01:00
|
|
|
@Nullable
|
|
|
|
public EntityFishingHook hookedFish;
|
2018-07-15 03:53:17 +02:00
|
|
|
+ // Paper start
|
2016-11-19 01:55:14 +01:00
|
|
|
+ public boolean affectsSpawning = true;
|
2018-07-15 03:53:17 +02:00
|
|
|
+ // Paper end
|
2016-11-17 03:23:38 +01:00
|
|
|
|
|
|
|
// CraftBukkit start
|
|
|
|
public boolean fauxSleeping;
|
2016-11-19 01:55:14 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2019-12-11 01:56:03 +01:00
|
|
|
index 6e84d6532..dac3540c6 100644
|
2016-11-19 01:55:14 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2019-12-11 01:56:03 +01:00
|
|
|
@@ -619,7 +619,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
|
|
} else if (!this.isPersistent() && !this.I()) {
|
2016-11-19 01:55:14 +01:00
|
|
|
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
2016-11-17 03:23:38 +01:00
|
|
|
|
2016-11-19 01:55:14 +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
|
2016-11-19 01:55:14 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
2019-12-11 01:56:03 +01:00
|
|
|
index 102b3a3c4..08c2a22f7 100644
|
2016-11-19 01:55:14 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
2019-07-20 06:01:24 +02:00
|
|
|
@@ -99,7 +99,7 @@ public class EntitySilverfish extends EntityMonster {
|
2019-06-25 03:47:58 +02:00
|
|
|
if (d(entitytypes, generatoraccess, enummobspawn, blockposition, random)) {
|
2019-07-20 06:01:24 +02:00
|
|
|
EntityHuman entityhuman = generatoraccess.a((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0D, true);
|
2018-07-15 03:53:17 +02:00
|
|
|
|
2016-11-19 01:55:14 +01:00
|
|
|
- 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
|
2019-12-11 01:56:03 +01:00
|
|
|
index b26dff0a7..cce3b25cd 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-12-11 01:56:03 +01:00
|
|
|
@@ -1635,7 +1635,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2017-05-28 06:25:17 +02:00
|
|
|
@Override
|
|
|
|
public String getLocale() {
|
|
|
|
return getHandle().locale;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
2018-07-15 03:53:17 +02:00
|
|
|
+ // 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
|
|
|
}
|
2018-07-15 03:53:17 +02:00
|
|
|
+ // Paper end
|
2017-05-28 06:25:17 +02:00
|
|
|
|
2018-08-12 08:08:09 +02:00
|
|
|
@Override
|
|
|
|
public void updateCommands() {
|
2016-11-17 03:23:38 +01:00
|
|
|
--
|
2019-12-11 01:56:03 +01:00
|
|
|
2.24.0
|
2016-11-17 03:23:38 +01:00
|
|
|
|