geforkt von Mirrors/Paper
Fix fuckups from previous commit
Dieser Commit ist enthalten in:
Ursprung
a39e11bdf3
Commit
c5998f2bb7
@ -60,11 +60,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
void updateMaps(ServerPlayer player) {
|
void updateMaps(ServerPlayer player) {
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
|
|
||||||
trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
|
|
||||||
}
|
}
|
||||||
- // Paper end - use distance map to optimise entity tracker
|
// Paper end - use distance map to optimise entity tracker
|
||||||
+ // Paper end - use distance map to optimise entity trackerD
|
|
||||||
this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise PlayerChunkMap#isOutsideRange
|
this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise PlayerChunkMap#isOutsideRange
|
||||||
+ this.playerGeneralAreaMap.update(player, chunkX, chunkZ, GENERAL_AREA_MAP_SQUARE_RADIUS); // Paper - optimise checkDespawn
|
+ this.playerGeneralAreaMap.update(player, chunkX, chunkZ, GENERAL_AREA_MAP_SQUARE_RADIUS); // Paper - optimise checkDespawn
|
||||||
}
|
}
|
||||||
|
@ -275,6 +275,44 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/sr
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
|
if (flag) {
|
||||||
|
this.chunkMap.tick();
|
||||||
|
} else {
|
||||||
|
+ // Paper start - optimize isOutisdeRange
|
||||||
|
+ ChunkMap playerChunkMap = this.chunkMap;
|
||||||
|
+ for (ServerPlayer player : this.level.players) {
|
||||||
|
+ if (!player.affectsSpawning || player.isSpectator()) {
|
||||||
|
+ playerChunkMap.playerMobSpawnMap.remove(player);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ int viewDistance = this.chunkMap.getEffectiveViewDistance();
|
||||||
|
+
|
||||||
|
+ // copied and modified from isOutisdeRange
|
||||||
|
+ int chunkRange = level.spigotConfig.mobSpawnRange;
|
||||||
|
+ chunkRange = (chunkRange > viewDistance) ? (byte)viewDistance : chunkRange;
|
||||||
|
+ chunkRange = (chunkRange > DistanceManager.MOB_SPAWN_RANGE) ? DistanceManager.MOB_SPAWN_RANGE : chunkRange;
|
||||||
|
+
|
||||||
|
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(player.getBukkitEntity(), (byte)chunkRange);
|
||||||
|
+ event.callEvent();
|
||||||
|
+ if (event.isCancelled() || event.getSpawnRadius() < 0 || playerChunkMap.playerChunkTickRangeMap.getLastViewDistance(player) == -1) {
|
||||||
|
+ playerChunkMap.playerMobSpawnMap.remove(player);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ int range = Math.min(event.getSpawnRadius(), 32); // limit to max view distance
|
||||||
|
+ int chunkX = net.minecraft.server.MCUtil.getChunkCoordinate(player.getX());
|
||||||
|
+ int chunkZ = net.minecraft.server.MCUtil.getChunkCoordinate(player.getZ());
|
||||||
|
+
|
||||||
|
+ playerChunkMap.playerMobSpawnMap.addOrUpdate(player, chunkX, chunkZ, range);
|
||||||
|
+ player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in isOutsideRange
|
||||||
|
+ player.playerNaturallySpawnedEvent = event;
|
||||||
|
+ }
|
||||||
|
+ // Paper end - optimize isOutisdeRange
|
||||||
|
LevelData worlddata = this.level.getLevelData();
|
||||||
|
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
||||||
|
|
||||||
|
@ -335,14 +335,6 @@ diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/s
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
||||||
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
||||||
@@ -0,0 +0,0 @@ import net.minecraft.world.entity.ExperienceOrb;
|
|
||||||
import net.minecraft.world.entity.decoration.ItemFrame;
|
|
||||||
import net.minecraft.world.entity.decoration.Painting;
|
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
|
||||||
+import net.minecraft.world.entity.monster.Ghast;
|
|
||||||
|
|
||||||
public class TrackingRange
|
|
||||||
{
|
|
||||||
@@ -0,0 +0,0 @@ public class TrackingRange
|
@@ -0,0 +0,0 @@ public class TrackingRange
|
||||||
{
|
{
|
||||||
return defaultRange;
|
return defaultRange;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren