From f7dfbc078c1e0651ef3d3037215936212659ecda Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 26 Apr 2019 20:05:36 -0700 Subject: [PATCH] More 1.14 updates (#1995) --- .../Access-items-by-EquipmentSlot.patch | 2 +- .../Add-PlayerUseUnknownEntityEvent.patch | 6 +- .../Add-World-Util-Methods.patch | 6 +- ...-to-configure-frosted_ice-properties.patch | 12 +- .../Add-exception-reporting-event.patch | 25 ++-- ...ent-to-allow-plugins-to-handle-clien.patch | 2 +- .../Configurable-Chunk-Inhabited-Time.patch | 16 +-- .../Configurable-Grass-Spread-Tick-Rate.patch | 10 +- ...le-Keep-Spawn-Loaded-range-per-world.patch | 109 --------------- .../Configurable-Player-Collision.patch | 27 ++-- .../Configurable-RCON-IP-address.patch | 57 ++++++-- .../Do-not-load-chunks-for-Pathfinding.patch | 46 +++--- .../Do-not-load-chunks-for-light-checks.patch | 4 +- ...y-scoreboard-teams-to-scoreboard.dat.patch | 4 +- ...am-reload-spawn-chunks-in-nether-end.patch | 32 ----- .../Don-t-tick-Skulls-unused-code.patch | 6 +- ...Entity-AddTo-RemoveFrom-World-Events.patch | 34 ++--- .../Entity-Tracking-Improvements.patch | 101 -------------- .../EntityPathfindEvent.patch | 70 ++++++++-- ...ityRegainHealthEvent-isFastRegen-API.patch | 12 +- ...g-BlockPlaceEvent-triggering-physics.patch | 6 +- ...dDebugInfo-not-initialized-on-client.patch | 4 +- .../Implement-PlayerLocaleChangeEvent.patch | 12 +- ...item-frames-performance-and-bug-fixe.patch | 50 +++---- ...-API-Replenishable-Lootables-Feature.patch | 121 ++++++++-------- ...ckPhysicsEvent-if-a-plugin-has-a-lis.patch | 34 ++--- ...Location-getType-and-getBlockData-fo.patch | 132 ++++-------------- ...nilla-per-world-scoreboard-coloring-.patch | 22 +-- .../Prevent-Fire-from-loading-chunks.patch | 26 ++-- ...uce-IO-ops-opening-a-new-region-file.patch | 63 +++++---- .../Remove-Debug-checks-from-DataBits.patch | 23 ++- ...Remove-unused-World-Tile-Entity-List.patch | 76 +++++----- ...egionFileCache-and-make-configurable.patch | 55 ++------ ...tem-property-for-disabling-watchdoge.patch | 2 +- .../Use-Optimized-Collections.patch | 4 +- ...nd-for-setting-passengers-on-players.patch | 2 +- ...-possibility-for-getServer-singleton.patch | 25 ++-- 37 files changed, 494 insertions(+), 744 deletions(-) delete mode 100644 Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch delete mode 100644 Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch delete mode 100644 Spigot-Server-Patches/Entity-Tracking-Improvements.patch diff --git a/Spigot-Server-Patches/Access-items-by-EquipmentSlot.patch b/Spigot-Server-Patches/Access-items-by-EquipmentSlot.patch index b744a0fc8f..b4980c2690 100644 --- a/Spigot-Server-Patches/Access-items-by-EquipmentSlot.patch +++ b/Spigot-Server-Patches/Access-items-by-EquipmentSlot.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Access items by EquipmentSlot diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java -index 2273f213cb..60446f2478 100644 +index d5b90069c..c7db9bd39 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -0,0 +0,0 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i diff --git a/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch index 05ddd90d13..5bd93d4d83 100644 --- a/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerUseUnknownEntityEvent diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -index 77440ac81f..8711462e16 100644 +index 680adbdeb..3f7697b39 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -18,10 +18,10 @@ index 77440ac81f..8711462e16 100644 private Vec3D c; private EnumHand d; diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 8a403354d9..545899fc29 100644 +index e83ebaf4f..7b8caa0b9 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { } } } diff --git a/Spigot-Server-Patches/Add-World-Util-Methods.patch b/Spigot-Server-Patches/Add-World-Util-Methods.patch index ba9754ddf2..cbf7785797 100644 --- a/Spigot-Server-Patches/Add-World-Util-Methods.patch +++ b/Spigot-Server-Patches/Add-World-Util-Methods.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add World Util Methods Methods that can be used for other patches to help improve logic. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index c4103680d4..9433d04f43 100644 +index c4103680d..9433d04f4 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -18,7 +18,7 @@ index c4103680d4..9433d04f43 100644 return this.a(blockposition, i, this.world.getWorldProvider().g()); } diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java -index bac6c9d65b..0930552b1f 100644 +index bac6c9d65..0930552b1 100644 --- a/src/main/java/net/minecraft/server/IWorldReader.java +++ b/src/main/java/net/minecraft/server/IWorldReader.java @@ -0,0 +0,0 @@ public interface IWorldReader extends IIBlockAccess { @@ -45,7 +45,7 @@ index bac6c9d65b..0930552b1f 100644 @Nullable IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 55e8c7c7d4..e8831e2a40 100644 +index 01f510588..cdc5d7009 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose diff --git a/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch b/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch index c282827d40..dece356a89 100644 --- a/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch +++ b/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ability to configure frosted_ice properties diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 37cc057ab7..52a6ff8554 100644 +index 1da7ffab5..377f4983b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -24,21 +24,21 @@ index 37cc057ab7..52a6ff8554 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java -index f99046b9b6..2c881be1ed 100644 +index 1a0c2eeaa..39c3bbc9c 100644 --- a/src/main/java/net/minecraft/server/BlockIceFrost.java +++ b/src/main/java/net/minecraft/server/BlockIceFrost.java @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { - } - public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + @Override + public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice - if ((random.nextInt(3) == 0 || this.a(world, blockposition, 4)) && world.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b(world, blockposition) && this.c(iblockdata, world, blockposition)) { + if ((random.nextInt(3) == 0 || this.a(world, blockposition, 4)) && world.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b((IBlockAccess) world, blockposition) && this.e(iblockdata, world, blockposition)) { BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition.r(); Throwable throwable = null; @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { IBlockData iblockdata1 = world.getType(blockposition_pooledblockposition); - if (iblockdata1.getBlock() == this && !this.c(iblockdata1, world, blockposition_pooledblockposition)) { + if (iblockdata1.getBlock() == this && !this.e(iblockdata1, world, blockposition_pooledblockposition)) { - world.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, 20, 40)); + world.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay } diff --git a/Spigot-Server-Patches/Add-exception-reporting-event.patch b/Spigot-Server-Patches/Add-exception-reporting-event.patch index fabef1b114..7e4464d314 100644 --- a/Spigot-Server-Patches/Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/Add-exception-reporting-event.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java new file mode 100644 -index 0000000000..f699ce18ca +index 000000000..f699ce18c --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java @@ -0,0 +0,0 @@ @@ -49,7 +49,7 @@ index 0000000000..f699ce18ca + } +} diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 1cf5e388e4..c4103680d4 100644 +index 1cf5e388e..c4103680d 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ @@ -80,7 +80,7 @@ index 1cf5e388e4..c4103680d4 100644 } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 4f0fbe4a0d..2dd1c28fab 100644 +index 4f0fbe4a0..2dd1c28fa 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ import java.util.concurrent.Executor; @@ -94,7 +94,7 @@ index 4f0fbe4a0d..2dd1c28fab 100644 public class ChunkProviderServer extends IChunkProvider { diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index 1dd793d2fb..61ea2818b1 100644 +index 1dd793d2f..61ea2818b 100644 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java @@ -0,0 +0,0 @@ @@ -121,7 +121,7 @@ index 1dd793d2fb..61ea2818b1 100644 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 528d0f0cd2..be903252be 100644 +index 528d0f0cd..be903252b 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -141,7 +141,7 @@ index 528d0f0cd2..be903252be 100644 } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index d4a9af975d..88b5aa3a51 100644 +index d4a9af975..88b5aa3a5 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -0,0 +0,0 @@ @@ -168,7 +168,7 @@ index d4a9af975d..88b5aa3a51 100644 } diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 9d4febfbb6..7e58e4714a 100644 +index 9d4febfbb..7e58e4714 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; @@ -196,7 +196,7 @@ index 9d4febfbb6..7e58e4714a 100644 } diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index d004494aea..d3ed749e1c 100644 +index d004494ae..d3ed749e1 100644 --- a/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java @@ -0,0 +0,0 @@ @@ -216,19 +216,16 @@ index d004494aea..d3ed749e1c 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 25e5216e25..55e8c7c7d4 100644 +index 25e5216e2..01f510588 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ package net.minecraft.server; import co.aikar.timings.Timing; import co.aikar.timings.Timings; -+<<<<<<< HEAD -+======= +import com.destroystokyo.paper.event.server.ServerExceptionEvent; +import com.destroystokyo.paper.exception.ServerInternalException; +import com.google.common.base.MoreObjects; -+>>>>>>> Add exception reporting event import com.google.common.collect.Lists; import java.io.IOException; import java.util.Collection; @@ -258,7 +255,7 @@ index 25e5216e25..55e8c7c7d4 100644 return; // Paper end diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java -index 3c5b3fe101..47a4ea9985 100644 +index 3c5b3fe10..47a4ea998 100644 --- a/src/main/java/net/minecraft/server/WorldPersistentData.java +++ b/src/main/java/net/minecraft/server/WorldPersistentData.java @@ -0,0 +0,0 @@ public class WorldPersistentData { @@ -270,7 +267,7 @@ index 3c5b3fe101..47a4ea9985 100644 } finally { if (pushbackinputstream != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index d99634062b..86a5ee8aac 100644 +index d99634062..86a5ee8aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -0,0 +0,0 @@ import java.util.concurrent.atomic.AtomicInteger; diff --git a/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch index 909373319f..7706fd3d79 100644 --- a/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 8f2289f4ea..93ca93b640 100644 +index 1ef8e8653..60be2fa99 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { diff --git a/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch b/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch index f3f6179363..80a5f81bdd 100644 --- a/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch +++ b/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch @@ -11,7 +11,7 @@ For people who want all chunks to be treated equally, you can chose a fixed valu This allows to fine-tune vanilla gameplay. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index be380ac75e..69ac43d9a9 100644 +index 2a71381da..e43866991 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -35,16 +35,16 @@ index be380ac75e..69ac43d9a9 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index b76c1579ea..c74176daa5 100644 +index 98ec98e02..a413dc73b 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + + @Override + public long q() { +- return this.t; ++ return world.paperConfig.fixedInhabitedTime < 0 ? this.t : world.paperConfig.fixedInhabitedTime; // Paper } - public long m() { -- return this.z; -+ return world.paperConfig.fixedInhabitedTime < 0 ? this.z : world.paperConfig.fixedInhabitedTime; // Paper - } - - public void b(long i) { + @Override -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch b/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch index 81a2a17c67..25934f86da 100644 --- a/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch +++ b/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable Grass Spread Tick Rate diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 69ac43d9a9..6b74f810a9 100644 +index e43866991..59d11e68c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -20,15 +20,15 @@ index 69ac43d9a9..6b74f810a9 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java -index da6182deb1..f1174825c2 100644 +index ddca19b46..377a57c89 100644 --- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java +++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java @@ -0,0 +0,0 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow { - } - public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + @Override + public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + if (this instanceof BlockGrass && world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + blockposition.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper if (!world.isClientSide) { - if (!a((IWorldReader) world, blockposition)) { + if (!b(iblockdata, (IWorldReader) world, blockposition)) { // CraftBukkit start -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch b/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch deleted file mode 100644 index a4646267f5..0000000000 --- a/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -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 -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati - List list = Lists.newArrayList(); - Set 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()) { -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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 { --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Player-Collision.patch b/Spigot-Server-Patches/Configurable-Player-Collision.patch index 40a2fc3ae6..fb8e536fe9 100644 --- a/Spigot-Server-Patches/Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/Configurable-Player-Collision.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable Player Collision diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 06c53af2c5..b0bfdf9424 100644 +index e929ba452..033fcf50e 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { @@ -19,12 +19,12 @@ index 06c53af2c5..b0bfdf9424 100644 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 01c5d3c572..b87520d834 100644 +index c5359ae24..43cd6d2c6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati - this.a(this.getWorldServer(DimensionManager.OVERWORLD).worldMaps); - // CraftBukkit end +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant playersByName = new java.util.HashMap<>(); + @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule - public PlayerList(MinecraftServer minecraftserver) { - this.cserver = minecraftserver.server = new CraftServer(minecraftserver, this); + public PlayerList(MinecraftServer minecraftserver, int i) { + this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this); @@ -0,0 +0,0 @@ public abstract class PlayerList { } @@ -79,7 +80,7 @@ index 5236948990..79641a73a8 100644 + } + // Paper end // CraftBukkit - Moved from above, added world - PlayerList.f.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); + PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX, entityplayer.locY, entityplayer.locZ); } @@ -0,0 +0,0 @@ public abstract class PlayerList { entityplayer.playerTick();// SPIGOT-924 diff --git a/Spigot-Server-Patches/Configurable-RCON-IP-address.patch b/Spigot-Server-Patches/Configurable-RCON-IP-address.patch index 0206d1db25..d593c18854 100644 --- a/Spigot-Server-Patches/Configurable-RCON-IP-address.patch +++ b/Spigot-Server-Patches/Configurable-RCON-IP-address.patch @@ -5,17 +5,56 @@ Subject: [PATCH] Configurable RCON IP address For servers with multiple IP's, ability to bind to a specific interface. +diff --git a/src/main/java/net/minecraft/server/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +index 4af81c886..fb092a941 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java ++++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager.EditableProperty playerIdleTimeout; + public final PropertyManager.EditableProperty whiteList; + ++ public final String rconIp; // Paper - Add rcon ip ++ + // CraftBukkit start + public DedicatedServerProperties(Properties properties, OptionSet optionset) { + super(properties, optionset); +@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager> { + }; + } + +- @Nullable +- private String c(String s) { ++ @Nullable String getSettingIfExists(final String path) { return this.c(path); } // Paper - OBFHELPER ++ @Nullable private String c(String s) { // Paper - OBFHELPER + return (String) getOverride(s, this.properties.getProperty(s)); // CraftBukkit + } + diff --git a/src/main/java/net/minecraft/server/RemoteControlListener.java b/src/main/java/net/minecraft/server/RemoteControlListener.java -index 81a6a8fc9e..7b82c4dea2 100644 +index e48d6dcd7..2ce490be0 100644 --- a/src/main/java/net/minecraft/server/RemoteControlListener.java +++ b/src/main/java/net/minecraft/server/RemoteControlListener.java @@ -0,0 +0,0 @@ public class RemoteControlListener extends RemoteConnectionThread { - super(iminecraftserver, "RCON Listener"); - this.h = iminecraftserver.a("rcon.port", 0); - this.l = iminecraftserver.a("rcon.password", ""); -- this.j = iminecraftserver.e(); -+ this.j = iminecraftserver.a("rcon.ip", ((DedicatedServer) iminecraftserver).getServerIp()); // Paper - this.i = iminecraftserver.e_(); - if (0 == this.h) { - this.h = this.i + 10; + + this.h = dedicatedserverproperties.rconPort; + this.k = dedicatedserverproperties.rconPassword; +- this.i = iminecraftserver.e_(); ++ this.i = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip + if (this.i.isEmpty()) { + this.i = "0.0.0.0"; + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch b/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch index fdd7af2680..f9f3da00be 100644 --- a/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch +++ b/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch @@ -5,20 +5,20 @@ Subject: [PATCH] Do not load chunks for Pathfinding diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java -index 49533ac33e..eef3ab73fc 100644 +index c76087614..475c93836 100644 --- a/src/main/java/net/minecraft/server/ChunkCache.java +++ b/src/main/java/net/minecraft/server/ChunkCache.java @@ -0,0 +0,0 @@ public class ChunkCache implements IIBlockAccess { - for (l = this.a; l <= j; ++l) { - for (i1 = this.b; i1 <= k; ++i1) { -- this.c[l - this.a][i1 - this.b] = world.getChunkAt(l, i1); -+ this.c[l - this.a][i1 - this.b] = world.getChunkIfLoaded(l, i1); // Paper + for (k = this.a; k <= i; ++k) { + for (l = this.b; l <= j; ++l) { +- this.c[k - this.a][l - this.b] = world.getChunkAt(k, l, ChunkStatus.FULL, false); ++ this.c[k - this.a][l - this.b] = world.getChunkIfLoaded(k, l); // Paper } } diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 604049b088..716d00afb1 100644 +index 6ce35018a..2a391be28 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { @@ -35,34 +35,34 @@ index 604049b088..716d00afb1 100644 @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { this.b = world; this.p = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); - this.r = this.a(); + this.r = this.a(MathHelper.floor(this.p.getValue() * 16.0D)); + setWorld(); // Paper } - public BlockPosition i() { + public BlockPosition h() { @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { } - public void d() { + public void c() { + setWorld(); // Paper ++this.e; if (this.m) { - this.l(); + this.k(); diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java -index 3085338f0a..89d51d471a 100644 +index 480dee704..3901dd751 100644 --- a/src/main/java/net/minecraft/server/Pathfinder.java +++ b/src/main/java/net/minecraft/server/Pathfinder.java @@ -0,0 +0,0 @@ public class Pathfinder { - private final Path a = new Path(); private final Set b = Sets.newHashSet(); private final PathPoint[] c = new PathPoint[32]; -- private PathfinderAbstract d; -+ private PathfinderAbstract d; public PathfinderAbstract getPathfinder() { return d; } // Paper - OBFHELPER + private final int d; +- private PathfinderAbstract e; ++ private PathfinderAbstract e; public PathfinderAbstract getPathfinder() { return this.e; } // Paper - OBFHELPER - public Pathfinder(PathfinderAbstract pathfinderabstract) { - this.d = pathfinderabstract; + public Pathfinder(PathfinderAbstract pathfinderabstract, int i) { + this.e = pathfinderabstract; diff --git a/src/main/java/net/minecraft/server/PathfinderAbstract.java b/src/main/java/net/minecraft/server/PathfinderAbstract.java -index 36d7e1d966..d722c85139 100644 +index 7aad55c7d..3cb43808f 100644 --- a/src/main/java/net/minecraft/server/PathfinderAbstract.java +++ b/src/main/java/net/minecraft/server/PathfinderAbstract.java @@ -0,0 +0,0 @@ public abstract class PathfinderAbstract { @@ -70,7 +70,7 @@ index 36d7e1d966..d722c85139 100644 protected IBlockAccess a; protected EntityInsentient b; + public World world; // Paper - protected final IntHashMap c = new IntHashMap<>(); + protected final Int2ObjectMap c = new Int2ObjectOpenHashMap(); protected int d; protected int e; @@ -0,0 +0,0 @@ public abstract class PathfinderAbstract { @@ -79,10 +79,10 @@ index 36d7e1d966..d722c85139 100644 this.a = iblockaccess; + if (iblockaccess instanceof World) world = (World) iblockaccess; // Paper this.b = entityinsentient; - this.c.c(); - this.d = MathHelper.d(entityinsentient.width + 1.0F); + this.c.clear(); + this.d = MathHelper.d(entityinsentient.getWidth() + 1.0F); diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index eec8916479..e45bdb581e 100644 +index f1198272b..1eaed0fd8 100644 --- a/src/main/java/net/minecraft/server/PathfinderNormal.java +++ b/src/main/java/net/minecraft/server/PathfinderNormal.java @@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract { @@ -99,8 +99,8 @@ index eec8916479..e45bdb581e 100644 for (int l = -1; l <= 1; ++l) { for (int i1 = -1; i1 <= 1; ++i1) { if (l != 0 || i1 != 0) { -- Block block = iblockaccess.getType(blockposition_pooledblockposition.c(l + i, j, i1 + k)).getBlock(); -+ Block block = world.getBlockIfLoaded(blockposition_pooledblockposition.c(l + i, j, i1 + k)); // Paper +- Block block = iblockaccess.getType(blockposition_pooledblockposition.d(l + i, j, i1 + k)).getBlock(); ++ Block block = world.getBlockIfLoaded(blockposition_pooledblockposition.d(l + i, j, i1 + k)); // Paper - if (block == Blocks.CACTUS) { + if (block == null) pathtype = PathType.BLOCKED; // Paper diff --git a/Spigot-Server-Patches/Do-not-load-chunks-for-light-checks.patch b/Spigot-Server-Patches/Do-not-load-chunks-for-light-checks.patch index c2830d8c63..a389bd297c 100644 --- a/Spigot-Server-Patches/Do-not-load-chunks-for-light-checks.patch +++ b/Spigot-Server-Patches/Do-not-load-chunks-for-light-checks.patch @@ -7,10 +7,10 @@ Should only happen for blocks on the edge that uses neighbors light level (certain blocks). In that case, there will be 3-4 other neighbors to get a light level from. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 9371d83f1d..34b5ca3a7e 100644 +index 7d6893cee..31e477430 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose if (blockposition.getY() >= 256) { blockposition = new BlockPosition(blockposition.getX(), 255, blockposition.getZ()); } diff --git a/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index 4355981aea..0a686055db 100644 --- a/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index b0bfdf9424..c6d2c30339 100644 +index 033fcf50e..a89a9bfcb 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { @@ -19,7 +19,7 @@ index b0bfdf9424..c6d2c30339 100644 + } } diff --git a/src/main/java/net/minecraft/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java -index 1a9391a382..3a9dfb9798 100644 +index fab5962e2..de7ac6c20 100644 --- a/src/main/java/net/minecraft/server/PersistentScoreboard.java +++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java @@ -0,0 +0,0 @@ public class PersistentScoreboard extends PersistentBase { diff --git a/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch b/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch deleted file mode 100644 index 593c6e1aac..0000000000 --- a/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -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 -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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(); --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch b/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch index f47108b386..0b74277aa7 100644 --- a/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch +++ b/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't tick Skulls - unused code diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 48fbcf863d..79c24cdc4c 100644 +index 369fdfe67..e827d7605 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java @@ -0,0 +0,0 @@ import com.mojang.authlib.ProfileLookupCallback; @@ -15,6 +15,6 @@ index 48fbcf863d..79c24cdc4c 100644 -public class TileEntitySkull extends TileEntity implements ITickable { +public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable - private GameProfile a; - private int e; + public GameProfile gameProfile; + private int b; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch b/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch index 3af7653ed9..3f2fc58720 100644 --- a/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch +++ b/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch @@ -4,24 +4,24 @@ Date: Mon, 28 Mar 2016 20:32:58 -0400 Subject: [PATCH] Entity AddTo/RemoveFrom World Events -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f94633cbe2..9371d83f1d 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 3bd624569..ab2ca1c32 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World { + this.I.add(((EntityInsentient) entity).getNavigation()); + } + entity.valid = true; // CraftBukkit ++ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid } - entity.valid = true; // CraftBukkit -+ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid } - - protected void c(Entity entity) { -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - ((IWorldAccess) this.v.get(i)).b(entity); - } - -+ new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid - entity.valid = false; // CraftBukkit - } - +@@ -0,0 +0,0 @@ public class WorldServer extends World { + if (this.tickingEntities) { + throw new IllegalStateException("Removing entity while ticking!"); + } else { ++ new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid + this.removeEntityFromChunk(entity); + this.entitiesById.remove(entity.getId()); + this.unregisterEntity(entity); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Entity-Tracking-Improvements.patch b/Spigot-Server-Patches/Entity-Tracking-Improvements.patch deleted file mode 100644 index dad35e6a7f..0000000000 --- a/Spigot-Server-Patches/Entity-Tracking-Improvements.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -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 -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ public class EntityTrackerEntry { - this.trackedPlayers.remove(entityplayer); - this.tracker.c(entityplayer); - entityplayer.c(this.tracker); -+ updatePassengers(entityplayer); // Paper - } - - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/EntityPathfindEvent.patch b/Spigot-Server-Patches/EntityPathfindEvent.patch index 465cbda011..296035afde 100644 --- a/Spigot-Server-Patches/EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/EntityPathfindEvent.patch @@ -6,32 +6,76 @@ Subject: [PATCH] EntityPathfindEvent Fires when an Entity decides to start moving to a location. diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 60b5068e32..604049b088 100644 +index 2ced8dedd..6ce35018a 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; public abstract class NavigationAbstract { -- protected EntityInsentient a; -+ protected EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER - protected World b; +- protected final EntityInsentient a; ++ protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER + protected final World b; @Nullable protected PathEntity c; @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { + return this.b(new BlockPosition(d0, d1, d2)); + } + ++ // Paper start - Add target entity parameter for path find event ++ @Nullable public PathEntity b(BlockPosition blockposition) { return this.b(blockposition, null); } + @Nullable +- public PathEntity b(BlockPosition blockposition) { ++ public PathEntity b(BlockPosition blockposition, Entity target) { ++ // Paper end + float f = (float) blockposition.getX() + 0.5F; + float f1 = (float) blockposition.getY() + 0.5F; + float f2 = (float) blockposition.getZ() + 0.5F; + +- return this.a(blockposition, (double) f, (double) f1, (double) f2, 8, false); ++ return this.a(blockposition, target, (double) f, (double) f1, (double) f2, 8, false); // Paper - Path find event + } + + @Nullable +@@ -0,0 +0,0 @@ public abstract class NavigationAbstract { + double d1 = entity.getBoundingBox().minY; + double d2 = entity.locZ; + +- return this.a(blockposition, d0, d1, d2, 16, true); ++ return this.a(blockposition, entity, d0, d1, d2, 16, true); // Paper - Path find event + } + ++ // Paper start - Add target entity parameter for path find event ++ @Nullable protected PathEntity a(BlockPosition blockposition, double d0, double d1, double d2, int i, boolean flag) { return this.a(blockposition, null, d0, d1, d2, i, flag); } + @Nullable +- protected PathEntity a(BlockPosition blockposition, double d0, double d1, double d2, int i, boolean flag) { ++ protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) { ++ // Paper end + if (!this.a()) { + return null; } else if (this.c != null && !this.c.b() && blockposition.equals(this.q)) { return this.c; } else { -+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(getEntity().world, blockposition), null).callEvent()) { return null; } // Paper ++ // Paper start - Pathfind event ++ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), ++ MCUtil.toLocation(getEntity().world, blockposition), target == null ? null : target.getBukkitEntity()).callEvent()) { ++ return null; ++ } ++ // Paper end this.q = blockposition; - float f = this.j(); + float f = this.i(); -@@ -0,0 +0,0 @@ public abstract class NavigationAbstract { - if (this.c != null && !this.c.b() && blockposition.equals(this.q)) { - return this.c; - } else { -+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(entity.world, blockposition), entity.getBukkitEntity()).callEvent()) { return null; } // Paper - this.q = blockposition; - float f = this.j(); +diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java +index 9dfca6067..551ff417b 100644 +--- a/src/main/java/net/minecraft/server/NavigationFlying.java ++++ b/src/main/java/net/minecraft/server/NavigationFlying.java +@@ -0,0 +0,0 @@ public class NavigationFlying extends NavigationAbstract { + @Override + public PathEntity a(Entity entity) { +- return this.b(new BlockPosition(entity)); ++ return this.b(new BlockPosition(entity), entity); // Paper - Pathfind event + } + + @Override -- \ No newline at end of file diff --git a/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch b/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch index a3428b536a..f433829fa4 100644 --- a/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch +++ b/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] EntityRegainHealthEvent isFastRegen API Don't even get me started diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 2454083b2d..e8f2f11c4d 100644 +index 5ae701488..780287f91 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -23,12 +23,12 @@ index 2454083b2d..e8f2f11c4d 100644 if (f1 > 0.0F) { - EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason); -+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper - Add isFastRegen - this.world.getServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { ++ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); + // Suppress during worldgen + if (this.valid) { + this.world.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java -index 03dbd21ee8..aed3606bdc 100644 +index da07530d9..d184422fb 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java @@ -0,0 +0,0 @@ public class FoodMetaData { diff --git a/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 20fa6aefef..9bea3f05e1 100644 --- a/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8a445a1fa3..b595536648 100644 +index 31e477430..845cabd29 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - } +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + public void m(BlockPosition blockposition) {} public void applyPhysics(BlockPosition blockposition, Block block) { + if (captureBlockStates) { return; } // Paper - Cancel all physics during placement diff --git a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch index 7177d45ddd..af274fe2ae 100644 --- a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch +++ b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix reducedDebugInfo not initialized on client diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index c2061e9596..6e62ea90dd 100644 +index f904e1c28..bf6cf1ce5 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -13,7 +13,7 @@ index c2061e9596..6e62ea90dd 100644 playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b())); playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry())); + playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean("reducedDebugInfo") ? 22 : 23))); // Paper - fix this rule not being initialized on the client - this.f(entityplayer); + this.d(entityplayer); entityplayer.getStatisticManager().c(); entityplayer.B().a(entityplayer); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch index c46ab41a8d..235a0f555d 100644 --- a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch +++ b/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Implement PlayerLocaleChangeEvent diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 2665faa6c5..7ed9903a8c 100644 +index dbb9a9a69..6b6c14567 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ import org.bukkit.inventory.MainHand; public class EntityPlayer extends EntityHuman implements ICrafting { - private static final Logger cc = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); - public String locale = "en_us"; // CraftBukkit - lowercase + public String locale = null; // CraftBukkit - lowercase // Paper - default to null public PlayerConnection playerConnection; @@ -36,11 +36,11 @@ index 2665faa6c5..7ed9903a8c 100644 + new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent(); + } + // Paper end - this.cs = packetplayinsettings.d(); - this.ct = packetplayinsettings.e(); - this.getDataWatcher().set(EntityPlayer.bx, (byte) packetplayinsettings.f()); + this.ck = packetplayinsettings.d(); + this.cl = packetplayinsettings.e(); + this.getDataWatcher().set(EntityPlayer.bt, (byte) packetplayinsettings.f()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ff9c2c04f3..59bfcce68d 100644 +index bc1b46484..4e12b6406 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index 27f698b2ab..f0bbbb66b4 100644 --- a/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -13,7 +13,7 @@ custom renderers are in use, defaulting to the much simpler Vanilla system. Additionally, numerous issues to player position tracking on maps has been fixed. diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index e97bb2305c..5e5a747e9f 100644 +index d0713bfcd..8a6f8e875 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -25,30 +25,18 @@ index e97bb2305c..5e5a747e9f 100644 + WorldMap worldmap = ItemWorldMap.getSavedMap(itemstack, this.world); + worldmap.updateSeenPlayers(this, itemstack); + } -+ // Paper stop ++ // Paper end - ItemStack itemstack1 = this.a(entityitem); - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 04ec2a0399..32ee298648 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - { - if ( iter.next().trackee == entity ) - { -+ map.decorations.remove(entity.getDisplayName().getString()); // Paper - iter.remove(); - } - } + return entityitem; + } diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java -index 5c09085a6b..a819d60375 100644 +index e080a77c7..98e4ad4ac 100644 --- a/src/main/java/net/minecraft/server/WorldMap.java +++ b/src/main/java/net/minecraft/server/WorldMap.java @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { - private final Map k = Maps.newHashMap(); - public Map decorations = Maps.newLinkedHashMap(); - private final Map l = Maps.newHashMap(); + private final Map l = Maps.newHashMap(); + public final Map decorations = Maps.newLinkedHashMap(); + private final Map m = Maps.newHashMap(); + private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper // CraftBukkit start @@ -62,7 +50,7 @@ index 5c09085a6b..a819d60375 100644 } @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { - this.k.put(mapiconbanner.f(), mapiconbanner); + this.l.put(mapiconbanner.f(), mapiconbanner); this.a(mapiconbanner.c(), (GeneratorAccess) null, mapiconbanner.f(), (double) mapiconbanner.a().getX(), (double) mapiconbanner.a().getZ(), 180.0D, mapiconbanner.d()); } + vanillaRender.buffer = colors; // Paper @@ -70,10 +58,10 @@ index 5c09085a6b..a819d60375 100644 NBTTagList nbttaglist1 = nbttagcompound.getList("frames", 10); @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { - return nbttagcompound; + this.b(); } -+ public void updateSeenPlayers(EntityHuman entityhuman, ItemStack itemstack) { a(entityhuman, itemstack); } // Paper - OBFHELPER ++ public void updateSeenPlayers(EntityHuman entityhuman, ItemStack itemstack) { this.a(entityhuman, itemstack); } // Paper - OBFHELPER public void a(EntityHuman entityhuman, ItemStack itemstack) { if (!this.humans.containsKey(entityhuman)) { WorldMap.WorldMapHumanTracker worldmap_worldmaphumantracker = new WorldMap.WorldMapHumanTracker(entityhuman); @@ -95,7 +83,7 @@ index 5c09085a6b..a819d60375 100644 + private boolean shouldUseVanillaMap() { + return mapView.getRenderers().size() == 1 && mapView.getRenderers().get(0).getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class; + } -+ // Paper stop ++ // Paper end public final EntityHuman trackee; private boolean d = true; private int e; @@ -113,8 +101,20 @@ index 5c09085a6b..a819d60375 100644 for ( org.bukkit.map.MapCursor cursor : render.cursors) { +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index ab2ca1c32..1e718e4db 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World { + { + if ( iter.next().trackee == entity ) + { ++ map.decorations.remove(entity.getDisplayName().getString()); // Paper + iter.remove(); + } + } diff --git a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java -index 256a131781..5768cd512e 100644 +index 256a13178..5768cd512 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java +++ b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java @@ -0,0 +0,0 @@ import org.bukkit.map.MapCursor; diff --git a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch index 4d1e0033ee..592c0d513e 100644 --- a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch @@ -11,7 +11,7 @@ This feature is good for long term worlds so that newer players do not suffer with "Every chest has been looted" diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 52a6ff8554..720b87a5ec 100644 +index 377f4983b..805aa5699 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -43,7 +43,7 @@ index 52a6ff8554..720b87a5ec 100644 } diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java new file mode 100644 -index 0000000000..d6fce3112e +index 000000000..d6fce3112 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java @@ -0,0 +0,0 @@ @@ -82,7 +82,7 @@ index 0000000000..d6fce3112e +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java new file mode 100644 -index 0000000000..5e637782d5 +index 000000000..5e637782d --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java @@ -0,0 +0,0 @@ @@ -116,7 +116,7 @@ index 0000000000..5e637782d5 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java new file mode 100644 -index 0000000000..856843fc91 +index 000000000..856843fc9 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java @@ -0,0 +0,0 @@ @@ -193,7 +193,7 @@ index 0000000000..856843fc91 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java new file mode 100644 -index 0000000000..b5401eaf97 +index 000000000..b5401eaf9 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java @@ -0,0 +0,0 @@ @@ -378,7 +378,7 @@ index 0000000000..b5401eaf97 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java new file mode 100644 -index 0000000000..f9fbc221bd +index 000000000..f9fbc221b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java @@ -0,0 +0,0 @@ @@ -448,7 +448,7 @@ index 0000000000..f9fbc221bd +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java new file mode 100644 -index 0000000000..d50410532c +index 000000000..d50410532 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java @@ -0,0 +0,0 @@ @@ -520,7 +520,7 @@ index 0000000000..d50410532c + } +} diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index dba97f2305..c9b37727ff 100644 +index 5744760ac..3dcd93e5e 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -532,29 +532,29 @@ index dba97f2305..c9b37727ff 100644 public CraftEntity getBukkitEntity() { diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -index 520cca48cc..e228fc8538 100644 +index 66826da45..b84a70edb 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java +++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java @@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp - private NonNullList items; - private boolean b; -- private MinecraftKey c; -+ private MinecraftKey c; public MinecraftKey getLootTableKey() { return c; } public void setLootTable(MinecraftKey key) { c = key; } // Paper - OBFHELPER + private boolean c; + @Nullable +- public MinecraftKey lootTable; ++ public MinecraftKey lootTable; public MinecraftKey getLootTableKey() { return this.lootTable; } public void setLootTable(final MinecraftKey key) { this.lootTable = key; } // Paper - OBFHELPER public long lootTableSeed; // CraftBukkit start -+ { lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperMinecartLootableInventory(this)); } // Paper ++ { this.lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperMinecartLootableInventory(this)); } // Paper public List transaction = new java.util.ArrayList(); private int maxStack = MAX_STACK; @@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp - + @Override protected void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); -+ lootableData.saveNbt(nbttagcompound); // Paper - if (this.c != null) { - nbttagcompound.setString("LootTable", this.c.toString()); ++ this.lootableData.saveNbt(nbttagcompound); // Paper + if (this.lootTable != null) { + nbttagcompound.setString("LootTable", this.lootTable.toString()); if (this.lootTableSeed != 0L) { nbttagcompound.setLong("LootTableSeed", this.lootTableSeed); } @@ -564,13 +564,13 @@ index 520cca48cc..e228fc8538 100644 } @@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp - + @Override protected void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); -+ lootableData.loadNbt(nbttagcompound); // Paper ++ this.lootableData.loadNbt(nbttagcompound); // Paper this.items = NonNullList.a(this.getSize(), ItemStack.a); if (nbttagcompound.hasKeyOfType("LootTable", 8)) { - this.c = new MinecraftKey(nbttagcompound.getString("LootTable")); + this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable")); this.lootTableSeed = nbttagcompound.getLong("LootTableSeed"); - } else { + } if (true) { // Paper - always load the items, table may still remain @@ -580,41 +580,40 @@ index 520cca48cc..e228fc8538 100644 @@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp } - public void f(@Nullable EntityHuman entityhuman) { -- if (this.c != null && this.world.getMinecraftServer() != null) { -+ if (lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper - LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.c); + public void d(@Nullable EntityHuman entityhuman) { +- if (this.lootTable != null && this.world.getMinecraftServer() != null) { ++ if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper + LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable); -- this.c = null; -+ lootableData.processRefill(entityhuman); // Paper - Random random; +- this.lootTable = null; ++ this.lootableData.processRefill(entityhuman); // Paper + LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this)).a(this.lootTableSeed); - if (this.lootTableSeed == 0L) { + if (entityhuman != null) { diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index 961d9a5f99..60f0b5046a 100644 +index 56c7f9b4e..a12d49fc4 100644 --- a/src/main/java/net/minecraft/server/TileEntityLootable.java +++ b/src/main/java/net/minecraft/server/TileEntityLootable.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; + public abstract class TileEntityLootable extends TileEntityContainer { - public abstract class TileEntityLootable extends TileEntityContainer implements ILootable { - -- protected MinecraftKey g; -- protected long h; -+ protected MinecraftKey g; public MinecraftKey getLootTableKey() { return g; } public void setLootTable(MinecraftKey key) { g = key; } // Paper - OBFHELPER -+ protected long h; public long getSeed() { return h; } public void setSeed(long seed) { h = seed; } // Paper - OBFHELPER - protected IChatBaseComponent i; + @Nullable +- public MinecraftKey lootTable; +- public long lootTableSeed; ++ public MinecraftKey lootTable; public MinecraftKey getLootTableKey() { return this.lootTable; } public void setLootTable(final MinecraftKey key) { this.lootTable = key; } // Paper - OBFHELPER ++ public long lootTableSeed; public long getSeed() { return this.lootTableSeed; } public void setSeed(final long seed) { this.lootTableSeed = seed; } // Paper - OBFHELPER + public final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperTileEntityLootableInventory(this)); // Paper protected TileEntityLootable(TileEntityTypes tileentitytypes) { super(tileentitytypes); -@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer implements +@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer { } protected boolean d(NBTTagCompound nbttagcompound) { -+ lootableData.loadNbt(nbttagcompound); // Paper ++ this.lootableData.loadNbt(nbttagcompound); // Paper if (nbttagcompound.hasKeyOfType("LootTable", 8)) { - this.g = new MinecraftKey(nbttagcompound.getString("LootTable")); - this.h = nbttagcompound.getLong("LootTableSeed"); + this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable")); + this.lootTableSeed = nbttagcompound.getLong("LootTableSeed"); - return true; + return false; // Paper - always load the items, table may still remain } else { @@ -623,12 +622,12 @@ index 961d9a5f99..60f0b5046a 100644 } protected boolean e(NBTTagCompound nbttagcompound) { -+ lootableData.saveNbt(nbttagcompound); // Paper - if (this.g == null) { ++ this.lootableData.saveNbt(nbttagcompound); // Paper + if (this.lootTable == null) { return false; } else { -@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer implements - nbttagcompound.setLong("LootTableSeed", this.h); +@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer { + nbttagcompound.setLong("LootTableSeed", this.lootTableSeed); } - return true; @@ -637,17 +636,17 @@ index 961d9a5f99..60f0b5046a 100644 } public void d(@Nullable EntityHuman entityhuman) { -- if (this.g != null && this.world.getMinecraftServer() != null) { -+ if (lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper - LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.g); +- if (this.lootTable != null && this.world.getMinecraftServer() != null) { ++ if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper + LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable); -- this.g = null; -+ lootableData.processRefill(entityhuman); // Paper - Random random; +- this.lootTable = null; ++ this.lootableData.processRefill(entityhuman); // Paper + LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this.position)).a(this.lootTableSeed); - if (this.h == 0L) { + if (entityhuman != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 8617fac6b0..4f4121adca 100644 +index 8617fac6b..4f4121adc 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -0,0 +0,0 @@ public class CraftBlockEntityState extends CraftBlockState @@ -660,7 +659,7 @@ index 8617fac6b0..4f4121adca 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java -index fa03d17a4c..14b5be75f3 100644 +index 0e8f1a89f..18c80b35b 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftWorld; @@ -675,7 +674,7 @@ index fa03d17a4c..14b5be75f3 100644 public CraftChest(final Block block) { super(block, TileEntityChest.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java -index 7ef68bb626..daf183fb10 100644 +index e1ad26a24..678aa09d4 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java @@ -0,0 +0,0 @@ @@ -704,7 +703,7 @@ index 7ef68bb626..daf183fb10 100644 getSnapshot().setLootTable(key, seed); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java -index 1b5b266c05..e0b99207b2 100644 +index 9225082bd..3f82a7957 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java @@ -0,0 +0,0 @@ @@ -712,8 +711,8 @@ index 1b5b266c05..e0b99207b2 100644 +import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper import net.minecraft.server.EntityMinecartChest; - import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.craftbukkit.inventory.CraftInventory; @@ -0,0 +0,0 @@ import org.bukkit.entity.minecart.StorageMinecart; import org.bukkit.inventory.Inventory; @@ -724,7 +723,7 @@ index 1b5b266c05..e0b99207b2 100644 public CraftMinecartChest(CraftServer server, EntityMinecartChest entity) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java -index 87303ecd13..6790fa2fee 100644 +index 2d776b520..fcc978784 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java @@ -0,0 +0,0 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo @@ -734,10 +733,10 @@ index 87303ecd13..6790fa2fee 100644 - private void setLootTable(LootTable table, long seed) { + public void setLootTable(LootTable table, long seed) { // Paper MinecraftKey newKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey()); - getHandle().a(newKey, seed); + getHandle().setLootTable(newKey, seed); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java -index f29365c948..1937f7b9a2 100644 +index 44b3418b1..d56cbeac4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java @@ -0,0 +0,0 @@ @@ -745,8 +744,8 @@ index f29365c948..1937f7b9a2 100644 +import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper import net.minecraft.server.EntityMinecartHopper; - import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.craftbukkit.inventory.CraftInventory; @@ -0,0 +0,0 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.minecart.HopperMinecart; import org.bukkit.inventory.Inventory; diff --git a/Spigot-Server-Patches/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/Spigot-Server-Patches/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index c1b6619fe2..da6378f105 100644 --- a/Spigot-Server-Patches/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/Spigot-Server-Patches/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener Saves on some object allocation and processing when no plugin listens to this diff --git a/src/main/java/net/minecraft/server/BlockPlant.java b/src/main/java/net/minecraft/server/BlockPlant.java -index 0e4037ea21..317ae16347 100644 +index 9bf42bb5e..0526af776 100644 --- a/src/main/java/net/minecraft/server/BlockPlant.java +++ b/src/main/java/net/minecraft/server/BlockPlant.java @@ -0,0 +0,0 @@ public class BlockPlant extends Block { @@ -19,11 +19,11 @@ index 0e4037ea21..317ae16347 100644 } } diff --git a/src/main/java/net/minecraft/server/BlockTallPlant.java b/src/main/java/net/minecraft/server/BlockTallPlant.java -index 77782bf1c1..39d449c28e 100644 +index 469a3be05..f2c429f22 100644 --- a/src/main/java/net/minecraft/server/BlockTallPlant.java +++ b/src/main/java/net/minecraft/server/BlockTallPlant.java @@ -0,0 +0,0 @@ public class BlockTallPlant extends BlockPlant { - + @Override public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { // CraftBukkit start - if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { @@ -32,22 +32,22 @@ index 77782bf1c1..39d449c28e 100644 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f488c37f73..ee45d3705b 100644 +index 4e97e74a2..c5359ae24 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper i = SystemUtils.getMonotonicNanos(); if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit this.methodProfiler.a(() -> { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f4e91db7c6..f94633cbe2 100644 +index 78d1a5c71..7d6893cee 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose // CraftBukkit start iblockdata1.b(this, blockposition, j); // Don't call an event for the old block to limit event spam CraftWorld world = ((WorldServer) this).getWorld(); @@ -56,7 +56,7 @@ index f4e91db7c6..f94633cbe2 100644 BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); this.getServer().getPluginManager().callEvent(event); -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose try { // CraftBukkit start CraftWorld world = ((WorldServer) this).getWorld(); @@ -66,15 +66,15 @@ index f4e91db7c6..f94633cbe2 100644 this.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index aaeb888a8c..639068d2dc 100644 +index 9a4a55846..3bd624569 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ import org.bukkit.event.weather.LightningStrikeEvent; - public class WorldServer extends World implements IAsyncTaskHandler { - - private static final Logger a = LogManager.getLogger(); +@@ -0,0 +0,0 @@ public class WorldServer extends World { + // CraftBukkit start + public final DimensionManager dimension; + private int tickPosition; + boolean hasPhysicsEvent = true; // Paper - private final MinecraftServer server; - public EntityTracker tracker; - private final PlayerChunkMap manager; + + // Add env and gen to constructor + public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 1e629f3fdf..5db7bc22e0 100644 --- a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -12,7 +12,7 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index 5843ef65af..4c7793f86d 100644 +index 2852a17f2..7cb46d7a9 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java @@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable { @@ -31,10 +31,10 @@ index 5843ef65af..4c7793f86d 100644 public BaseBlockPosition(int i, int j, int k) { this.a = i; diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 9bb7c9c652..bc364ce371 100644 +index c927d524a..64700b97c 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { +@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali protected int b; protected int c; protected int d; @@ -52,22 +52,24 @@ index 9bb7c9c652..bc364ce371 100644 public MutableBlockPosition() { this(0, 0, 0); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 3f9de7e55a..b76c1579ea 100644 +index 9433d04f4..98ec98e02 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - return this.getBlockData(i, j, k).b(this.world, new BlockPosition(i, j, k)); + return this.sections; } -- public IBlockData getBlockData(BlockPosition blockposition) { return getType(blockposition); } // Paper +- @Override - public IBlockData getType(BlockPosition blockposition) { +- int i = blockposition.getX(); +- int j = blockposition.getY(); +- int k = blockposition.getZ(); + // Paper start - Optimize getBlockData to reduce instructions + public final IBlockData getBlockData(BlockPosition pos) { return getBlockData(pos.getX(), pos.getY(), pos.getZ()); } // Paper + public final IBlockData getType(BlockPosition blockposition) { - return this.getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ()); - } ++ return this.getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ()); ++ } -- public IBlockData getBlockData(int i, int j, int k) { + public final IBlockData getBlockData(final int x, final int y, final int z) { + // Method body / logic copied from below + final int i = y >> 4; @@ -80,124 +82,38 @@ index 3f9de7e55a..b76c1579ea 100644 + + public IBlockData getBlockData_unused(int i, int j, int k) { + // Paper end - if (this.world.S() == WorldType.DEBUG_ALL_BLOCK_STATES) { + if (this.world.P() == WorldType.DEBUG_ALL_BLOCK_STATES) { IBlockData iblockdata = null; diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 3c5f10ad4d..621ed1fc53 100644 +index c973ab607..0d7eab0e0 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -0,0 +0,0 @@ public class ChunkSection { - private int nonEmptyBlockCount; - private int tickingBlockCount; - private int e; + private short nonEmptyBlockCount; + private short tickingBlockCount; + private short e; - private final DataPaletteBlock blockIds; + final DataPaletteBlock blockIds; // Paper - package - private NibbleArray emittedLight; - private NibbleArray skyLight; + public ChunkSection(int i) { + this(i, (short) 0, (short) 0, (short) 0); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index fd45090685..f4e91db7c6 100644 +index cdc5d7009..78d1a5c71 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose } public static boolean isValidLocation(BlockPosition blockposition) { -- return !k(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000; +- return !isInsideWorld(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000; + return blockposition.isValidLocation(); // Paper } - public static boolean k(BlockPosition blockposition) { -- return blockposition.getY() < 0 || blockposition.getY() >= 256; + public static boolean isInsideWorld(BlockPosition blockposition) { +- return b(blockposition.getY()); + return blockposition.isInvalidYLocation(); // Paper } - public boolean isEmpty(BlockPosition blockposition) { -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - // test if meets light level, return faster - // logic copied from below - public boolean isLightLevel(BlockPosition blockposition, int level) { -- if (isValidLocation(blockposition)) { -+ if (blockposition.isValidLocation()) { - if (this.getType(blockposition).c(this, blockposition)) { - int sky = getSkylightSubtracted(); - if (this.getLightLevel(blockposition.up(), sky) >= level) { -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - // CraftBukkit end - Chunk chunk = this.getChunkIfLoaded(blockposition); - if (chunk != null) { -- return isValidLocation(blockposition) ? chunk.getBlockData(blockposition) : Blocks.AIR.getBlockData(); -+ return blockposition.isValidLocation() ? chunk.getBlockData(blockposition) : Blocks.AIR.getBlockData(); // Paper - } - return null; - } -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - return true; - } - // CraftBukkit end -- if (k(blockposition)) { -+ if (blockposition.isInvalidYLocation()) { // Paper - return false; - } else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { - return false; -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - blockposition = new BlockPosition(blockposition.getX(), 0, blockposition.getZ()); - } - -- return !isValidLocation(blockposition) ? enumskyblock.c : (!this.isLoaded(blockposition) ? enumskyblock.c : this.getChunkAtWorldCoords(blockposition).getBrightness(enumskyblock, blockposition)); -+ return !blockposition.isValidLocation() ? enumskyblock.c : (!this.isLoaded(blockposition) ? enumskyblock.c : this.getChunkAtWorldCoords(blockposition).getBrightness(enumskyblock, blockposition)); // Paper - } - - public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) { -- if (isValidLocation(blockposition)) { -+ if (blockposition.isValidLocation()) { // Paper - if (this.isLoaded(blockposition)) { - this.getChunkAtWorldCoords(blockposition).a(enumskyblock, blockposition, i); - this.m(blockposition); -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - } - } - // CraftBukkit end -- if (k(blockposition)) { -+ if (blockposition.isInvalidYLocation()) { // Paper - return Blocks.VOID_AIR.getBlockData(); - } else { - Chunk chunk = this.getChunkAtWorldCoords(blockposition); -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - } - - public Fluid getFluid(BlockPosition blockposition) { -- if (k(blockposition)) { -+ if (blockposition.isInvalidYLocation()) { // Paper - return FluidTypes.EMPTY.i(); - } else { - Chunk chunk = this.getChunkAtWorldCoords(blockposition); -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - public Map capturedTileEntities = Maps.newHashMap(); - @Nullable - public TileEntity getTileEntity(BlockPosition blockposition) { -- if (k(blockposition)) { -+ if (blockposition.isInvalidYLocation()) { // Paper - return null; - } else { - // CraftBukkit start -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - } - - public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { -- if (!k(blockposition)) { -+ if (!blockposition.isInvalidYLocation()) { // Paper - if (tileentity != null && !tileentity.x()) { - // CraftBukkit start - if (captureBlockStates) { -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - } - - public boolean p(BlockPosition blockposition) { -- if (k(blockposition)) { -+ if (blockposition.isInvalidYLocation()) { // Paper - return false; - } else { - Chunk chunk = this.chunkProvider.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4, false, false); + public static boolean b(int i) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index d6bf244f14..54faed8b32 100644 --- a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -12,12 +12,12 @@ for this on CB at one point but I can't find it. We may need to do this ourselves at some point in the future. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 260c55016e..37cc057ab7 100644 +index 59d11e68c..1da7ffab5 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16); - log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16)); + grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate)); + log("Grass Spread Tick Rate: " + grassUpdateRate); } + + public boolean useVanillaScoreboardColoring; @@ -26,10 +26,10 @@ index 260c55016e..37cc057ab7 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 545899fc29..66aa3bde64 100644 +index 7b8caa0b9..42eac6b71 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { return; } @@ -48,16 +48,16 @@ index 545899fc29..66aa3bde64 100644 if (((LazyPlayerSet) event.getRecipients()).isLazy()) { for (Object recipient : minecraftServer.getPlayerList().players) { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 6e62ea90dd..5236948990 100644 +index bf6cf1ce5..b3343fca2 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { } - + // CraftBukkit start chatmessage.a(EnumChatFormat.YELLOW); -- this.onPlayerJoin(entityplayer, CraftChatMessage.fromComponent(chatmessage)); -+ this.onPlayerJoin(entityplayer, CraftChatMessage.fromComponent(chatmessage, EnumChatFormat.WHITE)); // Paper - // CraftBukkit end - worldserver = server.getWorldServer(entityplayer.dimension); // CraftBukkit - Update in case join event changed it +- String joinMessage = CraftChatMessage.fromComponent(chatmessage); ++ String joinMessage = CraftChatMessage.fromComponent(chatmessage, EnumChatFormat.WHITE); + playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); + this.players.add(entityplayer); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch b/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch index 7e3c1ee240..68bdd284e3 100644 --- a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch @@ -7,13 +7,13 @@ This causes the nether to spam unload/reload chunks, plus overall bad behavior. diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java -index e09a586977..3f421d46a0 100644 +index 2e46ba44a..73190ccba 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -0,0 +0,0 @@ public class BlockFire extends Block { } - blockposition_mutableblockposition.g(blockposition).d(l, j1, i1); + blockposition_mutableblockposition.g(blockposition).e(l, j1, i1); + if (!world.isLoaded(blockposition_mutableblockposition)) continue; // Paper int l1 = this.a((IWorldReader) world, (BlockPosition) blockposition_mutableblockposition); @@ -22,11 +22,13 @@ index e09a586977..3f421d46a0 100644 } private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition -- int k = this.f(world.getType(blockposition).getBlock()); +- int k = this.q(world.getType(blockposition)); + // Paper start + final IBlockData iblockdata = world.getTypeIfLoaded(blockposition); -+ if (iblockdata == null) return; -+ int k = this.f(iblockdata.getBlock()); ++ if (iblockdata == null) { ++ return; ++ } ++ int k = this.q(iblockdata); + // Paper end if (random.nextInt(i) < k) { @@ -36,16 +38,18 @@ index e09a586977..3f421d46a0 100644 // CraftBukkit start org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); @@ -0,0 +0,0 @@ public class BlockFire extends Block { + for (int k = 0; k < j; ++k) { EnumDirection enumdirection = aenumdirection[k]; - -- i = Math.max(this.g(iworldreader.getType(blockposition.shift(enumdirection)).getBlock()), i); +- IBlockData iblockdata = iworldreader.getType(blockposition.shift(enumdirection)); +- + // Paper start -+ final IBlockData type = ((World)iworldreader).getTypeIfLoaded(blockposition.shift(enumdirection)); -+ if (type == null) continue; -+ i = Math.max(this.g(type.getBlock()), i); ++ IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition.shift(enumdirection)); ++ if (iblockdata == null) { ++ continue; ++ } + // Paper end + i = Math.max(this.r(iblockdata), i); } - return i; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch b/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch index e99dbcb30c..a64270ee55 100644 --- a/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch +++ b/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch @@ -5,35 +5,46 @@ Subject: [PATCH] Reduce IO ops opening a new region file. diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 9626396745..e2d4450e90 100644 +index b062a31c4..4e6288e8b 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -0,0 +0,0 @@ public class RegionFile { - this.c.seek(0L); +@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { + private final File file; + // Spigot end + private static final byte[] a = new byte[4096]; +- private final RandomAccessFile b; ++ private final RandomAccessFile b; private RandomAccessFile getDataFile() { return this.b; } // Paper - OBFHELPER + private final int[] c = new int[1024]; + private final int[] d = new int[1024]; + private final List e; +@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { + this.e.set(1, false); + this.b.seek(0L); - int k; -+ // Paper Start -+ java.nio.ByteBuffer header = java.nio.ByteBuffer.allocate(8192); -+ while (header.hasRemaining()) { -+ if (this.c.getChannel().read(header) == -1) throw new java.io.EOFException(); -+ } -+ header.clear(); -+ java.nio.IntBuffer headerAsInts = header.asIntBuffer(); -+ // Paper End ++ // Paper Start ++ java.nio.ByteBuffer header = java.nio.ByteBuffer.allocate(8192); ++ while (header.hasRemaining()) { ++ if (this.getDataFile().getChannel().read(header) == -1) throw new java.io.EOFException(); ++ } ++ header.clear(); ++ java.nio.IntBuffer headerAsInts = header.asIntBuffer(); ++ // Paper End ++ + int k; - for (j = 0; j < 1024; ++j) { -- k = this.c.readInt(); -+ k = headerAsInts.get(); // Paper - this.d[j] = k; - // Spigot start - int length = k & 255; -@@ -0,0 +0,0 @@ public class RegionFile { - } + for (j = 0; j < 1024; ++j) { +- k = this.b.readInt(); ++ k = headerAsInts.get(); // Paper + this.c[j] = k; + // Spigot start + int length = k & 255; +@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { + } + + for (j = 0; j < 1024; ++j) { +- k = this.b.readInt(); ++ k = headerAsInts.get(); // Paper + this.d[j] = k; + } - for (j = 0; j < 1024; ++j) { -- k = this.c.readInt(); -+ k = headerAsInts.get(); // Paper - this.e[j] = k; - } - } catch (IOException ioexception) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch b/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch index 8f9ce83148..18e39bc4e0 100644 --- a/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch +++ b/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch @@ -9,7 +9,7 @@ Before: http://i.imgur.com/nQsMzAE.png After: http://i.imgur.com/nJ46crB.png diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 9e83610f1a..fe5947b6cc 100644 +index 409dc837c..4194acc8b 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -0,0 +0,0 @@ public class DataBits { @@ -24,14 +24,25 @@ index 9e83610f1a..fe5947b6cc 100644 @@ -0,0 +0,0 @@ public class DataBits { } - public void a(int i, int j) { + public int a(int i, int j) { - Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); - Validate.inclusiveBetween(0L, this.c, (long) j); + //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper + //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper int k = i * this.b; - int l = k / 64; - int i1 = ((i + 1) * this.b - 1) / 64; + int l = k >> 6; + int i1 = (i + 1) * this.b - 1 >> 6; +@@ -0,0 +0,0 @@ public class DataBits { + } + + public void b(int i, int j) { +- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); +- Validate.inclusiveBetween(0L, this.c, (long) j); ++ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper ++ //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper + int k = i * this.b; + int l = k >> 6; + int i1 = (i + 1) * this.b - 1 >> 6; @@ -0,0 +0,0 @@ public class DataBits { } @@ -39,6 +50,6 @@ index 9e83610f1a..fe5947b6cc 100644 - Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); + //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper int j = i * this.b; - int k = j / 64; - int l = ((i + 1) * this.b - 1) / 64; + int k = j >> 6; + int l = (i + 1) * this.b - 1 >> 6; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch b/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch index 6f148a359c..8e855d59cf 100644 --- a/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch @@ -6,49 +6,22 @@ Subject: [PATCH] Remove unused World Tile Entity List Massive hit to performance and it is completely unnecessary. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 5fc2da0d92..04ec2a0399 100644 +index 845cabd29..5637c3872 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - }; - // Spigot end - protected final Set g = com.google.common.collect.Sets.newHashSet(); // Paper +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + + protected static final Logger LOGGER = LogManager.getLogger(); + private static final EnumDirection[] a = EnumDirection.values(); - public final List tileEntityList = Lists.newArrayList(); + //public final List tileEntityList = Lists.newArrayList(); // Paper - remove unused list public final List tileEntityListTick = Lists.newArrayList(); - private final List c = Lists.newArrayList(); - private final Set tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); // Paper -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - timings.tileEntityTick.startTiming(); // Spigot - if (!this.tileEntityListUnload.isEmpty()) { - this.tileEntityListTick.removeAll(this.tileEntityListUnload); -- this.tileEntityList.removeAll(this.tileEntityListUnload); -+ //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list - this.tileEntityListUnload.clear(); + protected final List tileEntityListPending = Lists.newArrayList(); + protected final java.util.Set tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); // Paper +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + }, tileentity::getPosition}); } -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - if (tileentity.x()) { - tilesThisCycle--; - this.tileEntityListTick.remove(tileTickPosition--); -- this.tileEntityList.remove(tileentity); -+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list - if (this.isLoaded(tileentity.getPosition())) { - this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition()); - } -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3); - // CraftBukkit start - // From above, don't screw this up - SPIGOT-1746 -- if (!this.tileEntityList.contains(tileentity1)) { -+ if (true) { // Paper - remove unused list - this.a(tileentity1); - } - // CraftBukkit end -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - protected void p_() {} - - public boolean a(TileEntity tileentity) { - boolean flag = this.tileEntityList.add(tileentity); + boolean flag = true; // Paper - remove unused list @@ -57,10 +30,37 @@ index 5fc2da0d92..04ec2a0399 100644 this.tileEntityListTick.add(tileentity); } -@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + timings.tileEntityTick.startTiming(); // Spigot + if (!this.tileEntityListUnload.isEmpty()) { + this.tileEntityListTick.removeAll(this.tileEntityListUnload); +- this.tileEntityList.removeAll(this.tileEntityListUnload); ++ //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list + this.tileEntityListUnload.clear(); + } + +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + tilesThisCycle--; + this.tileEntityListTick.remove(tileTickPosition--); + // Spigot end +- this.tileEntityList.remove(tileentity); ++ //this.tileEntityList.remove(tileentity); // Paper - remove unused list + if (this.isLoaded(tileentity.getPosition())) { + this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition()); + } +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3); + // CraftBukkit start + // From above, don't screw this up - SPIGOT-1746 +- if (!this.tileEntityList.contains(tileentity1)) { ++ if (true) { // Paper - remove unused list + this.a(tileentity1); + } + // CraftBukkit end +@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose } else { if (tileentity != null) { - this.c.remove(tileentity); + this.tileEntityListPending.remove(tileentity); - this.tileEntityList.remove(tileentity); + //this.tileEntityList.remove(tileentity); // Paper - remove unused list this.tileEntityListTick.remove(tileentity); diff --git a/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch b/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch index 75a2d6eefb..c0713b5ffd 100644 --- a/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch +++ b/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch @@ -11,7 +11,7 @@ The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap). The maximum size of the RegionFileCache is also made configurable. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index e4ba7146d1..06c53af2c5 100644 +index 809b3a1a4..e929ba452 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { @@ -25,53 +25,24 @@ index e4ba7146d1..06c53af2c5 100644 + } } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 5dbd1d517a..964996976a 100644 +index 75731c919..c8573a8ee 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -0,0 +0,0 @@ import java.io.IOException; - import java.util.Iterator; - import java.util.Map; +@@ -0,0 +0,0 @@ import java.io.DataOutputStream; + import java.io.File; + import java.io.IOException; import javax.annotation.Nullable; +import com.destroystokyo.paper.PaperConfig; // Paper -+import java.util.LinkedHashMap; // Paper - public class RegionFileCache { + public abstract class RegionFileCache implements AutoCloseable { -- public static final Map cache = Maps.newHashMap(); -+ public static final Map cache = new LinkedHashMap(PaperConfig.regionFileCacheSize, 0.75f, true); // Paper - HashMap -> LinkedHashMap - - public static synchronized RegionFile a(File file, int i, int j) { - File file1 = new File(file, "region"); -@@ -0,0 +0,0 @@ public class RegionFileCache { +@@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable { + if (regionfile != null) { + return regionfile; + } else { +- if (this.cache.size() >= 256) { ++ if (this.cache.size() >= PaperConfig.regionFileCacheSize) { + this.cache.removeLast(); } - if (RegionFileCache.cache.size() >= 256) { -- a(); -+ trimCache(); - } - - RegionFile regionfile1 = new RegionFile(file2); -@@ -0,0 +0,0 @@ public class RegionFileCache { - } - // CraftBukkit end - -+ // Paper Start -+ private static synchronized void trimCache() { -+ Iterator> itr = RegionFileCache.cache.entrySet().iterator(); -+ int count = RegionFileCache.cache.size() - PaperConfig.regionFileCacheSize; -+ while (count-- >= 0 && itr.hasNext()) { -+ try { -+ itr.next().getValue().close(); -+ } catch (IOException ioexception) { -+ ioexception.printStackTrace(); -+ ServerInternalException.reportInternalException(ioexception); -+ } -+ itr.remove(); -+ } -+ } -+ // Paper End -+ - public static synchronized void a() { - Iterator iterator = RegionFileCache.cache.values().iterator(); - -- \ No newline at end of file diff --git a/Spigot-Server-Patches/System-property-for-disabling-watchdoge.patch b/Spigot-Server-Patches/System-property-for-disabling-watchdoge.patch index 758a8641ff..cfe394199c 100644 --- a/Spigot-Server-Patches/System-property-for-disabling-watchdoge.patch +++ b/Spigot-Server-Patches/System-property-for-disabling-watchdoge.patch @@ -5,7 +5,7 @@ Subject: [PATCH] System property for disabling watchdoge diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index c080a61185..0117c3d3de 100644 +index 56f5f54bd..9532aada8 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -0,0 +0,0 @@ public class WatchdogThread extends Thread diff --git a/Spigot-Server-Patches/Use-Optimized-Collections.patch b/Spigot-Server-Patches/Use-Optimized-Collections.patch index befc639239..34a0ecbdec 100644 --- a/Spigot-Server-Patches/Use-Optimized-Collections.patch +++ b/Spigot-Server-Patches/Use-Optimized-Collections.patch @@ -13,7 +13,7 @@ These collections are super fast as seen http://java-performance.info/hashmap-overview-jdk-fastutil-goldman-sachs-hppc-koloboke-trove-january-2015/ diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index b8fd774956..51a02edf83 100644 +index 79a240cd1..6c259effb 100644 --- a/src/main/java/net/minecraft/server/DataWatcher.java +++ b/src/main/java/net/minecraft/server/DataWatcher.java @@ -0,0 +0,0 @@ import java.util.Map; @@ -25,7 +25,7 @@ index b8fd774956..51a02edf83 100644 import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -0,0 +0,0 @@ public class DataWatcher { - private static final Logger a = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); private static final Map, Integer> b = Maps.newHashMap(); private final Entity c; - private final Map> d = Maps.newHashMap(); diff --git a/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch b/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch index 8b3c0a501f..10475b310d 100644 --- a/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch +++ b/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Workaround for setting passengers on players SPIGOT-1915 & GH-114 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d0f8ad0b69..ff9c2c04f3 100644 +index e866480f0..bc1b46484 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch b/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch index 686e3c0c50..6ae2456c22 100644 --- a/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch +++ b/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch @@ -6,32 +6,31 @@ Subject: [PATCH] remove null possibility for getServer singleton to stop IDE complaining about potential NPE diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b87520d834..78b60d0e35 100644 +index 43cd6d2c6..cddb4311a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ import co.aikar.timings.MinecraftTimings; // Paper - public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable { + public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable { + private static MinecraftServer SERVER; // Paper public static final Logger LOGGER = LogManager.getLogger(); - public static final File a = new File("usercache.json"); - public Convertable convertable; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati - // Spigot end + public static final File b = new File("usercache.json"); + public static final WorldSettings c = (new WorldSettings((long) "North Carolina".hashCode(), EnumGamemode.SURVIVAL, true, false, WorldType.NORMAL)).a(); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant(ResourcePackLoader::new); - this.ag = new CraftingManager(); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati - // CraftBukkit start + this.ai = new CraftingManager(); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant