geforkt von Mirrors/Paper
71 Zeilen
3.5 KiB
Diff
71 Zeilen
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 1228b73bd433c59b0b1503f3be270a9af6aadaa5..1f20fbbf92c9d2937594c924837fff0bb9ee9238 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 23995b68a17b87b90962c4c12aa37e3a254073b5..1732c1ae9537957c51da5e484b55febb6e9f0091 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 102b3a3c48799e44de760da48425fef9c5278771..08c2a22f7a01df21532e1949ea9d51f78a611cee 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 ba6a924a9c33ac02d3ef877e142f1e21abd10cb2..e40a379905c836ef3828400470e9f57938e9a99e 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() {
|