diff options
author | Spottedleaf <[email protected]> | 2019-04-26 20:05:36 -0700 |
---|---|---|
committer | Zach <[email protected]> | 2019-04-26 23:05:36 -0400 |
commit | 36873bf2d6b8c8fd0297caa3f846678ef283a3fd (patch) | |
tree | 8c0c1597478b4a3c2402d6b82715aa9acb31dc07 /removed | |
parent | 818e88dbc52e747e67e2b265bedf686089c25e20 (diff) | |
download | Paper-36873bf2d6b8c8fd0297caa3f846678ef283a3fd.tar.gz Paper-36873bf2d6b8c8fd0297caa3f846678ef283a3fd.zip |
More 1.14 updates (#1995)
Diffstat (limited to 'removed')
3 files changed, 248 insertions, 0 deletions
diff --git a/removed/1.14/0094-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/removed/1.14/0094-Configurable-Keep-Spawn-Loaded-range-per-world.patch new file mode 100644 index 0000000000..368464af82 --- /dev/null +++ b/removed/1.14/0094-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -0,0 +1,111 @@ +From a56f7a9e0398151c9e09484f4b932f748bb637b0 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Sat, 13 Sep 2014 23:14:43 -0400 +Subject: [PATCH] Configurable Keep Spawn Loaded range per world + +This lets you disable it for some worlds and lower it for others. + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 6b74f810a9..260c55016e 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -258,4 +258,10 @@ public class PaperWorldConfig { + grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate)); + log("Grass Spread Tick Rate: " + grassUpdateRate); + } ++ ++ public short keepLoadedRange; ++ private void keepLoadedRange() { ++ keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16); ++ log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16)); ++ } + } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index ee45d3705b..01c5d3c572 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -486,13 +486,21 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + List<ChunkCoordIntPair> list = Lists.newArrayList(); + Set<ChunkCoordIntPair> set = Sets.newConcurrentHashSet(); + +- for (int i = -192; i <= 192 && this.isRunning(); i += 16) { +- for (int j = -192; j <= 192 && this.isRunning(); j += 16) { ++ // Paper start ++ short radius = worldserver.paperConfig.keepLoadedRange; ++ for (int i = -radius; i <= radius && this.isRunning(); i += 16) { ++ for (int j = -radius; j <= radius && this.isRunning(); j += 16) { ++ // Paper end + list.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4)); + } ++ } // Paper ++ if (this.isRunning()) { // Paper ++ int expected = list.size(); // Paper ++ + + CompletableFuture completablefuture = worldserver.getChunkProvider().a((Iterable) list, (chunk) -> { + set.add(chunk.getPos()); ++ if (set.size() < expected && set.size() % 25 == 0) this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / expected); // Paper + }); + + while (!completablefuture.isDone()) { +@@ -507,11 +515,11 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + + throw new RuntimeException(executionexception.getCause()); + } catch (TimeoutException timeoutexception) { +- this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625); ++ this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / expected); // Paper + } + } + +- this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / 625); ++ this.a(new ChatMessage("menu.preparingSpawn", new Object[0]), set.size() * 100 / expected); // Paper + } + } + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 34b5ca3a7e..8a445a1fa3 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -2853,8 +2853,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc + int k = i * 16 + 8 - blockposition.getX(); + int l = j * 16 + 8 - blockposition.getZ(); + boolean flag = true; ++ short keepLoadedRange = paperConfig.keepLoadedRange; // Paper + +- return k >= -128 && k <= 128 && l >= -128 && l <= 128 && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory' ++ return k >= -keepLoadedRange && k <= keepLoadedRange && l >= -keepLoadedRange && l <= keepLoadedRange && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory' // Paper - Re-add range var + } + + public LongSet ag() { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 5e821b84d6..b0ae0365e0 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -1007,7 +1007,7 @@ public final class CraftServer implements Server { + System.out.println("Preparing start region for level " + (console.worldServer.size() - 1) + " (Seed: " + internal.getSeed() + ")"); + + if (internal.getWorld().getKeepSpawnInMemory()) { +- short short1 = 196; ++ short short1 = internal.paperConfig.keepLoadedRange; // Paper + long i = System.currentTimeMillis(); + for (int j = -short1; j <= short1; j += 16) { + for (int k = -short1; k <= short1; k += 16) { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 262c3f910e..a8c7e7931e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -1419,8 +1419,9 @@ public class CraftWorld implements World { + int chunkCoordX = chunkcoordinates.getX() >> 4; + int chunkCoordZ = chunkcoordinates.getZ() >> 4; + // Cycle through the 25x25 Chunks around it to load/unload the chunks. +- for (int x = -12; x <= 12; x++) { +- for (int z = -12; z <= 12; z++) { ++ int radius = world.paperConfig.keepLoadedRange / 16; // Paper ++ for (int x = -radius; x <= radius; x++) { // Paper ++ for (int z = -radius; z <= radius; z++) { // Paper + if (keepLoaded) { + loadChunk(chunkCoordX + x, chunkCoordZ + z); + } else { +-- +2.21.0 + diff --git a/removed/1.14/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch b/removed/1.14/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch new file mode 100644 index 0000000000..382b025f1e --- /dev/null +++ b/removed/1.14/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch @@ -0,0 +1,34 @@ +From 2c462895126242c15395ff2033688c432492ad50 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Tue, 5 Apr 2016 19:42:22 -0400 +Subject: [PATCH] Don't spam reload spawn chunks in nether/end + + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index b595536648..5fc2da0d92 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -2849,6 +2849,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc + return this.K; + } + ++ public boolean isSpawnChunk(int i, int j) { return e(i, j); } // Paper - OBFHELPER + public boolean e(int i, int j) { + BlockPosition blockposition = this.getSpawn(); + int k = i * 16 + 8 - blockposition.getX(); +diff --git a/src/main/java/net/minecraft/server/WorldProvider.java b/src/main/java/net/minecraft/server/WorldProvider.java +index 5e87e537e4..3911e4947e 100644 +--- a/src/main/java/net/minecraft/server/WorldProvider.java ++++ b/src/main/java/net/minecraft/server/WorldProvider.java +@@ -69,7 +69,7 @@ public abstract class WorldProvider { + public void l() {} + + public boolean a(int i, int j) { +- return !this.b.isForceLoaded(i, j); ++ return !this.b.isSpawnChunk(i, j) && !this.b.isForceLoaded(i, j); // Paper - Use spawn chunks check for all worlds + } + + protected abstract void m(); +-- +2.21.0 + diff --git a/removed/1.14/0112-Entity-Tracking-Improvements.patch b/removed/1.14/0112-Entity-Tracking-Improvements.patch new file mode 100644 index 0000000000..a45d7f6192 --- /dev/null +++ b/removed/1.14/0112-Entity-Tracking-Improvements.patch @@ -0,0 +1,103 @@ +From 6d6e37ba0e3e91d7a711bc05c53daeeb304b82f4 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Mon, 17 Jun 2013 01:24:00 -0400 +Subject: [PATCH] Entity Tracking Improvements + +If any part of a Vehicle/Passenger relationship is visible to a player, +send all passenger/vehicles to the player in the chain. + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index c9b37727ff..82994db643 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -70,6 +70,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper + protected CraftEntity bukkitEntity; + ++ EntityTrackerEntry tracker; // Paper + public CraftEntity getBukkitEntity() { + if (bukkitEntity == null) { + bukkitEntity = CraftEntity.getEntity(world.getServer(), this); +diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +index de0cf6b735..5629f9909b 100644 +--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +@@ -56,6 +56,7 @@ public class EntityTrackerEntry { + // Paper end + + public EntityTrackerEntry(Entity entity, int i, int j, int k, boolean flag) { ++ entity.tracker = this; // Paper + this.tracker = entity; + this.e = i; + this.f = j; +@@ -453,17 +454,59 @@ public class EntityTrackerEntry { + + this.tracker.b(entityplayer); + entityplayer.d(this.tracker); ++ updatePassengers(entityplayer); // Paper + } + } else if (this.trackedPlayers.contains(entityplayer)) { + this.trackedPlayers.remove(entityplayer); + this.tracker.c(entityplayer); + entityplayer.c(this.tracker); ++ updatePassengers(entityplayer); // Paper + } + + } + } + + public boolean c(EntityPlayer entityplayer) { ++ // Paper start ++ if (tracker.isPassenger()) { ++ return isTrackedBy(tracker.getVehicle(), entityplayer); ++ } else if (hasPassengerInRange(tracker, entityplayer)) { ++ return true; ++ } ++ ++ return isInRangeOfPlayer(entityplayer); ++ } ++ private static boolean hasPassengerInRange(Entity entity, EntityPlayer entityplayer) { ++ if (!entity.isVehicle()) { ++ return false; ++ } ++ for (Entity passenger : entity.passengers) { ++ if (passenger.tracker != null && passenger.tracker.isInRangeOfPlayer(entityplayer)) { ++ return true; ++ } ++ if (passenger.isVehicle()) { ++ if (hasPassengerInRange(passenger, entityplayer)) { ++ return true; ++ } ++ } ++ } ++ return false; ++ } ++ private static boolean isTrackedBy(Entity entity, EntityPlayer entityplayer) { ++ return entity == entityplayer || entity.tracker != null && entity.tracker.trackedPlayers.contains(entityplayer); ++ } ++ private void updatePassengers(EntityPlayer player) { ++ if (tracker.isVehicle()) { ++ tracker.passengers.forEach((e) -> { ++ if (e.tracker != null) { ++ e.tracker.updatePlayer(player); ++ } ++ }); ++ player.playerConnection.sendPacket(new PacketPlayOutMount(this.tracker)); ++ } ++ } ++ private boolean isInRangeOfPlayer(EntityPlayer entityplayer) { ++ // Paper end + double d0 = entityplayer.locX - (double) this.xLoc / 4096.0D; + double d1 = entityplayer.locZ - (double) this.zLoc / 4096.0D; + int i = Math.min(this.e, (entityplayer.getViewDistance() - 1) * 16); // Paper - Use player view distance API +@@ -604,6 +647,7 @@ public class EntityTrackerEntry { + this.trackedPlayers.remove(entityplayer); + this.tracker.c(entityplayer); + entityplayer.c(this.tracker); ++ updatePassengers(entityplayer); // Paper + } + + } +-- +2.21.0 + |