3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0020-Player-affects-spawning-API.patch
Spottedleaf 2f782a6652 Updated Upstream (CraftBukkit)
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

CraftBukkit Changes:
17543ecf SPIGOT-5035: Error Using Virtual Merchant GUI
0fc6922b SPIGOT-5028: Villager#setVillagerExperience() doesn't work
bdbdbe44 SPIGOT-5024: Fox error - Unknown target reason
2019-06-06 16:56:51 +01:00

74 Zeilen
3.1 KiB
Diff

From c36d61e7a6ea90de04c044568a1143d079a7cd9e 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 28791cca90..418e2fccdc 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -70,6 +70,9 @@ public abstract class EntityHuman extends EntityLiving {
private final ItemCooldown bY;
@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 d020414f98..0ecbf873bf 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -609,7 +609,7 @@ public abstract class EntityInsentient extends EntityLiving {
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 dbbc34d91b..d823c6b6d9 100644
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
@@ -106,7 +106,7 @@ public class EntitySilverfish extends EntityMonster {
if (super.a(generatoraccess, enummobspawn)) {
EntityHuman entityhuman = this.world.a(EntitySilverfish.b, (EntityLiving) this);
- 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 8980de8203..6085f293d0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1641,7 +1641,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.21.0