2021-06-11 14:02:28 +02:00
|
|
|
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/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
2024-01-24 11:45:17 +01:00
|
|
|
index 3126e8cab3c40e3af47f4c8925e1c6a9523309ba..3207166061bf9c4d7bf3f38e5a9f7aff23ccd5c1 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
2023-12-05 20:39:26 +01:00
|
|
|
@@ -30,6 +30,11 @@ public final class EntitySelector {
|
2021-11-23 12:27:39 +01:00
|
|
|
public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith);
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2021-06-12 00:37:16 +02:00
|
|
|
private EntitySelector() {}
|
2024-01-24 11:45:17 +01:00
|
|
|
+ // Paper start - Affects Spawning API
|
2022-11-15 20:15:01 +01:00
|
|
|
+ public static final Predicate<Entity> PLAYER_AFFECTS_SPAWNING = (entity) -> {
|
|
|
|
+ return !entity.isSpectator() && entity.isAlive() && entity instanceof Player player && player.affectsSpawning;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ };
|
2024-01-24 11:45:17 +01:00
|
|
|
+ // Paper end - Affects Spawning API
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2021-06-12 00:37:16 +02:00
|
|
|
public static Predicate<Entity> withinDistance(double x, double y, double z, double max) {
|
|
|
|
double d4 = max * max;
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear 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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
index 1ab169b362cc18d2467e5ed6a4af325d7f6dd247..2de1ad28d42d4beec69901bf985ac0be582f00b9 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear 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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -850,7 +850,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
2023-06-07 20:31:32 +02:00
|
|
|
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear 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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
2021-06-11 14:02:28 +02:00
|
|
|
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
|
2023-06-07 20:31:32 +02:00
|
|
|
- Player entityhuman = this.level().getNearestPlayer(this, -1.0D);
|
2024-01-24 11:45:17 +01:00
|
|
|
+ Player entityhuman = this.level().findNearbyPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper - Affects Spawning API
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
if (entityhuman != null) {
|
2021-11-23 12:27:39 +01:00
|
|
|
double d0 = entityhuman.distanceToSqr((Entity) this);
|
2022-11-15 20:15:01 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
|
2023-06-07 20:31:32 +02:00
|
|
|
index c7ab59aa0e2fd0f3e7252647ddb25b82ac604830..8f20239f3ef7ebe41fac8ee6e024c36dafec33c4 100644
|
2022-11-15 20:15:01 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
|
2022-12-07 19:32:25 +01:00
|
|
|
@@ -25,7 +25,7 @@ public class SkeletonTrapGoal extends Goal {
|
2022-11-15 20:15:01 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canUse() {
|
2023-06-07 20:31:32 +02:00
|
|
|
- return this.horse.level().hasNearbyAlivePlayer(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D);
|
|
|
|
+ return this.horse.level().hasNearbyAlivePlayerThatAffectsSpawning(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D); // Paper - Affects Spawning API
|
2022-11-15 20:15:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear 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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
index 38fb2a14b7c7c535f5a0b13d698a2521ca9d0c1a..0e2725d92002c181f542e2335cdd6e6de69155e1 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear 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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -128,7 +128,7 @@ public class Silverfish extends Monster {
|
2021-06-11 14:02:28 +02:00
|
|
|
if (checkAnyLightMonsterSpawnRules(type, world, spawnReason, pos, random)) {
|
|
|
|
Player entityhuman = world.getNearestPlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 5.0D, true);
|
|
|
|
|
|
|
|
- return entityhuman == null;
|
|
|
|
+ return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
2022-11-15 20:15:01 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
2024-01-24 11:45:17 +01:00
|
|
|
index a779d32f87b59f347408974e402fad22fdc47f09..15ccde8ee8bac1f70c6047464595aff6db073646 100644
|
2022-11-15 20:15:01 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
2023-09-21 21:54:46 +02:00
|
|
|
@@ -326,7 +326,7 @@ public class Zombie extends Monster {
|
2022-11-15 20:15:01 +01:00
|
|
|
|
2023-06-07 20:31:32 +02:00
|
|
|
if (NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, this.level(), blockposition, entitytypes) && SpawnPlacements.checkSpawnRules(entitytypes, worldserver, MobSpawnType.REINFORCEMENT, blockposition, this.level().random)) {
|
2022-11-15 20:15:01 +01:00
|
|
|
entityzombie.setPos((double) i1, (double) j1, (double) k1);
|
2023-06-07 20:31:32 +02:00
|
|
|
- if (!this.level().hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) {
|
|
|
|
+ if (!this.level().hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) { // Paper - Affects Spawning API
|
2022-11-15 20:15:01 +01:00
|
|
|
entityzombie.setTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
|
2023-06-07 20:31:32 +02:00
|
|
|
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.REINFORCEMENT, (SpawnGroupData) null, (CompoundTag) null);
|
2022-11-15 20:15:01 +01:00
|
|
|
worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear 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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
index 1ac22d4cbab0f385b1c1e0b4ced59ca7c3ca4af4..0cd534ddc28758f7fa6203c66505f167ecbdd3de 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear 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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -181,6 +181,7 @@ public abstract class Player extends LivingEntity {
|
2021-06-11 14:02:28 +02:00
|
|
|
@Nullable
|
|
|
|
public FishingHook fishing;
|
2023-03-14 19:05:23 +01:00
|
|
|
protected float hurtDir;
|
2024-01-24 11:45:17 +01:00
|
|
|
+ public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
// CraftBukkit start
|
|
|
|
public boolean fauxSleeping;
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
2023-12-05 20:39:26 +01:00
|
|
|
index d156f7e3430685947d2b4c30aa867e8002ca70ad..e888cf862662ae6baa6d0de8188aa74a9c6a8e00 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
2023-12-05 20:39:26 +01:00
|
|
|
@@ -56,7 +56,7 @@ public abstract class BaseSpawner {
|
2021-06-12 00:37:16 +02:00
|
|
|
}
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2021-11-24 04:42:31 +01:00
|
|
|
public boolean isNearPlayer(Level world, BlockPos pos) {
|
2021-06-12 00:37:16 +02:00
|
|
|
- return world.hasNearbyAlivePlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange);
|
2022-11-15 20:15:01 +01:00
|
|
|
+ return world.hasNearbyAlivePlayerThatAffectsSpawning((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper - Affects Spawning API
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-06-12 00:37:16 +02:00
|
|
|
public void clientTick(Level world, BlockPos pos) {
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
2024-04-20 15:24:42 +02:00
|
|
|
index f38f62e777d88a783e1e3b7e1a48da921cc67cf4..77ae7882a08441d9a80b50492be5e48487a2fdab 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -74,6 +74,11 @@ public interface EntityGetter {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-24 11:45:17 +01:00
|
|
|
+ // Paper start - Affects Spawning API
|
2022-11-15 20:15:01 +01:00
|
|
|
+ default @Nullable Player findNearbyPlayer(Entity entity, double maxDistance, @Nullable Predicate<Entity> predicate) {
|
|
|
|
+ return this.getNearestPlayer(entity.getX(), entity.getY(), entity.getZ(), maxDistance, predicate);
|
|
|
|
+ }
|
2024-01-24 11:45:17 +01:00
|
|
|
+ // Paper end - Affects Spawning API
|
2022-11-15 20:15:01 +01:00
|
|
|
@Nullable
|
|
|
|
default Player getNearestPlayer(double x, double y, double z, double maxDistance, @Nullable Predicate<Entity> targetPredicate) {
|
2024-04-12 21:14:06 +02:00
|
|
|
double d = -1.0;
|
|
|
|
@@ -103,6 +108,20 @@ public interface EntityGetter {
|
2021-06-11 14:02:28 +02:00
|
|
|
return this.getNearestPlayer(x, y, z, maxDistance, predicate);
|
|
|
|
}
|
|
|
|
|
2024-01-24 11:45:17 +01:00
|
|
|
+ // Paper start - Affects Spawning API
|
2022-11-15 20:15:01 +01:00
|
|
|
+ default boolean hasNearbyAlivePlayerThatAffectsSpawning(double x, double y, double z, double range) {
|
|
|
|
+ for (Player player : this.players()) {
|
|
|
|
+ if (EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) { // combines NO_SPECTATORS and LIVING_ENTITY_STILL_ALIVE with an "affects spawning" check
|
|
|
|
+ double distanceSqr = player.distanceToSqr(x, y, z);
|
|
|
|
+ if (range < 0.0D || distanceSqr < range * range) {
|
|
|
|
+ return true;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
2022-11-15 20:15:01 +01:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
2024-01-24 11:45:17 +01:00
|
|
|
+ // Paper end - Affects Spawning API
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
|
|
|
default boolean hasNearbyAlivePlayer(double x, double y, double z, double range) {
|
2024-04-12 21:14:06 +02:00
|
|
|
for (Player player : this.players()) {
|
2021-06-12 00:37:16 +02:00
|
|
|
if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2024-04-20 15:24:42 +02:00
|
|
|
index 2da161b901189c3dcf90c95a074b8c2cbf30f282..e1510cb7cb1406bebed1804b8c18086425cb7d94 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2024-04-20 15:24:42 +02:00
|
|
|
@@ -2340,6 +2340,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2023-09-21 21:54:46 +02:00
|
|
|
return this.getHandle().language;
|
|
|
|
}
|
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start
|
|
|
|
+ public void setAffectsSpawning(boolean affects) {
|
|
|
|
+ this.getHandle().affectsSpawning = affects;
|
2023-09-21 21:54:46 +02:00
|
|
|
+ }
|
|
|
|
+
|
2021-06-11 14:02:28 +02:00
|
|
|
+ @Override
|
|
|
|
+ public boolean getAffectsSpawning() {
|
|
|
|
+ return this.getHandle().affectsSpawning;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public void updateCommands() {
|
2021-06-12 00:37:16 +02:00
|
|
|
if (this.getHandle().connection == null) return;
|