2017-06-19 01:36:55 +00:00
|
|
|
From 0e729e406610f5d057c235a68bb6ba79dd108b90 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
|
2017-06-19 01:36:55 +00:00
|
|
|
index b8479d9c..e9509e61 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
|
2017-05-21 04:41:39 +00:00
|
|
|
@@ -64,6 +64,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|
|
|
private final ItemCooldown bW;
|
2016-11-17 02:23:38 +00:00
|
|
|
@Nullable
|
|
|
|
public EntityFishingHook hookedFish;
|
2016-11-19 00:55:14 +00:00
|
|
|
+ public boolean affectsSpawning = true;
|
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
|
2017-06-19 01:36:55 +00:00
|
|
|
index 0c2f7e1d..b594602a 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
|
2017-05-14 18:05:01 +00:00
|
|
|
@@ -614,7 +614,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
|
2017-06-19 01:36:55 +00:00
|
|
|
index 50bca48b..57552c52 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
|
|
|
|
@@ -99,8 +99,7 @@ public class EntitySilverfish extends EntityMonster {
|
2017-05-14 18:05:01 +00:00
|
|
|
public boolean P() {
|
|
|
|
if (super.P()) {
|
2016-11-19 00:55:14 +00:00
|
|
|
EntityHuman entityhuman = this.world.b(this, 5.0D);
|
|
|
|
-
|
|
|
|
- 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
|
2017-06-19 01:36:55 +00:00
|
|
|
index a599a043..1c7c187c 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
|
|
|
|
@@ -52,7 +52,7 @@ public final class SpawnerCreature {
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
|
|
|
|
|
|
|
- if (!entityhuman.isSpectator()) {
|
2016-11-19 00:55:14 +00:00
|
|
|
+ if (!entityhuman.isSpectator() && entityhuman.affectsSpawning) {
|
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
|
2017-06-19 01:36:55 +00:00
|
|
|
index d6d8cd90..9e505cce 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
|
2017-06-19 01:36:55 +00:00
|
|
|
@@ -2735,7 +2735,7 @@ public abstract class World implements IBlockAccess {
|
2016-11-19 00:55:14 +00:00
|
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
|
|
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
|
|
|
|
|
|
|
|
- if (IEntitySelector.e.apply(entityhuman)) {
|
|
|
|
+ if (IEntitySelector.e.apply(entityhuman) && entityhuman.affectsSpawning) { // Paper - Affects Spawning API
|
|
|
|
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
|
2017-06-19 01:36:55 +00:00
|
|
|
index d4c8fafe..49f91a8c 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
|
2017-05-28 04:25:17 +00:00
|
|
|
@@ -1458,6 +1458,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
@Override
|
|
|
|
public String getLocale() {
|
|
|
|
return getHandle().locale;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
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
|
|
|
}
|
|
|
|
|
2016-11-17 02:23:38 +00:00
|
|
|
// Spigot start
|
|
|
|
--
|
2017-06-19 01:36:55 +00:00
|
|
|
2.13.1.windows.2
|
2016-11-17 02:23:38 +00:00
|
|
|
|