Fix chunk ticking range

This commit is contained in:
Shane Freeder 2019-06-06 06:13:00 +01:00
parent 0c14711c28
commit 4ff5387091
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
2 changed files with 19 additions and 14 deletions

View File

@ -1,4 +1,4 @@
From 435506a861b923a8f536856f51c269544dae2e7e Mon Sep 17 00:00:00 2001
From 2233464aa54f578f003c64beb1cb9ad36460e64e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:36:02 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
@ -9,10 +9,10 @@ from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 74a1b4a852..81b82aeeef 100644
index fba9f4b8a1..f5e62b0418 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -764,11 +764,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -764,11 +764,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
@ -24,10 +24,15 @@ index 74a1b4a852..81b82aeeef 100644
return this.playerMap.a(chunkcoordintpair.pair()).noneMatch((entityplayer) -> {
- return !entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange; // Spigot
+ // Paper start -
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event
+ = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityplayer.getBukkitEntity(), (byte) finalChunkRange);
+ final double blockRange = (double)((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
+ return event.isCancelled() || (!entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange); // Spigot
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event;
+ double blockRange = 16384.0D;
+ if (reducedRange) {
+ event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityplayer.getBukkitEntity(), (byte) finalChunkRange);
+ blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
+ if (event.isCancelled()) return true;
+ }
+
+ return (!entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange); // Spigot
+ // Paper end
});
}

View File

@ -1,4 +1,4 @@
From df72aa59ccf7c5c0dfd445a850a41f2724d728a9 Mon Sep 17 00:00:00 2001
From 34f06af441370b08d6c7f513573984728a0f84fc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 21 Jul 2018 08:25:40 -0400
Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
@ -6,7 +6,7 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
Add -Ddebug.entities=true to your JVM flags to gain more information
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ddfa88bac..291a8029e 100644
index ddfa88bac5..291a8029ed 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -75,6 +75,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -19,10 +19,10 @@ index ddfa88bac..291a8029e 100644
if (bukkitEntity == null) {
bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index c1d9f31b4..485fb95e1 100644
index f5e62b0418..7bdf0e2d67 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -926,6 +926,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -931,6 +931,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} else {
PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking());
@ -30,7 +30,7 @@ index c1d9f31b4..485fb95e1 100644
this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.track(this.world.getPlayers());
if (entity instanceof EntityPlayer) {
@@ -968,7 +969,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -973,7 +974,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.a();
}
@ -40,7 +40,7 @@ index c1d9f31b4..485fb95e1 100644
protected void g() {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d7229f100..5cf3aea4f 100644
index d7229f100b..5cf3aea4fc 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -68,6 +68,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
@ -52,7 +52,7 @@ index d7229f100..5cf3aea4f 100644
public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 8cffbabfb..f6ba51d14 100644
index 8cffbabfb6..f6ba51d14a 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -69,6 +69,9 @@ public class WorldServer extends World {