From 36873bf2d6b8c8fd0297caa3f846678ef283a3fd 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) --- .../0053-Add-exception-reporting-event.patch | 33 ++- .../0065-Add-World-Util-Methods.patch | 12 +- ...Location-getType-and-getBlockData-fo.patch | 121 +++++++++++ ... 0072-Access-items-by-EquipmentSlot.patch} | 6 +- ...kPhysicsEvent-if-a-plugin-has-a-lis.patch} | 40 ++-- ...Entity-AddTo-RemoveFrom-World-Events.patch | 29 +++ ...5-Configurable-Chunk-Inhabited-Time.patch} | 22 +- .../0076-EntityPathfindEvent.patch | 83 +++++++ ...uce-IO-ops-opening-a-new-region-file.patch | 52 +++++ ...egionFileCache-and-make-configurable.patch | 50 +++++ ...h => 0079-Use-Optimized-Collections.patch} | 6 +- ...-Do-not-load-chunks-for-Pathfinding.patch} | 64 +++--- ...Location-getType-and-getBlockData-fo.patch | 205 ------------------ ...Do-not-load-chunks-for-light-checks.patch} | 6 +- ...082-Add-PlayerUseUnknownEntityEvent.patch} | 8 +- ...Entity-AddTo-RemoveFrom-World-Events.patch | 29 --- ...DebugInfo-not-initialized-on-client.patch} | 8 +- ...Configurable-Grass-Spread-Tick-Rate.patch} | 16 +- .../0085-EntityPathfindEvent.patch | 39 ---- ...-BlockPlaceEvent-triggering-physics.patch} | 8 +- ...uce-IO-ops-opening-a-new-region-file.patch | 41 ---- ...6-Remove-Debug-checks-from-DataBits.patch} | 27 ++- ...illa-per-world-scoreboard-coloring-.patch} | 28 +-- ...egionFileCache-and-make-configurable.patch | 79 ------- ...d-for-setting-passengers-on-players.patch} | 6 +- ...emove-unused-World-Tile-Entity-List.patch} | 78 +++---- ... 0090-Don-t-tick-Skulls-unused-code.patch} | 8 +- ... 0091-Configurable-Player-Collision.patch} | 41 ++-- ...nt-to-allow-plugins-to-handle-clien.patch} | 6 +- .../0093-Configurable-RCON-IP-address.patch | 62 ++++++ ...94-Prevent-Fire-from-loading-chunks.patch} | 34 +-- ...5-Implement-PlayerLocaleChangeEvent.patch} | 22 +- ...tyRegainHealthEvent-isFastRegen-API.patch} | 18 +- ...to-configure-frosted_ice-properties.patch} | 22 +- ...possibility-for-getServer-singleton.patch} | 29 ++- ...tem-frames-performance-and-bug-fixe.patch} | 66 +++--- ...API-Replenishable-Lootables-Feature.patch} | 145 ++++++------- ...-scoreboard-teams-to-scoreboard.dat.patch} | 10 +- ...em-property-for-disabling-watchdoge.patch} | 4 +- .../0104-Configurable-RCON-IP-address.patch | 23 -- ...le-Keep-Spawn-Loaded-range-per-world.patch | 0 ...am-reload-spawn-chunks-in-nether-end.patch | 0 .../0112-Entity-Tracking-Improvements.patch | 0 43 files changed, 789 insertions(+), 797 deletions(-) create mode 100644 Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch rename Spigot-Server-Patches/{0081-Access-items-by-EquipmentSlot.patch => 0072-Access-items-by-EquipmentSlot.patch} (93%) rename Spigot-Server-Patches/{0082-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch => 0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch} (77%) create mode 100644 Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch rename Spigot-Server-Patches/{0084-Configurable-Chunk-Inhabited-Time.patch => 0075-Configurable-Chunk-Inhabited-Time.patch} (82%) create mode 100644 Spigot-Server-Patches/0076-EntityPathfindEvent.patch create mode 100644 Spigot-Server-Patches/0077-Reduce-IO-ops-opening-a-new-region-file.patch create mode 100644 Spigot-Server-Patches/0078-Sanitise-RegionFileCache-and-make-configurable.patch rename Spigot-Server-Patches/{0088-Use-Optimized-Collections.patch => 0079-Use-Optimized-Collections.patch} (91%) rename Spigot-Server-Patches/{0089-Do-not-load-chunks-for-Pathfinding.patch => 0080-Do-not-load-chunks-for-Pathfinding.patch} (72%) delete mode 100644 Spigot-Server-Patches/0080-Optimize-isValidLocation-getType-and-getBlockData-fo.patch rename Spigot-Server-Patches/{0090-Do-not-load-chunks-for-light-checks.patch => 0081-Do-not-load-chunks-for-light-checks.patch} (81%) rename Spigot-Server-Patches/{0091-Add-PlayerUseUnknownEntityEvent.patch => 0082-Add-PlayerUseUnknownEntityEvent.patch} (87%) delete mode 100644 Spigot-Server-Patches/0083-Entity-AddTo-RemoveFrom-World-Events.patch rename Spigot-Server-Patches/{0092-Fix-reducedDebugInfo-not-initialized-on-client.patch => 0083-Fix-reducedDebugInfo-not-initialized-on-client.patch} (84%) rename Spigot-Server-Patches/{0093-Configurable-Grass-Spread-Tick-Rate.patch => 0084-Configurable-Grass-Spread-Tick-Rate.patch} (75%) delete mode 100644 Spigot-Server-Patches/0085-EntityPathfindEvent.patch rename Spigot-Server-Patches/{0095-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch => 0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch} (74%) delete mode 100644 Spigot-Server-Patches/0086-Reduce-IO-ops-opening-a-new-region-file.patch rename Spigot-Server-Patches/{0097-Remove-Debug-checks-from-DataBits.patch => 0086-Remove-Debug-checks-from-DataBits.patch} (63%) rename Spigot-Server-Patches/{0098-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch => 0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch} (75%) delete mode 100644 Spigot-Server-Patches/0087-Sanitise-RegionFileCache-and-make-configurable.patch rename Spigot-Server-Patches/{0099-Workaround-for-setting-passengers-on-players.patch => 0088-Workaround-for-setting-passengers-on-players.patch} (86%) rename Spigot-Server-Patches/{0100-Remove-unused-World-Tile-Entity-List.patch => 0089-Remove-unused-World-Tile-Entity-List.patch} (67%) rename Spigot-Server-Patches/{0101-Don-t-tick-Skulls-unused-code.patch => 0090-Don-t-tick-Skulls-unused-code.patch} (81%) rename Spigot-Server-Patches/{0102-Configurable-Player-Collision.patch => 0091-Configurable-Player-Collision.patch} (80%) rename Spigot-Server-Patches/{0103-Add-handshake-event-to-allow-plugins-to-handle-clien.patch => 0092-Add-handshake-event-to-allow-plugins-to-handle-clien.patch} (94%) create mode 100644 Spigot-Server-Patches/0093-Configurable-RCON-IP-address.patch rename Spigot-Server-Patches/{0105-Prevent-Fire-from-loading-chunks.patch => 0094-Prevent-Fire-from-loading-chunks.patch} (66%) rename Spigot-Server-Patches/{0106-Implement-PlayerLocaleChangeEvent.patch => 0095-Implement-PlayerLocaleChangeEvent.patch} (82%) rename Spigot-Server-Patches/{0107-EntityRegainHealthEvent-isFastRegen-API.patch => 0096-EntityRegainHealthEvent-isFastRegen-API.patch} (79%) rename Spigot-Server-Patches/{0108-Add-ability-to-configure-frosted_ice-properties.patch => 0097-Add-ability-to-configure-frosted_ice-properties.patch} (80%) rename Spigot-Server-Patches/{0109-remove-null-possibility-for-getServer-singleton.patch => 0098-remove-null-possibility-for-getServer-singleton.patch} (53%) rename Spigot-Server-Patches/{0110-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch => 0099-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch} (78%) rename Spigot-Server-Patches/{0111-LootTable-API-Replenishable-Lootables-Feature.patch => 0100-LootTable-API-Replenishable-Lootables-Feature.patch} (86%) rename Spigot-Server-Patches/{0113-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch => 0101-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch} (85%) rename Spigot-Server-Patches/{0114-System-property-for-disabling-watchdoge.patch => 0102-System-property-for-disabling-watchdoge.patch} (89%) delete mode 100644 Spigot-Server-Patches/0104-Configurable-RCON-IP-address.patch rename {Spigot-Server-Patches => removed/1.14}/0094-Configurable-Keep-Spawn-Loaded-range-per-world.patch (100%) rename {Spigot-Server-Patches => removed/1.14}/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch (100%) rename {Spigot-Server-Patches => removed/1.14}/0112-Entity-Tracking-Improvements.patch (100%) diff --git a/Spigot-Server-Patches/0053-Add-exception-reporting-event.patch b/Spigot-Server-Patches/0053-Add-exception-reporting-event.patch index f884aa1ef1..e862da51a8 100644 --- a/Spigot-Server-Patches/0053-Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/0053-Add-exception-reporting-event.patch @@ -1,4 +1,4 @@ -From 4a49b7191988e3bc5f52e7ed14194198b26c4c3c Mon Sep 17 00:00:00 2001 +From 3d0ef86c30ca141473b5286f5cb72d1a75413804 Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld Date: Thu, 3 Mar 2016 03:15:41 -0600 Subject: [PATCH] Add exception reporting event @@ -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 +1,38 @@ @@ -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 @@ -1,5 +1,6 @@ @@ -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 @@ -14,6 +14,9 @@ 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 @@ -1,5 +1,6 @@ @@ -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 @@ -621,6 +621,7 @@ 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 @@ -1,5 +1,6 @@ @@ -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 @@ -8,6 +8,7 @@ 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 @@ -1,5 +1,7 @@ @@ -216,23 +216,20 @@ 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 -@@ -2,6 +2,12 @@ package net.minecraft.server; +@@ -2,6 +2,9 @@ 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; -@@ -675,8 +681,11 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose +@@ -675,8 +678,11 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose gameprofilerfiller.exit(); } catch (Throwable throwable) { // Paper start - Prevent tile entity and entity crashes @@ -245,7 +242,7 @@ index 25e5216e25..55e8c7c7d4 100644 tilesThisCycle--; this.tileEntityListTick.remove(tileTickPosition--); continue; -@@ -750,8 +759,10 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose +@@ -750,8 +756,10 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose consumer.accept(entity); } catch (Throwable throwable) { // Paper start - Prevent tile entity and entity crashes @@ -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 @@ -113,6 +113,7 @@ 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 @@ -16,6 +16,9 @@ import java.util.concurrent.atomic.AtomicInteger; diff --git a/Spigot-Server-Patches/0065-Add-World-Util-Methods.patch b/Spigot-Server-Patches/0065-Add-World-Util-Methods.patch index 16d0610b05..dbcb566b1f 100644 --- a/Spigot-Server-Patches/0065-Add-World-Util-Methods.patch +++ b/Spigot-Server-Patches/0065-Add-World-Util-Methods.patch @@ -1,4 +1,4 @@ -From 87bc4fe3532a93119223040e6cc70d3fc4f93303 Mon Sep 17 00:00:00 2001 +From ad235c2c832bb36e4bb444861075244c89c22da4 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 18 Mar 2016 20:16:03 -0400 Subject: [PATCH] Add World Util Methods @@ -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 @@ -388,6 +388,7 @@ 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 @@ -36,6 +36,22 @@ public interface IWorldReader extends IIBlockAccess { @@ -45,10 +45,10 @@ 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 -@@ -49,7 +49,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose +@@ -46,7 +46,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose protected final java.util.Set tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); // Paper private final long b = 16777215L; private final Thread c; @@ -57,7 +57,7 @@ index 55e8c7c7d4..e8831e2a40 100644 protected int j = (new Random()).nextInt(); protected final int k = 1013904223; protected float l; -@@ -211,6 +211,83 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose +@@ -208,6 +208,83 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose return i < 0 || i >= 256; } diff --git a/Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch new file mode 100644 index 0000000000..866788bd8a --- /dev/null +++ b/Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -0,0 +1,121 @@ +From 48a682eac7e1502586e5edae0c1233ae181823df Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 3 Mar 2016 02:07:55 -0600 +Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling + +Hot methods, so reduce # of instructions for the method. + +Move is valid location test to the BlockPosition class so that it can access local variables. + +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 2852a17f2..7cb46d7a9 100644 +--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java ++++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java +@@ -10,6 +10,14 @@ public class BaseBlockPosition implements Comparable { + private final int a; + private final int b; + private final int c; ++ // Paper start ++ public boolean isValidLocation() { ++ return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256; ++ } ++ public boolean isInvalidYLocation() { ++ return b < 0 || b >= 256; ++ } ++ // Paper end + + 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 c927d524a..64700b97c 100644 +--- a/src/main/java/net/minecraft/server/BlockPosition.java ++++ b/src/main/java/net/minecraft/server/BlockPosition.java +@@ -339,6 +339,16 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali + protected int b; + protected int c; + protected int d; ++ // Paper start ++ @Override ++ public boolean isValidLocation() { ++ return b >= -30000000 && d >= -30000000 && b < 30000000 && d < 30000000 && c >= 0 && c < 256; ++ } ++ @Override ++ public boolean isInvalidYLocation() { ++ return c < 0 || c >= 256; ++ } ++ // Paper end + + 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 9433d04f4..98ec98e02 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -232,12 +232,24 @@ public class Chunk implements IChunkAccess { + return this.sections; + } + +- @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()); ++ } + ++ public final IBlockData getBlockData(final int x, final int y, final int z) { ++ // Method body / logic copied from below ++ final int i = y >> 4; ++ if (y >= 0 && i < this.sections.length && this.sections[i] != null) { ++ // Inlined ChunkSection.getType() and DataPaletteBlock.a(int,int,int) ++ return this.sections[i].blockIds.a((y & 15) << 8 | (z & 15) << 4 | x & 15); ++ } ++ return Blocks.AIR.getBlockData(); ++ } ++ ++ public IBlockData getBlockData_unused(int i, int j, int k) { ++ // Paper end + 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 c973ab607..0d7eab0e0 100644 +--- a/src/main/java/net/minecraft/server/ChunkSection.java ++++ b/src/main/java/net/minecraft/server/ChunkSection.java +@@ -9,7 +9,7 @@ public class ChunkSection { + private short nonEmptyBlockCount; + private short tickingBlockCount; + private short e; +- private final DataPaletteBlock blockIds; ++ final DataPaletteBlock blockIds; // Paper - package + + 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 cdc5d7009..78d1a5c71 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -197,11 +197,11 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + } + + public static boolean isValidLocation(BlockPosition blockposition) { +- return !isInsideWorld(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000; ++ return blockposition.isValidLocation(); // Paper + } + + public static boolean isInsideWorld(BlockPosition blockposition) { +- return b(blockposition.getY()); ++ return blockposition.isInvalidYLocation(); // Paper + } + + public static boolean b(int i) { +-- +2.21.0 + diff --git a/Spigot-Server-Patches/0081-Access-items-by-EquipmentSlot.patch b/Spigot-Server-Patches/0072-Access-items-by-EquipmentSlot.patch similarity index 93% rename from Spigot-Server-Patches/0081-Access-items-by-EquipmentSlot.patch rename to Spigot-Server-Patches/0072-Access-items-by-EquipmentSlot.patch index f836513244..f1b875bb26 100644 --- a/Spigot-Server-Patches/0081-Access-items-by-EquipmentSlot.patch +++ b/Spigot-Server-Patches/0072-Access-items-by-EquipmentSlot.patch @@ -1,14 +1,14 @@ -From b0f6b1e28395bcdd423bd2754a630bd1e23ddb29 Mon Sep 17 00:00:00 2001 +From 95cb3da5a69aa89cc552cf83a94d4eeff8cb2625 Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Sun, 20 Mar 2016 06:45:01 -0400 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 -@@ -250,4 +250,54 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i +@@ -249,4 +249,54 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i public void setBootsDropChance(float chance) { throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory"); } diff --git a/Spigot-Server-Patches/0082-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch similarity index 77% rename from Spigot-Server-Patches/0082-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch rename to Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 3b0d25d09e..0c8b09fcbf 100644 --- a/Spigot-Server-Patches/0082-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -1,4 +1,4 @@ -From 4f6a8c94bfaf64e35e966ccd46185741f79b021d Mon Sep 17 00:00:00 2001 +From 106afc897f40321e0f4cad5985e0d38dc225d40e Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 19:55:45 -0400 Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener @@ -6,10 +6,10 @@ 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 -@@ -15,7 +15,7 @@ public class BlockPlant extends Block { +@@ -16,7 +16,7 @@ public class BlockPlant extends Block { public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { // CraftBukkit start if (!iblockdata.canPlace(generatoraccess, blockposition)) { @@ -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 -@@ -49,7 +49,7 @@ public class BlockTallPlant extends BlockPlant { - +@@ -55,7 +55,7 @@ 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 -@@ -1001,6 +1001,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati +@@ -1087,6 +1087,7 @@ 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 -@@ -486,7 +486,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +@@ -435,7 +435,7 @@ 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); -@@ -620,7 +620,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +@@ -546,7 +546,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose try { // CraftBukkit start CraftWorld world = ((WorldServer) this).getWorld(); @@ -66,17 +66,17 @@ 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 -@@ -33,6 +33,7 @@ import org.bukkit.event.weather.LightningStrikeEvent; - public class WorldServer extends World implements IAsyncTaskHandler { - - private static final Logger a = LogManager.getLogger(); +@@ -76,6 +76,7 @@ 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) { -- 2.21.0 diff --git a/Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch b/Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch new file mode 100644 index 0000000000..2a8f0565bd --- /dev/null +++ b/Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch @@ -0,0 +1,29 @@ +From 30a0f8ece5268608ed4328b4c2f6aeb9066b6689 Mon Sep 17 00:00:00 2001 +From: Aikar +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/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 +@@ -1102,6 +1102,7 @@ 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 + } + + } +@@ -1111,6 +1112,7 @@ 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); +-- +2.21.0 + diff --git a/Spigot-Server-Patches/0084-Configurable-Chunk-Inhabited-Time.patch b/Spigot-Server-Patches/0075-Configurable-Chunk-Inhabited-Time.patch similarity index 82% rename from Spigot-Server-Patches/0084-Configurable-Chunk-Inhabited-Time.patch rename to Spigot-Server-Patches/0075-Configurable-Chunk-Inhabited-Time.patch index b104ac0e8e..21dd8898eb 100644 --- a/Spigot-Server-Patches/0084-Configurable-Chunk-Inhabited-Time.patch +++ b/Spigot-Server-Patches/0075-Configurable-Chunk-Inhabited-Time.patch @@ -1,4 +1,4 @@ -From 30cce2c18fb76855ddad062f12072ce436e8ecc2 Mon Sep 17 00:00:00 2001 +From 415febb133d2a64f91317c9b2757f323e7307dbf Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:46:14 -0400 Subject: [PATCH] Configurable Chunk Inhabited Time @@ -11,10 +11,10 @@ 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 -@@ -237,4 +237,19 @@ public class PaperWorldConfig { +@@ -229,4 +229,19 @@ public class PaperWorldConfig { skeleHorseSpawnChance = 0.01D; // Vanilla value } } @@ -35,18 +35,18 @@ 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 -@@ -1289,7 +1289,7 @@ public class Chunk implements IChunkAccess { +@@ -826,7 +826,7 @@ 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 -- 2.21.0 diff --git a/Spigot-Server-Patches/0076-EntityPathfindEvent.patch b/Spigot-Server-Patches/0076-EntityPathfindEvent.patch new file mode 100644 index 0000000000..229dce052a --- /dev/null +++ b/Spigot-Server-Patches/0076-EntityPathfindEvent.patch @@ -0,0 +1,83 @@ +From ef812432ec5d1a861add26683b2236d6e3cbcb25 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 28 Mar 2016 21:22:26 -0400 +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 2ced8dedd..6ce35018a 100644 +--- a/src/main/java/net/minecraft/server/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +@@ -4,7 +4,7 @@ import javax.annotation.Nullable; + + public abstract class NavigationAbstract { + +- protected final EntityInsentient a; ++ protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER + protected final World b; + @Nullable + protected PathEntity c; +@@ -71,13 +71,16 @@ 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 +@@ -87,16 +90,25 @@ 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 { ++ // 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.i(); + +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 +@@ -25,7 +25,7 @@ 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 +-- +2.21.0 + diff --git a/Spigot-Server-Patches/0077-Reduce-IO-ops-opening-a-new-region-file.patch b/Spigot-Server-Patches/0077-Reduce-IO-ops-opening-a-new-region-file.patch new file mode 100644 index 0000000000..01b778d2b0 --- /dev/null +++ b/Spigot-Server-Patches/0077-Reduce-IO-ops-opening-a-new-region-file.patch @@ -0,0 +1,52 @@ +From 1f55c86840384d32f33f077d9af9ec28ebbc05e0 Mon Sep 17 00:00:00 2001 +From: Antony Riley +Date: Tue, 29 Mar 2016 06:56:23 +0300 +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 b062a31c4..4e6288e8b 100644 +--- a/src/main/java/net/minecraft/server/RegionFile.java ++++ b/src/main/java/net/minecraft/server/RegionFile.java +@@ -26,7 +26,7 @@ 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; +@@ -59,10 +59,19 @@ public class RegionFile implements AutoCloseable { + this.e.set(1, false); + this.b.seek(0L); + ++ // 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.b.readInt(); ++ k = headerAsInts.get(); // Paper + this.c[j] = k; + // Spigot start + int length = k & 255; +@@ -88,7 +97,7 @@ public class RegionFile implements AutoCloseable { + } + + for (j = 0; j < 1024; ++j) { +- k = this.b.readInt(); ++ k = headerAsInts.get(); // Paper + this.d[j] = k; + } + +-- +2.21.0 + diff --git a/Spigot-Server-Patches/0078-Sanitise-RegionFileCache-and-make-configurable.patch b/Spigot-Server-Patches/0078-Sanitise-RegionFileCache-and-make-configurable.patch new file mode 100644 index 0000000000..5163a782e0 --- /dev/null +++ b/Spigot-Server-Patches/0078-Sanitise-RegionFileCache-and-make-configurable.patch @@ -0,0 +1,50 @@ +From 170024a9cd0f01892a20a900fbaa04583ed590d4 Mon Sep 17 00:00:00 2001 +From: Antony Riley +Date: Tue, 29 Mar 2016 08:22:55 +0300 +Subject: [PATCH] Sanitise RegionFileCache and make configurable. + +RegionFileCache prior to this patch would close every single open region +file upon reaching a size of 256. +This patch modifies that behaviour so it closes the the least recently +used RegionFile. +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 809b3a1a4..e929ba452 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -215,4 +215,9 @@ public class PaperConfig { + private static void loadPermsBeforePlugins() { + loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true); + } ++ ++ public static int regionFileCacheSize = 256; ++ private static void regionFileCacheSize() { ++ regionFileCacheSize = getInt("settings.region-file-cache-size", 256); ++ } + } +diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java +index 75731c919..c8573a8ee 100644 +--- a/src/main/java/net/minecraft/server/RegionFileCache.java ++++ b/src/main/java/net/minecraft/server/RegionFileCache.java +@@ -8,6 +8,7 @@ import java.io.DataOutputStream; + import java.io.File; + import java.io.IOException; + import javax.annotation.Nullable; ++import com.destroystokyo.paper.PaperConfig; // Paper + + public abstract class RegionFileCache implements AutoCloseable { + +@@ -25,7 +26,7 @@ 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(); + } + +-- +2.21.0 + diff --git a/Spigot-Server-Patches/0088-Use-Optimized-Collections.patch b/Spigot-Server-Patches/0079-Use-Optimized-Collections.patch similarity index 91% rename from Spigot-Server-Patches/0088-Use-Optimized-Collections.patch rename to Spigot-Server-Patches/0079-Use-Optimized-Collections.patch index 55d5ea4686..296a7cc3fa 100644 --- a/Spigot-Server-Patches/0088-Use-Optimized-Collections.patch +++ b/Spigot-Server-Patches/0079-Use-Optimized-Collections.patch @@ -1,4 +1,4 @@ -From 600f9aaa6a5333db0318c91f1ad30fc82092ba55 Mon Sep 17 00:00:00 2001 +From 7ec6ae32dc53d6401706f46533d05f47cb554b30 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 30 Mar 2016 02:13:24 -0400 Subject: [PATCH] Use Optimized Collections @@ -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 @@ -12,6 +12,7 @@ import java.util.Map; @@ -25,7 +25,7 @@ index b8fd774956..51a02edf83 100644 import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -21,7 +22,7 @@ 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/0089-Do-not-load-chunks-for-Pathfinding.patch b/Spigot-Server-Patches/0080-Do-not-load-chunks-for-Pathfinding.patch similarity index 72% rename from Spigot-Server-Patches/0089-Do-not-load-chunks-for-Pathfinding.patch rename to Spigot-Server-Patches/0080-Do-not-load-chunks-for-Pathfinding.patch index 5b6bf35ba8..2f951e9a63 100644 --- a/Spigot-Server-Patches/0089-Do-not-load-chunks-for-Pathfinding.patch +++ b/Spigot-Server-Patches/0080-Do-not-load-chunks-for-Pathfinding.patch @@ -1,24 +1,24 @@ -From 096033929413ea354e0b00c6433af4178b66dfdf Mon Sep 17 00:00:00 2001 +From 61f8cebe436377f8f237d12f4ac12cec64677d25 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 31 Mar 2016 19:17:58 -0400 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 -@@ -26,7 +26,7 @@ public class ChunkCache implements IIBlockAccess { +@@ -25,7 +25,7 @@ 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 @@ -22,8 +22,9 @@ public abstract class NavigationAbstract { @@ -35,57 +35,57 @@ index 604049b088..716d00afb1 100644 @@ -32,6 +33,7 @@ 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() { -@@ -174,6 +176,7 @@ public abstract class NavigationAbstract { + public BlockPosition h() { +@@ -178,6 +180,7 @@ 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 -@@ -9,7 +9,7 @@ public class Pathfinder { - private final Path a = new Path(); +@@ -12,7 +12,7 @@ public class Pathfinder { 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 -@@ -4,6 +4,7 @@ public abstract class PathfinderAbstract { +@@ -7,6 +7,7 @@ public abstract class PathfinderAbstract { 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; -@@ -16,6 +17,7 @@ public abstract class PathfinderAbstract { +@@ -19,6 +20,7 @@ public abstract class PathfinderAbstract { public void a(IBlockAccess iblockaccess, EntityInsentient entityinsentient) { 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 -@@ -327,7 +327,8 @@ public class PathfinderNormal extends PathfinderAbstract { +@@ -343,7 +343,8 @@ public class PathfinderNormal extends PathfinderAbstract { PathType pathtype = this.b(iblockaccess, i, j, k); if (pathtype == PathType.OPEN && j >= 1) { @@ -95,12 +95,12 @@ index eec8916479..e45bdb581e 100644 PathType pathtype1 = this.b(iblockaccess, i, j - 1, k); pathtype = pathtype1 != PathType.WALKABLE && pathtype1 != PathType.OPEN && pathtype1 != PathType.WATER && pathtype1 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN; -@@ -353,9 +354,10 @@ public class PathfinderNormal extends PathfinderAbstract { +@@ -373,9 +374,10 @@ public class PathfinderNormal extends PathfinderAbstract { 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 @@ -108,7 +108,7 @@ index eec8916479..e45bdb581e 100644 pathtype = PathType.DANGER_CACTUS; } else if (block == Blocks.FIRE) { pathtype = PathType.DANGER_FIRE; -@@ -387,7 +389,8 @@ public class PathfinderNormal extends PathfinderAbstract { +@@ -409,7 +411,8 @@ public class PathfinderNormal extends PathfinderAbstract { protected PathType b(IBlockAccess iblockaccess, int i, int j, int k) { BlockPosition blockposition = new BlockPosition(i, j, k); diff --git a/Spigot-Server-Patches/0080-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/0080-Optimize-isValidLocation-getType-and-getBlockData-fo.patch deleted file mode 100644 index a76902e848..0000000000 --- a/Spigot-Server-Patches/0080-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ /dev/null @@ -1,205 +0,0 @@ -From f379dcca9c38349b82a318227aee76c6c3c98869 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 3 Mar 2016 02:07:55 -0600 -Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling - -Hot methods, so reduce # of instructions for the method. - -Move is valid location test to the BlockPosition class so that it can access local variables. - -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 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -10,6 +10,14 @@ public class BaseBlockPosition implements Comparable { - private final int a; - private final int b; - private final int c; -+ // Paper start -+ public boolean isValidLocation() { -+ return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256; -+ } -+ public boolean isInvalidYLocation() { -+ return b < 0 || b >= 256; -+ } -+ // Paper end - - 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 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -300,6 +300,16 @@ public class BlockPosition extends BaseBlockPosition { - protected int b; - protected int c; - protected int d; -+ // Paper start -+ @Override -+ public boolean isValidLocation() { -+ return b >= -30000000 && d >= -30000000 && b < 30000000 && d < 30000000 && c >= 0 && c < 256; -+ } -+ @Override -+ public boolean isInvalidYLocation() { -+ return c < 0 || c >= 256; -+ } -+ // Paper end - - 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 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -425,12 +425,24 @@ public class Chunk implements IChunkAccess { - return this.getBlockData(i, j, k).b(this.world, new BlockPosition(i, j, k)); - } - -- public IBlockData getBlockData(BlockPosition blockposition) { return getType(blockposition); } // Paper -- public IBlockData getType(BlockPosition blockposition) { -+ // 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()); - } - -- 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; -+ if (y >= 0 && i < this.sections.length && this.sections[i] != null) { -+ // Inlined ChunkSection.getType() and DataPaletteBlock.a(int,int,int) -+ return this.sections[i].blockIds.a((y & 15) << 8 | (z & 15) << 4 | x & 15); -+ } -+ return Blocks.AIR.getBlockData(); -+ } -+ -+ public IBlockData getBlockData_unused(int i, int j, int k) { -+ // Paper end - if (this.world.S() == 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 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -7,7 +7,7 @@ public class ChunkSection { - private int nonEmptyBlockCount; - private int tickingBlockCount; - private int e; -- private final DataPaletteBlock blockIds; -+ final DataPaletteBlock blockIds; // Paper - package - private NibbleArray emittedLight; - private NibbleArray skyLight; - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index fd45090685..f4e91db7c6 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -257,11 +257,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - } - - public static boolean isValidLocation(BlockPosition blockposition) { -- return !k(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; -+ return blockposition.isInvalidYLocation(); // Paper - } - - public boolean isEmpty(BlockPosition blockposition) { -@@ -278,7 +278,7 @@ 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) { -@@ -325,7 +325,7 @@ 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; - } -@@ -380,7 +380,7 @@ 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; -@@ -707,11 +707,11 @@ 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); -@@ -738,7 +738,7 @@ 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); -@@ -748,7 +748,7 @@ 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); -@@ -1767,7 +1767,7 @@ 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 -@@ -1808,7 +1808,7 @@ 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) { -@@ -1869,7 +1869,7 @@ 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); --- -2.21.0 - diff --git a/Spigot-Server-Patches/0090-Do-not-load-chunks-for-light-checks.patch b/Spigot-Server-Patches/0081-Do-not-load-chunks-for-light-checks.patch similarity index 81% rename from Spigot-Server-Patches/0090-Do-not-load-chunks-for-light-checks.patch rename to Spigot-Server-Patches/0081-Do-not-load-chunks-for-light-checks.patch index 5bd0521718..328cd13fe3 100644 --- a/Spigot-Server-Patches/0090-Do-not-load-chunks-for-light-checks.patch +++ b/Spigot-Server-Patches/0081-Do-not-load-chunks-for-light-checks.patch @@ -1,4 +1,4 @@ -From c8b443afca617ae27d8b784a48c4817933d7e3e3 Mon Sep 17 00:00:00 2001 +From c4b8da3fa91a24ce82ad15739e925dba59472423 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 31 Mar 2016 19:17:58 -0400 Subject: [PATCH] Do not load chunks for light checks @@ -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 -@@ -663,6 +663,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +@@ -586,6 +586,7 @@ 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/0091-Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/0082-Add-PlayerUseUnknownEntityEvent.patch similarity index 87% rename from Spigot-Server-Patches/0091-Add-PlayerUseUnknownEntityEvent.patch rename to Spigot-Server-Patches/0082-Add-PlayerUseUnknownEntityEvent.patch index 9869a5c735..31b43a8cc2 100644 --- a/Spigot-Server-Patches/0091-Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/0082-Add-PlayerUseUnknownEntityEvent.patch @@ -1,11 +1,11 @@ -From c926ab31b1ebc9dc51496f8a9dcbe76eeff63dce Mon Sep 17 00:00:00 2001 +From 042628a3daddaf353397c8378d2ea16071cad063 Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Sat, 2 Apr 2016 05:09:16 -0400 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 @@ -5,7 +5,7 @@ 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 -@@ -1874,6 +1874,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1923,6 +1923,16 @@ public class PlayerConnection implements PacketListenerPlayIn { } } } diff --git a/Spigot-Server-Patches/0083-Entity-AddTo-RemoveFrom-World-Events.patch b/Spigot-Server-Patches/0083-Entity-AddTo-RemoveFrom-World-Events.patch deleted file mode 100644 index 297b052698..0000000000 --- a/Spigot-Server-Patches/0083-Entity-AddTo-RemoveFrom-World-Events.patch +++ /dev/null @@ -1,29 +0,0 @@ -From e04fc8c3d54d686f2894b0b273b8bdfbf47beaa1 Mon Sep 17 00:00:00 2001 -From: Aikar -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 -@@ -1032,6 +1032,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - } - - entity.valid = true; // CraftBukkit -+ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid - } - - protected void c(Entity entity) { -@@ -1039,6 +1040,7 @@ 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 - } - --- -2.21.0 - diff --git a/Spigot-Server-Patches/0092-Fix-reducedDebugInfo-not-initialized-on-client.patch b/Spigot-Server-Patches/0083-Fix-reducedDebugInfo-not-initialized-on-client.patch similarity index 84% rename from Spigot-Server-Patches/0092-Fix-reducedDebugInfo-not-initialized-on-client.patch rename to Spigot-Server-Patches/0083-Fix-reducedDebugInfo-not-initialized-on-client.patch index 877ce9e522..51996ca658 100644 --- a/Spigot-Server-Patches/0092-Fix-reducedDebugInfo-not-initialized-on-client.patch +++ b/Spigot-Server-Patches/0083-Fix-reducedDebugInfo-not-initialized-on-client.patch @@ -1,19 +1,19 @@ -From 834922853fbfd37864ba9ceb6898e2628c9ec553 Mon Sep 17 00:00:00 2001 +From d372b2f3ee68da28fec46cd5c9d313d6b734e0c7 Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Sat, 2 Apr 2016 20:37:03 -0400 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 -@@ -161,6 +161,7 @@ public abstract class PlayerList { +@@ -160,6 +160,7 @@ public abstract class PlayerList { playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); 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); -- diff --git a/Spigot-Server-Patches/0093-Configurable-Grass-Spread-Tick-Rate.patch b/Spigot-Server-Patches/0084-Configurable-Grass-Spread-Tick-Rate.patch similarity index 75% rename from Spigot-Server-Patches/0093-Configurable-Grass-Spread-Tick-Rate.patch rename to Spigot-Server-Patches/0084-Configurable-Grass-Spread-Tick-Rate.patch index a3993da9a9..cb7a46e93a 100644 --- a/Spigot-Server-Patches/0093-Configurable-Grass-Spread-Tick-Rate.patch +++ b/Spigot-Server-Patches/0084-Configurable-Grass-Spread-Tick-Rate.patch @@ -1,14 +1,14 @@ -From d7cd2aa94ac35ab602e58484a14ae747b2a68240 Mon Sep 17 00:00:00 2001 +From ecdf0f12e6f006fcf530350c33ab4b516acb1581 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 3 Apr 2016 16:28:17 -0400 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 -@@ -252,4 +252,10 @@ public class PaperWorldConfig { +@@ -244,4 +244,10 @@ public class PaperWorldConfig { } fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1); } @@ -20,16 +20,16 @@ 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 -@@ -21,6 +21,7 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow { - } +@@ -29,6 +29,7 @@ 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 -- 2.21.0 diff --git a/Spigot-Server-Patches/0085-EntityPathfindEvent.patch b/Spigot-Server-Patches/0085-EntityPathfindEvent.patch deleted file mode 100644 index 030a3ea1d6..0000000000 --- a/Spigot-Server-Patches/0085-EntityPathfindEvent.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 532ad87eb21f8762a38eb0c56dae2e31f292ed22 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 28 Mar 2016 21:22:26 -0400 -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 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -4,7 +4,7 @@ import javax.annotation.Nullable; - - public abstract class NavigationAbstract { - -- protected EntityInsentient a; -+ protected EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER - protected World b; - @Nullable - protected PathEntity c; -@@ -78,6 +78,7 @@ public abstract class NavigationAbstract { - } 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 - this.q = blockposition; - float f = this.j(); - -@@ -102,6 +103,7 @@ 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(); - --- -2.21.0 - diff --git a/Spigot-Server-Patches/0095-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/Spigot-Server-Patches/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch similarity index 74% rename from Spigot-Server-Patches/0095-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch rename to Spigot-Server-Patches/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index da3adc1c3f..746686c028 100644 --- a/Spigot-Server-Patches/0095-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/Spigot-Server-Patches/0085-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -1,15 +1,15 @@ -From 3a2173955a650e1613573c58df97db088d0326cb Mon Sep 17 00:00:00 2001 +From efe578dd1466202efe8ea41534297bd2dafbe01b Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 3 Apr 2016 17:48:50 -0400 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 -@@ -578,6 +578,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - } +@@ -504,6 +504,7 @@ 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/0086-Reduce-IO-ops-opening-a-new-region-file.patch b/Spigot-Server-Patches/0086-Reduce-IO-ops-opening-a-new-region-file.patch deleted file mode 100644 index 8a160d7089..0000000000 --- a/Spigot-Server-Patches/0086-Reduce-IO-ops-opening-a-new-region-file.patch +++ /dev/null @@ -1,41 +0,0 @@ -From a05120f07988e9b44ec31b64d116eecdf159d664 Mon Sep 17 00:00:00 2001 -From: Antony Riley -Date: Tue, 29 Mar 2016 06:56:23 +0300 -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 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -71,9 +71,17 @@ public class RegionFile { - this.c.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 - - for (j = 0; j < 1024; ++j) { -- k = this.c.readInt(); -+ k = headerAsInts.get(); // Paper - this.d[j] = k; - // Spigot start - int length = k & 255; -@@ -99,7 +107,7 @@ public class RegionFile { - } - - for (j = 0; j < 1024; ++j) { -- k = this.c.readInt(); -+ k = headerAsInts.get(); // Paper - this.e[j] = k; - } - } catch (IOException ioexception) { --- -2.21.0 - diff --git a/Spigot-Server-Patches/0097-Remove-Debug-checks-from-DataBits.patch b/Spigot-Server-Patches/0086-Remove-Debug-checks-from-DataBits.patch similarity index 63% rename from Spigot-Server-Patches/0097-Remove-Debug-checks-from-DataBits.patch rename to Spigot-Server-Patches/0086-Remove-Debug-checks-from-DataBits.patch index ad85c877b5..cf431b73eb 100644 --- a/Spigot-Server-Patches/0097-Remove-Debug-checks-from-DataBits.patch +++ b/Spigot-Server-Patches/0086-Remove-Debug-checks-from-DataBits.patch @@ -1,4 +1,4 @@ -From 370c0f9263d280138a073b0237be9e2cc72f6fd1 Mon Sep 17 00:00:00 2001 +From b4a076f89d83b45dae9ae1ec7919ef774ba884e2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 5 Apr 2016 21:38:58 -0400 Subject: [PATCH] Remove Debug checks from DataBits @@ -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 @@ -14,7 +14,7 @@ public class DataBits { @@ -24,23 +24,34 @@ index 9e83610f1a..fe5947b6cc 100644 @@ -27,8 +27,8 @@ 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; -@@ -45,7 +45,7 @@ public class DataBits { + int l = k >> 6; + int i1 = (i + 1) * this.b - 1 >> 6; +@@ -49,8 +49,8 @@ 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; +@@ -67,7 +67,7 @@ public class DataBits { } public int a(int i) { - 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; -- 2.21.0 diff --git a/Spigot-Server-Patches/0098-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch similarity index 75% rename from Spigot-Server-Patches/0098-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch rename to Spigot-Server-Patches/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 8d85179555..bf7027bd9c 100644 --- a/Spigot-Server-Patches/0098-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -1,4 +1,4 @@ -From 261781b7a4ce6899433dca3cbf14ceecf88ff6d6 Mon Sep 17 00:00:00 2001 +From 6176b038f0f8fddd52cea7c668e06dc3a7403c4b Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 6 Apr 2016 01:04:23 -0500 Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names @@ -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 -@@ -264,4 +264,9 @@ public class PaperWorldConfig { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16); - log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16)); +@@ -250,4 +250,9 @@ public class PaperWorldConfig { + 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 -@@ -1611,7 +1611,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1657,7 +1657,16 @@ public class PlayerConnection implements PacketListenerPlayIn { return; } @@ -48,18 +48,18 @@ 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 -@@ -176,7 +176,7 @@ public abstract class PlayerList { +@@ -175,7 +175,7 @@ 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); -- 2.21.0 diff --git a/Spigot-Server-Patches/0087-Sanitise-RegionFileCache-and-make-configurable.patch b/Spigot-Server-Patches/0087-Sanitise-RegionFileCache-and-make-configurable.patch deleted file mode 100644 index ff67826d51..0000000000 --- a/Spigot-Server-Patches/0087-Sanitise-RegionFileCache-and-make-configurable.patch +++ /dev/null @@ -1,79 +0,0 @@ -From a1b78729ad268fc1bb764e0432ff606abb0f7f86 Mon Sep 17 00:00:00 2001 -From: Antony Riley -Date: Tue, 29 Mar 2016 08:22:55 +0300 -Subject: [PATCH] Sanitise RegionFileCache and make configurable. - -RegionFileCache prior to this patch would close every single open region -file upon reaching a size of 256. -This patch modifies that behaviour so it closes the the least recently -used RegionFile. -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 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -228,4 +228,9 @@ public class PaperConfig { - private static void loadPermsBeforePlugins() { - loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true); - } -+ -+ public static int regionFileCacheSize = 256; -+ private static void regionFileCacheSize() { -+ regionFileCacheSize = getInt("settings.region-file-cache-size", 256); -+ } - } -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 5dbd1d517a..964996976a 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -9,10 +9,12 @@ import java.io.IOException; - import java.util.Iterator; - import java.util.Map; - import javax.annotation.Nullable; -+import com.destroystokyo.paper.PaperConfig; // Paper -+import java.util.LinkedHashMap; // Paper - - public class RegionFileCache { - -- 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"); -@@ -27,7 +29,7 @@ public class RegionFileCache { - } - - if (RegionFileCache.cache.size() >= 256) { -- a(); -+ trimCache(); - } - - RegionFile regionfile1 = new RegionFile(file2); -@@ -60,6 +62,22 @@ 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(); - --- -2.21.0 - diff --git a/Spigot-Server-Patches/0099-Workaround-for-setting-passengers-on-players.patch b/Spigot-Server-Patches/0088-Workaround-for-setting-passengers-on-players.patch similarity index 86% rename from Spigot-Server-Patches/0099-Workaround-for-setting-passengers-on-players.patch rename to Spigot-Server-Patches/0088-Workaround-for-setting-passengers-on-players.patch index e527c055fd..29489f82e8 100644 --- a/Spigot-Server-Patches/0099-Workaround-for-setting-passengers-on-players.patch +++ b/Spigot-Server-Patches/0088-Workaround-for-setting-passengers-on-players.patch @@ -1,4 +1,4 @@ -From 0ca415c498a9f0a63caa664b5951e4028326b7f5 Mon Sep 17 00:00:00 2001 +From 30b50625c0c4b3e5c9bc22a5ecc7b7ff55f9c26c Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 10 Apr 2016 03:23:32 -0500 Subject: [PATCH] Workaround for setting passengers on players @@ -6,10 +6,10 @@ 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 -@@ -727,6 +727,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -753,6 +753,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return true; } diff --git a/Spigot-Server-Patches/0100-Remove-unused-World-Tile-Entity-List.patch b/Spigot-Server-Patches/0089-Remove-unused-World-Tile-Entity-List.patch similarity index 67% rename from Spigot-Server-Patches/0100-Remove-unused-World-Tile-Entity-List.patch rename to Spigot-Server-Patches/0089-Remove-unused-World-Tile-Entity-List.patch index c26c9f2dc7..e4a0bd95d8 100644 --- a/Spigot-Server-Patches/0100-Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/0089-Remove-unused-World-Tile-Entity-List.patch @@ -1,4 +1,4 @@ -From 27fffdd001e9462d4701d1011de790f8b6478872 Mon Sep 17 00:00:00 2001 +From dd02890bad92638cecc28b7a2a4c2328901f73f8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 13 Apr 2016 00:25:28 -0400 Subject: [PATCH] Remove unused World Tile Entity List @@ -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 -@@ -71,7 +71,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc - }; - // Spigot end - protected final Set g = com.google.common.collect.Sets.newHashSet(); // Paper +@@ -40,7 +40,7 @@ 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 -@@ -1269,7 +1269,7 @@ 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 +@@ -686,9 +686,9 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + }, tileentity::getPosition}); } -@@ -1322,7 +1322,7 @@ 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()); - } -@@ -1352,7 +1352,7 @@ 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 -@@ -1372,9 +1372,9 @@ 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); } -@@ -1855,7 +1855,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc +@@ -724,7 +724,7 @@ 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(); + } + +@@ -780,7 +780,7 @@ 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()); + } +@@ -810,7 +810,7 @@ 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 +@@ -1081,7 +1081,7 @@ 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/0101-Don-t-tick-Skulls-unused-code.patch b/Spigot-Server-Patches/0090-Don-t-tick-Skulls-unused-code.patch similarity index 81% rename from Spigot-Server-Patches/0101-Don-t-tick-Skulls-unused-code.patch rename to Spigot-Server-Patches/0090-Don-t-tick-Skulls-unused-code.patch index 2b682de2bf..80d311f78d 100644 --- a/Spigot-Server-Patches/0101-Don-t-tick-Skulls-unused-code.patch +++ b/Spigot-Server-Patches/0090-Don-t-tick-Skulls-unused-code.patch @@ -1,11 +1,11 @@ -From 62ab4dea592870baed4e544e72552489e5b715d0 Mon Sep 17 00:00:00 2001 +From 47491d3a02dd13f9889039781aabe50b7c0c85b9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 13 Apr 2016 00:30:10 -0400 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 @@ -24,7 +24,7 @@ import com.mojang.authlib.ProfileLookupCallback; @@ -15,8 +15,8 @@ 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; -- 2.21.0 diff --git a/Spigot-Server-Patches/0102-Configurable-Player-Collision.patch b/Spigot-Server-Patches/0091-Configurable-Player-Collision.patch similarity index 80% rename from Spigot-Server-Patches/0102-Configurable-Player-Collision.patch rename to Spigot-Server-Patches/0091-Configurable-Player-Collision.patch index 6d79a58f14..266e701305 100644 --- a/Spigot-Server-Patches/0102-Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/0091-Configurable-Player-Collision.patch @@ -1,14 +1,14 @@ -From bb1c1ab4db447251965dbd0e053506855d523a6a Mon Sep 17 00:00:00 2001 +From 64e3e00b0d04cf06cb339c4804a6f30d4668d75f Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 13 Apr 2016 02:10:49 -0400 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 -@@ -233,4 +233,9 @@ public class PaperConfig { +@@ -220,4 +220,9 @@ public class PaperConfig { private static void regionFileCacheSize() { regionFileCacheSize = getInt("settings.region-file-cache-size", 256); } @@ -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 -@@ -421,6 +421,19 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati - this.a(this.getWorldServer(DimensionManager.OVERWORLD).worldMaps); - // CraftBukkit end +@@ -438,6 +438,20 @@ 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); -@@ -230,6 +231,13 @@ public abstract class PlayerList { + public PlayerList(MinecraftServer minecraftserver, int i) { + this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this); +@@ -284,6 +285,13 @@ public abstract class PlayerList { } entityplayer.syncInventory(); @@ -79,9 +80,9 @@ 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); } -@@ -423,6 +431,16 @@ public abstract class PlayerList { +@@ -402,6 +410,16 @@ public abstract class PlayerList { entityplayer.playerTick();// SPIGOT-924 // CraftBukkit end @@ -98,7 +99,7 @@ index 5236948990..79641a73a8 100644 this.savePlayerFile(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getRootVehicle(); -@@ -1309,7 +1327,13 @@ public abstract class PlayerList { +@@ -1024,7 +1042,13 @@ public abstract class PlayerList { player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message } // CraftBukkit end diff --git a/Spigot-Server-Patches/0103-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/Spigot-Server-Patches/0092-Add-handshake-event-to-allow-plugins-to-handle-clien.patch similarity index 94% rename from Spigot-Server-Patches/0103-Add-handshake-event-to-allow-plugins-to-handle-clien.patch rename to Spigot-Server-Patches/0092-Add-handshake-event-to-allow-plugins-to-handle-clien.patch index 8ddd808e35..f44d8a8189 100644 --- a/Spigot-Server-Patches/0103-Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/Spigot-Server-Patches/0092-Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -1,4 +1,4 @@ -From 0c770889d29575a1aca2bfa1a966aed02ca1c94a Mon Sep 17 00:00:00 2001 +From 51375e7d49a68f620fab5f1a66cb5637cb40a9de Mon Sep 17 00:00:00 2001 From: kashike Date: Wed, 13 Apr 2016 20:21:38 -0700 Subject: [PATCH] Add handshake event to allow plugins to handle client @@ -6,10 +6,10 @@ 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 -@@ -72,8 +72,33 @@ public class HandshakeListener implements PacketHandshakingInListener { +@@ -73,8 +73,33 @@ public class HandshakeListener implements PacketHandshakingInListener { this.b.close(chatmessage); } else { this.b.setPacketListener(new LoginListener(this.a, this.b)); diff --git a/Spigot-Server-Patches/0093-Configurable-RCON-IP-address.patch b/Spigot-Server-Patches/0093-Configurable-RCON-IP-address.patch new file mode 100644 index 0000000000..519d126b36 --- /dev/null +++ b/Spigot-Server-Patches/0093-Configurable-RCON-IP-address.patch @@ -0,0 +1,62 @@ +From 762544d6d7a753a902f7fbb433f3cfaaca07f643 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 16 Apr 2016 00:39:33 -0400 +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 +@@ -53,6 +53,8 @@ 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); +@@ -98,6 +100,10 @@ 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 e48d6dcd7..2ce490be0 100644 +--- a/src/main/java/net/minecraft/server/RemoteControlListener.java ++++ b/src/main/java/net/minecraft/server/RemoteControlListener.java +@@ -25,7 +25,7 @@ public class RemoteControlListener extends RemoteConnectionThread { + + 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"; + } +-- +2.21.0 + diff --git a/Spigot-Server-Patches/0105-Prevent-Fire-from-loading-chunks.patch b/Spigot-Server-Patches/0094-Prevent-Fire-from-loading-chunks.patch similarity index 66% rename from Spigot-Server-Patches/0105-Prevent-Fire-from-loading-chunks.patch rename to Spigot-Server-Patches/0094-Prevent-Fire-from-loading-chunks.patch index d9a1d5b92b..540b42c09d 100644 --- a/Spigot-Server-Patches/0105-Prevent-Fire-from-loading-chunks.patch +++ b/Spigot-Server-Patches/0094-Prevent-Fire-from-loading-chunks.patch @@ -1,4 +1,4 @@ -From b44e245e5b5a0dcedd1d41c27db96130b929ead7 Mon Sep 17 00:00:00 2001 +From d26dc9b1fa65c8017685b172d9716a2bde604175 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 17 Apr 2016 17:27:09 -0400 Subject: [PATCH] Prevent Fire from loading chunks @@ -7,26 +7,28 @@ 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 -@@ -161,6 +161,7 @@ public class BlockFire extends Block { +@@ -163,6 +163,7 @@ 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); if (l1 > 0) { -@@ -206,10 +207,14 @@ public class BlockFire extends Block { +@@ -208,10 +209,16 @@ public class BlockFire extends Block { } 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) { @@ -35,19 +37,21 @@ index e09a586977..3f421d46a0 100644 // CraftBukkit start org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -@@ -266,7 +271,11 @@ public class BlockFire extends Block { +@@ -269,8 +276,12 @@ 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; -- 2.21.0 diff --git a/Spigot-Server-Patches/0106-Implement-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/0095-Implement-PlayerLocaleChangeEvent.patch similarity index 82% rename from Spigot-Server-Patches/0106-Implement-PlayerLocaleChangeEvent.patch rename to Spigot-Server-Patches/0095-Implement-PlayerLocaleChangeEvent.patch index 6dd5e4b21f..9fceb63dcc 100644 --- a/Spigot-Server-Patches/0106-Implement-PlayerLocaleChangeEvent.patch +++ b/Spigot-Server-Patches/0095-Implement-PlayerLocaleChangeEvent.patch @@ -1,23 +1,23 @@ -From bf7af916f9eb07cbe2f9a6e1d0c919a06bb99191 Mon Sep 17 00:00:00 2001 +From 75eff88fb2e2b9bb608a0e69a7a173085eea922c Mon Sep 17 00:00:00 2001 From: Isaac Moore Date: Tue, 19 Apr 2016 14:09:31 -0500 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 -@@ -33,7 +33,7 @@ import org.bukkit.inventory.MainHand; +@@ -36,7 +36,7 @@ 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; public final MinecraftServer server; public final PlayerInteractManager playerInteractManager; -@@ -1266,13 +1266,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1423,13 +1423,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT); this.server.server.getPluginManager().callEvent(event); } @@ -36,14 +36,14 @@ 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 -@@ -1721,8 +1721,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1747,8 +1747,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { @@ -56,7 +56,7 @@ index ff9c2c04f3..59bfcce68d 100644 } // Paper start -@@ -1811,7 +1813,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1827,7 +1829,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { diff --git a/Spigot-Server-Patches/0107-EntityRegainHealthEvent-isFastRegen-API.patch b/Spigot-Server-Patches/0096-EntityRegainHealthEvent-isFastRegen-API.patch similarity index 79% rename from Spigot-Server-Patches/0107-EntityRegainHealthEvent-isFastRegen-API.patch rename to Spigot-Server-Patches/0096-EntityRegainHealthEvent-isFastRegen-API.patch index 453f9aa35e..dca1633a46 100644 --- a/Spigot-Server-Patches/0107-EntityRegainHealthEvent-isFastRegen-API.patch +++ b/Spigot-Server-Patches/0096-EntityRegainHealthEvent-isFastRegen-API.patch @@ -1,4 +1,4 @@ -From 3910692335aa74b78d0352cbc8736c6b8ebcb80f Mon Sep 17 00:00:00 2001 +From c246fe0efb76eae003ec61c0992ff8c4e4f3ae07 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 22 Apr 2016 01:43:11 -0500 Subject: [PATCH] EntityRegainHealthEvent isFastRegen API @@ -6,10 +6,10 @@ 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 -@@ -873,10 +873,16 @@ public abstract class EntityLiving extends Entity { +@@ -963,10 +963,16 @@ public abstract class EntityLiving extends Entity { } public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) { @@ -23,15 +23,15 @@ 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 -@@ -65,7 +65,7 @@ public class FoodMetaData { +@@ -69,7 +69,7 @@ public class FoodMetaData { if (this.foodTickTimer >= 10) { float f = Math.min(this.saturationLevel, 6.0F); diff --git a/Spigot-Server-Patches/0108-Add-ability-to-configure-frosted_ice-properties.patch b/Spigot-Server-Patches/0097-Add-ability-to-configure-frosted_ice-properties.patch similarity index 80% rename from Spigot-Server-Patches/0108-Add-ability-to-configure-frosted_ice-properties.patch rename to Spigot-Server-Patches/0097-Add-ability-to-configure-frosted_ice-properties.patch index b2df4d5f1f..5cd87611c2 100644 --- a/Spigot-Server-Patches/0108-Add-ability-to-configure-frosted_ice-properties.patch +++ b/Spigot-Server-Patches/0097-Add-ability-to-configure-frosted_ice-properties.patch @@ -1,14 +1,14 @@ -From f72e611c6ce91816e01957a1b15a61e29e76b0a6 Mon Sep 17 00:00:00 2001 +From 1b74e3cb58a144c914a29d1158c06596d2ef751a Mon Sep 17 00:00:00 2001 From: kashike Date: Thu, 21 Apr 2016 23:51:55 -0700 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 -@@ -269,4 +269,14 @@ public class PaperWorldConfig { +@@ -255,4 +255,14 @@ public class PaperWorldConfig { private void useVanillaScoreboardColoring() { useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false); } @@ -24,27 +24,27 @@ 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 -@@ -12,6 +12,7 @@ public class BlockIceFrost extends BlockIce { - } +@@ -13,6 +13,7 @@ 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; -@@ -27,7 +28,7 @@ public class BlockIceFrost extends BlockIce { +@@ -28,7 +29,7 @@ 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 } } } catch (Throwable throwable1) { -@@ -49,7 +50,7 @@ public class BlockIceFrost extends BlockIce { +@@ -50,7 +51,7 @@ public class BlockIceFrost extends BlockIce { } } else { diff --git a/Spigot-Server-Patches/0109-remove-null-possibility-for-getServer-singleton.patch b/Spigot-Server-Patches/0098-remove-null-possibility-for-getServer-singleton.patch similarity index 53% rename from Spigot-Server-Patches/0109-remove-null-possibility-for-getServer-singleton.patch rename to Spigot-Server-Patches/0098-remove-null-possibility-for-getServer-singleton.patch index 0c16a42ef4..3198ddd621 100644 --- a/Spigot-Server-Patches/0109-remove-null-possibility-for-getServer-singleton.patch +++ b/Spigot-Server-Patches/0098-remove-null-possibility-for-getServer-singleton.patch @@ -1,4 +1,4 @@ -From 29606f9f5c0510848c92ee9e704c086315c30074 Mon Sep 17 00:00:00 2001 +From d8085c16c673d63ddda105426826b113e4c1aee5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 28 Apr 2016 00:57:27 -0400 Subject: [PATCH] remove null possibility for getServer singleton @@ -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 -@@ -68,6 +68,7 @@ import co.aikar.timings.MinecraftTimings; // Paper +@@ -61,6 +61,7 @@ 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; -@@ -157,6 +158,8 @@ 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(); +@@ -166,6 +167,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant(ResourcePackLoader::new); - this.ag = new CraftingManager(); -@@ -1825,7 +1828,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati - // CraftBukkit start + this.ai = new CraftingManager(); +@@ -1893,7 +1895,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Fri, 29 Apr 2016 20:02:00 -0400 Subject: [PATCH] Improve Maps (in item frames) performance and bug fixes @@ -13,10 +13,10 @@ 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 -@@ -615,6 +615,12 @@ public abstract class EntityHuman extends EntityLiving { +@@ -590,6 +590,12 @@ public abstract class EntityHuman extends EntityLiving { return null; } // CraftBukkit end @@ -25,35 +25,23 @@ 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 -@@ -1072,6 +1072,7 @@ 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 -@@ -30,6 +30,7 @@ public class WorldMap extends PersistentBase { - private final Map k = Maps.newHashMap(); - public Map decorations = Maps.newLinkedHashMap(); - private final Map l = Maps.newHashMap(); +@@ -31,6 +31,7 @@ public class WorldMap extends PersistentBase { + 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 public final CraftMapView mapView; -@@ -42,6 +43,7 @@ public class WorldMap extends PersistentBase { +@@ -43,6 +44,7 @@ public class WorldMap extends PersistentBase { // CraftBukkit start mapView = new CraftMapView(this); server = (CraftServer) org.bukkit.Bukkit.getServer(); @@ -61,23 +49,23 @@ index 5c09085a6b..a819d60375 100644 // CraftBukkit end } -@@ -107,6 +109,7 @@ public class WorldMap extends PersistentBase { - this.k.put(mapiconbanner.f(), mapiconbanner); +@@ -110,6 +112,7 @@ public class WorldMap extends PersistentBase { + 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 NBTTagList nbttaglist1 = nbttagcompound.getList("frames", 10); -@@ -169,6 +172,7 @@ public class WorldMap extends PersistentBase { - return nbttagcompound; +@@ -184,6 +187,7 @@ public class WorldMap extends PersistentBase { + 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); -@@ -404,6 +408,21 @@ public class WorldMap extends PersistentBase { +@@ -419,6 +423,21 @@ public class WorldMap extends PersistentBase { public class WorldMapHumanTracker { @@ -95,11 +83,11 @@ 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; -@@ -420,9 +439,12 @@ public class WorldMap extends PersistentBase { +@@ -435,9 +454,12 @@ public class WorldMap extends PersistentBase { @Nullable public Packet a(ItemStack itemstack) { // CraftBukkit start @@ -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 +@@ -1045,6 +1045,7 @@ 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 @@ -5,7 +5,7 @@ import org.bukkit.map.MapCursor; diff --git a/Spigot-Server-Patches/0111-LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/0100-LootTable-API-Replenishable-Lootables-Feature.patch similarity index 86% rename from Spigot-Server-Patches/0111-LootTable-API-Replenishable-Lootables-Feature.patch rename to Spigot-Server-Patches/0100-LootTable-API-Replenishable-Lootables-Feature.patch index 4b4a9c85e8..4f20b10fb0 100644 --- a/Spigot-Server-Patches/0111-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/0100-LootTable-API-Replenishable-Lootables-Feature.patch @@ -1,4 +1,4 @@ -From b5c5fe130ae42288c1b008a77039502bcd3b441c Mon Sep 17 00:00:00 2001 +From 472adc5afb5e00d4237f753c14899bd06f52071f Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 1 May 2016 21:19:14 -0400 Subject: [PATCH] LootTable API & Replenishable Lootables Feature @@ -11,10 +11,10 @@ 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 -@@ -279,4 +279,26 @@ public class PaperWorldConfig { +@@ -265,4 +265,26 @@ public class PaperWorldConfig { this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax); log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax); } @@ -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 +1,33 @@ @@ -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 +1,28 @@ @@ -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 +1,71 @@ @@ -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 +1,179 @@ @@ -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 +1,64 @@ @@ -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 +1,67 @@ @@ -520,10 +520,10 @@ 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 -@@ -67,6 +67,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -69,6 +69,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } @@ -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 @@ -15,10 +15,11 @@ 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; -@@ -168,12 +169,13 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp - +@@ -169,12 +170,13 @@ 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); } @@ -563,58 +563,57 @@ index 520cca48cc..e228fc8538 100644 ContainerUtil.a(nbttagcompound, this.items); } -@@ -181,11 +183,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp - +@@ -183,11 +185,12 @@ 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 ContainerUtil.b(nbttagcompound, this.items); } -@@ -234,10 +237,10 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp +@@ -213,10 +216,10 @@ 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 -@@ -5,9 +5,10 @@ import javax.annotation.Nullable; +@@ -6,8 +6,9 @@ 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); -@@ -23,16 +24,18 @@ public abstract class TileEntityLootable extends TileEntityContainer implements +@@ -23,16 +24,18 @@ 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 { -@@ -41,15 +44,15 @@ public abstract class TileEntityLootable extends TileEntityContainer implements - nbttagcompound.setLong("LootTableSeed", this.h); +@@ -41,15 +44,15 @@ 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 @@ -61,7 +61,7 @@ public class CraftBlockEntityState extends CraftBlockState @@ -660,10 +659,10 @@ 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 -@@ -13,8 +13,9 @@ import org.bukkit.craftbukkit.CraftWorld; +@@ -12,8 +12,9 @@ import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.inventory.CraftInventory; import org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest; import org.bukkit.inventory.Inventory; @@ -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 @@ -1,5 +1,6 @@ @@ -685,7 +684,7 @@ index 7ef68bb626..daf183fb10 100644 import net.minecraft.server.MinecraftKey; import net.minecraft.server.TileEntityLootable; import org.bukkit.Bukkit; -@@ -11,7 +12,7 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; +@@ -10,7 +11,7 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; import org.bukkit.loot.LootTable; import org.bukkit.loot.Lootable; @@ -694,7 +693,7 @@ index 7ef68bb626..daf183fb10 100644 public CraftLootable(Block block, Class tileEntityClass) { super(block, tileEntityClass); -@@ -69,7 +70,7 @@ public abstract class CraftLootable extends CraftC +@@ -54,7 +55,7 @@ public abstract class CraftLootable extends CraftC setLootTable(getLootTable(), seed); } @@ -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 @@ -1,5 +1,6 @@ @@ -712,9 +711,9 @@ index 1b5b266c05..e0b99207b2 100644 +import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper import net.minecraft.server.EntityMinecartChest; - import org.bukkit.craftbukkit.CraftServer; -@@ -9,7 +10,7 @@ import org.bukkit.entity.minecart.StorageMinecart; + import org.bukkit.craftbukkit.inventory.CraftInventory; +@@ -8,7 +9,7 @@ import org.bukkit.entity.minecart.StorageMinecart; import org.bukkit.inventory.Inventory; @SuppressWarnings("deprecation") @@ -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 @@ -47,7 +47,7 @@ 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 @@ -1,5 +1,6 @@ @@ -745,9 +744,9 @@ index f29365c948..1937f7b9a2 100644 +import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper import net.minecraft.server.EntityMinecartHopper; - import org.bukkit.craftbukkit.CraftServer; -@@ -8,7 +9,7 @@ import org.bukkit.entity.EntityType; + import org.bukkit.craftbukkit.inventory.CraftInventory; +@@ -7,7 +8,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.minecart.HopperMinecart; import org.bukkit.inventory.Inventory; diff --git a/Spigot-Server-Patches/0113-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/Spigot-Server-Patches/0101-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch similarity index 85% rename from Spigot-Server-Patches/0113-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch rename to Spigot-Server-Patches/0101-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index 3c83f6829b..f26460bdc1 100644 --- a/Spigot-Server-Patches/0113-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/Spigot-Server-Patches/0101-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -1,14 +1,14 @@ -From c3a16fc0fb33437dd1096f445f7b2c2e15c78c16 Mon Sep 17 00:00:00 2001 +From dd5edda1525f452645902b8344a46fc617bfe8ed Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 7 May 2016 23:33:08 -0400 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 -@@ -238,4 +238,9 @@ public class PaperConfig { +@@ -225,4 +225,9 @@ public class PaperConfig { private static void enablePlayerCollisions() { enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true); } @@ -19,10 +19,10 @@ 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 -@@ -177,6 +177,7 @@ public class PersistentScoreboard extends PersistentBase { +@@ -174,6 +174,7 @@ public class PersistentScoreboard extends PersistentBase { while (iterator.hasNext()) { ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next(); diff --git a/Spigot-Server-Patches/0114-System-property-for-disabling-watchdoge.patch b/Spigot-Server-Patches/0102-System-property-for-disabling-watchdoge.patch similarity index 89% rename from Spigot-Server-Patches/0114-System-property-for-disabling-watchdoge.patch rename to Spigot-Server-Patches/0102-System-property-for-disabling-watchdoge.patch index 72473fcd13..de93aaf498 100644 --- a/Spigot-Server-Patches/0114-System-property-for-disabling-watchdoge.patch +++ b/Spigot-Server-Patches/0102-System-property-for-disabling-watchdoge.patch @@ -1,11 +1,11 @@ -From c9943e056e9e489ad5907e5b2d7e99b1602550f7 Mon Sep 17 00:00:00 2001 +From 1903e90b74e09bde64878c01584df9d90cfa8815 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 12 May 2016 23:02:58 -0500 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 @@ -57,7 +57,7 @@ public class WatchdogThread extends Thread diff --git a/Spigot-Server-Patches/0104-Configurable-RCON-IP-address.patch b/Spigot-Server-Patches/0104-Configurable-RCON-IP-address.patch deleted file mode 100644 index 9dd8e6828d..0000000000 --- a/Spigot-Server-Patches/0104-Configurable-RCON-IP-address.patch +++ /dev/null @@ -1,23 +0,0 @@ -From faa24a31538552e4bf1ee189e86a98c49798bb93 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 16 Apr 2016 00:39:33 -0400 -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/RemoteControlListener.java b/src/main/java/net/minecraft/server/RemoteControlListener.java -index 81a6a8fc9e..7b82c4dea2 100644 ---- a/src/main/java/net/minecraft/server/RemoteControlListener.java -+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java -@@ -24,7 +24,7 @@ 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; --- -2.21.0 - diff --git a/Spigot-Server-Patches/0094-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/removed/1.14/0094-Configurable-Keep-Spawn-Loaded-range-per-world.patch similarity index 100% rename from Spigot-Server-Patches/0094-Configurable-Keep-Spawn-Loaded-range-per-world.patch rename to removed/1.14/0094-Configurable-Keep-Spawn-Loaded-range-per-world.patch diff --git a/Spigot-Server-Patches/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch b/removed/1.14/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch similarity index 100% rename from Spigot-Server-Patches/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch rename to removed/1.14/0096-Don-t-spam-reload-spawn-chunks-in-nether-end.patch diff --git a/Spigot-Server-Patches/0112-Entity-Tracking-Improvements.patch b/removed/1.14/0112-Entity-Tracking-Improvements.patch similarity index 100% rename from Spigot-Server-Patches/0112-Entity-Tracking-Improvements.patch rename to removed/1.14/0112-Entity-Tracking-Improvements.patch