2018-12-08 10:09:55 +00:00
|
|
|
From 7d4ea3d0550820a18c9c4795eca59b6ee33a8997 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
|
2018-12-08 10:09:55 +00:00
|
|
|
index 7e151439c..0aae80a7f 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
|
2018-11-03 00:23:27 +00:00
|
|
|
@@ -71,6 +71,9 @@ public abstract class EntityHuman extends EntityLiving {
|
2018-07-15 01:53:17 +00:00
|
|
|
private final ItemCooldown ce;
|
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
|
2018-12-08 10:09:55 +00:00
|
|
|
index 8f4319c80..cf73a6d1f 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
|
2018-12-08 10:09:55 +00:00
|
|
|
@@ -619,7 +619,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
2016-11-19 00:55:14 +00:00
|
|
|
} else {
|
|
|
|
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
|
|
|
|
double d0 = entityhuman.locX - this.locX;
|
|
|
|
double d1 = entityhuman.locY - this.locY;
|
|
|
|
double d2 = entityhuman.locZ - this.locZ;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
2018-12-08 10:09:55 +00:00
|
|
|
index 850569f6b..f958bd5ba 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
|
2018-07-15 01:53:17 +00:00
|
|
|
@@ -96,7 +96,7 @@ public class EntitySilverfish extends EntityMonster {
|
2018-08-26 18:11:49 +00:00
|
|
|
if (super.a(generatoraccess, flag)) {
|
2018-07-15 01:53:17 +00:00
|
|
|
EntityHuman entityhuman = generatoraccess.b(this, 5.0D);
|
|
|
|
|
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/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
2018-12-08 10:09:55 +00:00
|
|
|
index afe039905..ff564508f 100644
|
2016-11-17 02:23:38 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
2018-07-15 01:53:17 +00:00
|
|
|
@@ -37,7 +37,7 @@ public final class SpawnerCreature {
|
2016-11-17 02:23:38 +00:00
|
|
|
while (iterator.hasNext()) {
|
|
|
|
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
|
|
|
|
|
|
|
- if (!entityhuman.isSpectator()) {
|
2018-07-15 01:53:17 +00:00
|
|
|
+ if (!entityhuman.isSpectator() && entityhuman.affectsSpawning) { // Paper
|
2016-11-17 02:23:38 +00:00
|
|
|
int l = MathHelper.floor(entityhuman.locX / 16.0D);
|
|
|
|
|
|
|
|
j = MathHelper.floor(entityhuman.locZ / 16.0D);
|
2016-11-19 00:55:14 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2018-12-08 10:09:55 +00:00
|
|
|
index e1e931406..c378df796 100644
|
2016-11-19 00:55:14 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2018-08-26 18:11:49 +00:00
|
|
|
@@ -34,6 +34,7 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
2018-07-15 01:53:17 +00:00
|
|
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
|
|
|
import org.bukkit.craftbukkit.util.LongHashSet; // Paper
|
|
|
|
+import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.block.BlockCanBuildEvent;
|
|
|
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
|
|
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
2018-09-15 23:13:40 +00:00
|
|
|
@@ -2439,7 +2440,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
2016-11-19 00:55:14 +00:00
|
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
|
|
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
|
|
|
|
|
2018-08-26 18:11:49 +00:00
|
|
|
- if (IEntitySelector.f.test(entityhuman)) {
|
|
|
|
+ if (IEntitySelector.f.test(entityhuman) && entityhuman.affectsSpawning) { // Paper - Affects Spawning API
|
2016-11-19 00:55:14 +00:00
|
|
|
double d4 = entityhuman.d(d0, d1, d2);
|
|
|
|
|
|
|
|
if (d3 < 0.0D || d4 < d3 * d3) {
|
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
|
2018-12-08 10:09:55 +00:00
|
|
|
index b5afd5d1c..47da00948 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
|
2018-11-03 00:23:27 +00:00
|
|
|
@@ -1633,7 +1633,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
|
|
|
--
|
2018-12-08 10:09:55 +00:00
|
|
|
2.19.2
|
2016-11-17 02:23:38 +00:00
|
|
|
|