mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
abba3d113b
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: bb813f6f SPIGOT-4605: Warn against hacking physics CraftBukkit Changes:2ced0233
Don't handle sync packets for kicked playersd5e96882
SPIGOT-4602: Cache reflection in decompile error workaround Spigot Changes: b0f4c22b SPIGOT-4605: Catch more physics problems
108 lines
4.9 KiB
Diff
108 lines
4.9 KiB
Diff
From 448e99a666ff2e2d3ff53a03bd499bfeffc8b5bd 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 5a90376fe..8b826c083 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -68,6 +68,9 @@ public abstract class EntityHuman extends EntityLiving {
|
|
private final ItemCooldown ce;
|
|
@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 80d872e79..e5322de97 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
@@ -620,7 +620,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
} else {
|
|
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
|
|
|
- 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
|
|
index 3c566ebd0..ba40e03fc 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
|
@@ -96,7 +96,7 @@ public class EntitySilverfish extends EntityMonster {
|
|
if (super.a(generatoraccess, flag)) {
|
|
EntityHuman entityhuman = generatoraccess.b(this, 5.0D);
|
|
|
|
- return entityhuman == null;
|
|
+ return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API
|
|
} else {
|
|
return false;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
index 6ca0e19cb..4eaa5d93b 100644
|
|
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
@@ -37,7 +37,7 @@ public final class SpawnerCreature {
|
|
while (iterator.hasNext()) {
|
|
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
|
|
|
- if (!entityhuman.isSpectator()) {
|
|
+ if (!entityhuman.isSpectator() && entityhuman.affectsSpawning) { // Paper
|
|
int l = MathHelper.floor(entityhuman.locX / 16.0D);
|
|
|
|
j = MathHelper.floor(entityhuman.locZ / 16.0D);
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index 51df93b18..10c8ece94 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -30,6 +30,7 @@ import org.bukkit.craftbukkit.CraftWorld;
|
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
|
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.craftbukkit.util.LongHashSet; // Paper
|
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
|
import org.bukkit.generator.ChunkGenerator;
|
|
@@ -2389,7 +2390,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
|
|
|
|
- if (IEntitySelector.f.test(entityhuman)) {
|
|
+ if (IEntitySelector.f.test(entityhuman) && entityhuman.affectsSpawning) { // Paper - Affects Spawning API
|
|
double d4 = entityhuman.d(d0, d1, d2);
|
|
|
|
if (d3 < 0.0D || d4 < d3 * d3) {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index ca3393ef8..6f832b331 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1608,7 +1608,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() {
|
|
--
|
|
2.20.1
|
|
|