From 93a7205ba809a6e0233ea8072a58bc56bf3c6d01 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Mon, 16 Jul 2018 16:34:55 +0100 Subject: [PATCH] NOT FINISHED!!! More progress on 1.13-pre7 This work is unfinished, keep your paws off this branch! --- ...-to-configure-frosted_ice-properties.patch | 29 +- ...ent-to-allow-plugins-to-handle-clien.patch | 47 --- .../Add-server-name-parameter.patch | 2 +- ...blocking-on-Network-Manager-creation.patch | 19 +- .../Configurable-Player-Collision.patch | 116 ------ .../Configurable-RCON-IP-address.patch | 21 - .../Do-not-load-chunks-for-pathfinding.patch | 4 +- ...hunks-as-active-for-neighbor-updates.patch | 46 --- ...y-scoreboard-teams-to-scoreboard.dat.patch | 2 +- .../Don-t-tick-Skulls-unused-code.patch | 20 - .../Ensure-Chunks-never-ever-load-async.patch | 8 +- Spigot-Server-Patches/Entity-Origin-API.patch | 4 +- .../Entity-Tracking-Improvements.patch | 6 +- ...ityRegainHealthEvent-isFastRegen-API.patch | 43 -- ...r-redstone-torch-rapid-clock-removal.patch | 14 +- ...Fix-Bugs-with-Spigot-Mob-Spawn-Logic.patch | 58 --- .../Fix-Chunk-Unload-Queue-Issues.patch | 18 +- ...-FallingBlocks-being-stuck-on-fences.patch | 103 ----- .../Implement-PlayerLocaleChangeEvent.patch | 67 --- ...item-frames-performance-and-bug-fixe.patch | 27 +- ...-API-Replenishable-Lootables-Feature.patch | 88 ++-- .../Make-entities-look-for-hoppers.patch | 381 ------------------ ...on-Wither-Death-sounds-to-same-world.patch | 6 +- Spigot-Server-Patches/Optimize-EAR.patch | 3 +- Spigot-Server-Patches/Optimize-Hoppers.patch | 282 ------------- .../Optimize-UserCache-Thread-Safe.patch | 19 +- .../Optional-TNT-doesn-t-move-in-water.patch | 19 +- .../Prevent-Fire-from-loading-chunks.patch | 51 --- ...-dispenser-dropper-furnace-placement.patch | 53 --- .../Toggleable-Elytra-Wall-Damage.patch | 43 -- .../Vehicle-Event-Cancellation-Changes.patch | 18 +- ...-possibility-for-getServer-singleton.patch | 16 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 35 files changed, 149 insertions(+), 1490 deletions(-) delete mode 100644 Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch delete mode 100644 Spigot-Server-Patches/Configurable-Player-Collision.patch delete mode 100644 Spigot-Server-Patches/Configurable-RCON-IP-address.patch delete mode 100644 Spigot-Server-Patches/Do-not-mark-chunks-as-active-for-neighbor-updates.patch delete mode 100644 Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch delete mode 100644 Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch delete mode 100644 Spigot-Server-Patches/Fix-Bugs-with-Spigot-Mob-Spawn-Logic.patch delete mode 100644 Spigot-Server-Patches/Fix-FallingBlocks-being-stuck-on-fences.patch delete mode 100644 Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch delete mode 100644 Spigot-Server-Patches/Make-entities-look-for-hoppers.patch delete mode 100644 Spigot-Server-Patches/Optimize-Hoppers.patch delete mode 100644 Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch delete mode 100644 Spigot-Server-Patches/SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch delete mode 100644 Spigot-Server-Patches/Toggleable-Elytra-Wall-Damage.patch diff --git a/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch b/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch index e788a0ead3..7b836f4bf4 100644 --- a/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch +++ b/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ability to configure frosted_ice properties diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 6ea608ba9..d96311f6b 100644 +index ff9929a05..0c50cb4bd 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -24,23 +24,26 @@ index 6ea608ba9..d96311f6b 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java -index 950863fb9..a8dbbf20a 100644 +index 1d5c24c7a..77cf6b8e9 100644 --- a/src/main/java/net/minecraft/server/BlockIceFrost.java +++ b/src/main/java/net/minecraft/server/BlockIceFrost.java @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { } - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { + public void a(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.c(world, blockposition) < 4) && world.getLightLevel(blockposition) > 11 - ((Integer) iblockdata.get(BlockIceFrost.a)).intValue() - iblockdata.c()) { - this.a(world, blockposition, iblockdata, random, true); - } else { -- world.a(blockposition, (Block) this, MathHelper.nextInt(random, 20, 40)); -+ // Paper start - use configurable min/max delay -+ //world.a(blockposition, (Block) this, MathHelper.nextInt(random, 20, 40)); -+ world.a(blockposition, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); -+ // Paper end - } + if ((random.nextInt(3) == 0 || this.a(world, blockposition, 4)) && world.getLightLevel(blockposition) > 11 - ((Integer) iblockdata.get(BlockIceFrost.a)).intValue() - iblockdata.b(world, blockposition) && this.c(iblockdata, world, blockposition)) { + BlockPosition.b blockposition_b = BlockPosition.b.r(); + Throwable throwable = null; +@@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { + IBlockData iblockdata1 = world.getType(blockposition_b); - } + if (iblockdata1.getBlock() == this && !this.c(iblockdata1, world, blockposition_b)) { +- world.I().a(blockposition_b, this, MathHelper.nextInt(random, 20, 40)); ++ // Paper start - use configurable min/max delay ++ world.I().a(blockposition_b, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); ++ // Paper end + } + } + } catch (Throwable throwable1) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch deleted file mode 100644 index 1c2ffd791f..0000000000 --- a/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Riley Park -Date: Wed, 13 Apr 2016 20:21:38 -0700 -Subject: [PATCH] Add handshake event to allow plugins to handle client - handshaking logic themselves - - -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 7c75433f5..088ec198e 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { - this.b.close(chatmessage); - } else { - this.b.setPacketListener(new LoginListener(this.a, this.b)); -+ // Paper start - handshake event -+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee; -+ boolean handledByEvent = false; -+ // Try and handle the handshake through the event -+ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me? -+ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packethandshakinginsetprotocol.hostname, !proxyLogicEnabled); -+ if (event.callEvent()) { -+ // If we've failed somehow, let the client know so and go no further. -+ if (event.isFailed()) { -+ chatmessage = new ChatMessage(event.getFailMessage()); -+ this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); -+ this.b.close(chatmessage); -+ return; -+ } -+ -+ packethandshakinginsetprotocol.hostname = event.getServerHostname(); -+ this.b.l = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.b.getSocketAddress()).getPort()); -+ this.b.spoofedUUID = event.getUniqueId(); -+ this.b.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); -+ handledByEvent = true; // Hooray, we did it! -+ } -+ } -+ // Don't try and handle default logic if it's been handled by the event. -+ if (!handledByEvent && proxyLogicEnabled) { -+ // Paper end - // Spigot Start -- if (org.spigotmc.SpigotConfig.bungee) { -+ //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! - String[] split = packethandshakinginsetprotocol.hostname.split("\00"); - if ( split.length == 3 || split.length == 4 ) { - packethandshakinginsetprotocol.hostname = split[0]; --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-server-name-parameter.patch b/Spigot-Server-Patches/Add-server-name-parameter.patch index 20efd4aa37..b6307358dd 100644 --- a/Spigot-Server-Patches/Add-server-name-parameter.patch +++ b/Spigot-Server-Patches/Add-server-name-parameter.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add server-name parameter diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index f95da9e26..d565a720f 100644 +index d9059129d..aad208f47 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { diff --git a/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch b/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch index f9a0aea3e9..a68c6ccff6 100644 --- a/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch +++ b/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch @@ -6,37 +6,36 @@ Subject: [PATCH] Avoid blocking on Network Manager creation Per Paper issue 294 diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index 567edb300..4a629aaa1 100644 +index be8d07f41..ad49673c1 100644 --- a/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java @@ -0,0 +0,0 @@ public class ServerConnection { - public volatile boolean d; - private final List g = Collections.synchronizedList(Lists.newArrayList()); - private final List h = Collections.synchronizedList(Lists.newArrayList()); + public volatile boolean c; + private final List f = Collections.synchronizedList(Lists.newArrayList()); + private final List g = Collections.synchronizedList(Lists.newArrayList()); + // Paper start - prevent blocking on adding a new network manager while the server is ticking + private final List pending = Collections.synchronizedList(Lists.newArrayList()); + private void addPending() { + synchronized (pending) { -+ this.h.addAll(pending); // Paper - OBFHELPER - List of network managers ++ this.g.addAll(pending); // Paper - OBFHELPER - List of network managers + pending.clear(); + } + } + // Paper end public ServerConnection(MinecraftServer minecraftserver) { - this.f = minecraftserver; + this.e = minecraftserver; @@ -0,0 +0,0 @@ public class ServerConnection { - channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); -- ServerConnection.this.h.add(networkmanager); + ServerConnection.this.g.add(networkmanager); + pending.add(networkmanager); // Paper channel.pipeline().addLast("packet_handler", networkmanager); - networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.f, networkmanager)); + networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.e, networkmanager)); } @@ -0,0 +0,0 @@ public class ServerConnection { - synchronized (this.h) { + synchronized (this.g) { // Spigot Start + addPending(); // Paper // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order diff --git a/Spigot-Server-Patches/Configurable-Player-Collision.patch b/Spigot-Server-Patches/Configurable-Player-Collision.patch deleted file mode 100644 index ed20a6c7e6..0000000000 --- a/Spigot-Server-Patches/Configurable-Player-Collision.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 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 ec4643384..430b5d0cd 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -0,0 +0,0 @@ public class PaperConfig { - private static void regionFileCacheSize() { - regionFileCacheSize = getInt("settings.region-file-cache-size", 256); - } -+ -+ public static boolean enablePlayerCollisions = true; -+ private static void enablePlayerCollisions() { -+ enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true); -+ } - } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b7aa9e869..c5670fe8d 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati - - this.a(this.getDifficulty()); - this.g_(); -+ -+ // Paper start - Handle collideRule team for player collision toggle -+ final Scoreboard scoreboard = this.getScoreboard(); -+ final java.util.Collection toRemove = scoreboard.getTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(ScoreboardTeam::getName).collect(java.util.stream.Collectors.toList()); -+ for (String teamName : toRemove) { -+ scoreboard.removeTeam(scoreboard.getTeam(teamName)); // Clean up after ourselves -+ } -+ -+ if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) { -+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + worlds.get(0).random.nextInt(), 16); -+ ScoreboardTeam collideTeam = scoreboard.createTeam(this.getPlayerList().collideRuleTeamName); -+ collideTeam.setCanSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all -+ } -+ // Paper end - } - - protected void a(File file, WorldData worlddata) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -index 5f54e7b9c..759288b97 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -@@ -0,0 +0,0 @@ public class PacketPlayOutScoreboardTeam implements Packet playersByName = new org.spigotmc.CaseInsensitiveMap(); -+ @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule - - public PlayerList(MinecraftServer minecraftserver) { - this.cserver = minecraftserver.server = new CraftServer(minecraftserver, this); -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } - - entityplayer.syncInventory(); -+ // Paper start - Add to collideRule team if needed -+ final Scoreboard scoreboard = this.getServer().getWorld().getScoreboard(); -+ if (this.collideRuleTeamName != null && scoreboard.getTeam(collideRuleTeamName) != null && entityplayer.getTeam() == null) { -+ scoreboard.addPlayerToTeam(entityplayer.getName(), collideRuleTeamName); -+ } -+ // Paper end - // CraftBukkit - Moved from above, added world - PlayerList.f.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, Integer.valueOf(entityplayer.getId()), entityplayer.world.worldData.getName(), Double.valueOf(entityplayer.locX), Double.valueOf(entityplayer.locY), Double.valueOf(entityplayer.locZ)); - } -@@ -0,0 +0,0 @@ public abstract class PlayerList { - entityplayer.playerTick();// SPIGOT-924 - // CraftBukkit end - -+ // Paper start - Remove from collideRule team if needed -+ if (this.collideRuleTeamName != null) { -+ final Scoreboard scoreBoard = this.server.getWorld().getScoreboard(); -+ final ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName); -+ if (entityplayer.getTeam() == team && team != null) { -+ scoreBoard.removePlayerFromTeam(entityplayer.getName(), team); -+ } -+ } -+ // Paper end -+ - this.savePlayerFile(entityplayer); - if (entityplayer.isPassenger()) { - Entity entity = entityplayer.getRootVehicle(); -@@ -0,0 +0,0 @@ public abstract class PlayerList { - player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message - } - // CraftBukkit end -- -+ // Paper start - Remove collideRule team if it exists -+ if (this.collideRuleTeamName != null) { -+ final Scoreboard scoreboard = this.getServer().getWorld().getScoreboard(); -+ final ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName); -+ if (team != null) scoreboard.removeTeam(team); -+ } -+ // Paper end - } - - // CraftBukkit start --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-RCON-IP-address.patch b/Spigot-Server-Patches/Configurable-RCON-IP-address.patch deleted file mode 100644 index 204dbae289..0000000000 --- a/Spigot-Server-Patches/Configurable-RCON-IP-address.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 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 6f0176f6f..1e5caa13a 100644 ---- a/src/main/java/net/minecraft/server/RemoteControlListener.java -+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java -@@ -0,0 +0,0 @@ public class RemoteControlListener extends RemoteConnectionThread { - super(iminecraftserver, "RCON Listener"); - this.h = iminecraftserver.a("rcon.port", 0); - this.l = iminecraftserver.a("rcon.password", ""); -- this.j = iminecraftserver.e(); -+ this.j = iminecraftserver.a("rcon.ip", iminecraftserver.d_()); // Paper - this.i = iminecraftserver.f(); - if (0 == this.h) { - this.h = this.i + 10; --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Do-not-load-chunks-for-pathfinding.patch b/Spigot-Server-Patches/Do-not-load-chunks-for-pathfinding.patch index 148374e2b1..06d7f634eb 100644 --- a/Spigot-Server-Patches/Do-not-load-chunks-for-pathfinding.patch +++ b/Spigot-Server-Patches/Do-not-load-chunks-for-pathfinding.patch @@ -5,10 +5,10 @@ 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 08b986fd7..786d1dd22 100644 +index 6d153e431..07444a86a 100644 --- a/src/main/java/net/minecraft/server/ChunkCache.java +++ b/src/main/java/net/minecraft/server/ChunkCache.java -@@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess { +@@ -0,0 +0,0 @@ public class ChunkCache implements IIBlockAccess { for (l = this.a; l <= j; ++l) { for (i1 = this.b; i1 <= k; ++i1) { diff --git a/Spigot-Server-Patches/Do-not-mark-chunks-as-active-for-neighbor-updates.patch b/Spigot-Server-Patches/Do-not-mark-chunks-as-active-for-neighbor-updates.patch deleted file mode 100644 index 44f74c1daa..0000000000 --- a/Spigot-Server-Patches/Do-not-mark-chunks-as-active-for-neighbor-updates.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 12 May 2016 01:55:17 -0400 -Subject: [PATCH] Do not mark chunks as active for neighbor updates - -Fixes chunk unload issues - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 1e78fc625..ba3ee64f8 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - // CraftBukkit end - world.timings.syncChunkLoadPostTimer.stopTiming(); // Paper - world.timings.syncChunkLoadPopulateNeighbors.startTiming(); // Paper -- Chunk chunk = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ - 1); -- Chunk chunk1 = ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ); -- Chunk chunk2 = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ + 1); -- Chunk chunk3 = ichunkprovider.getLoadedChunkAt(this.locX - 1, this.locZ); -+ Chunk chunk = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX, this.locZ - 1); // Paper -+ Chunk chunk1 = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX + 1, this.locZ); // Paper -+ Chunk chunk2 = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX, this.locZ + 1); // Paper -+ Chunk chunk3 = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX - 1, this.locZ); // Paper - -- if (chunk1 != null && chunk2 != null && ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ + 1) != null) { -+ if (chunk1 != null && chunk2 != null && MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX + 1, this.locZ + 1) != null) { // Paper - this.a(chunkgenerator); - } - -- if (chunk3 != null && chunk2 != null && ichunkprovider.getLoadedChunkAt(this.locX - 1, this.locZ + 1) != null) { -+ if (chunk3 != null && chunk2 != null && MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX - 1, this.locZ + 1) != null) { // Paper - chunk3.a(chunkgenerator); - } - -- if (chunk != null && chunk1 != null && ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ - 1) != null) { -+ if (chunk != null && chunk1 != null && MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX + 1, this.locZ - 1) != null) { // Paper - chunk.a(chunkgenerator); - } - - if (chunk != null && chunk3 != null) { -- Chunk chunk4 = ichunkprovider.getLoadedChunkAt(this.locX - 1, this.locZ - 1); -+ Chunk chunk4 = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX - 1, this.locZ - 1); // Paper - - if (chunk4 != null) { - chunk4.a(chunkgenerator); --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index eebb460ea8..2bdbdf22e7 100644 --- a/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -19,7 +19,7 @@ index 430b5d0cd..011cbf5e3 100644 + } } diff --git a/src/main/java/net/minecraft/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java -index c9c01fad9..89c8d045b 100644 +index 81afa3195..ed3d5c889 100644 --- a/src/main/java/net/minecraft/server/PersistentScoreboard.java +++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java @@ -0,0 +0,0 @@ public class PersistentScoreboard extends PersistentBase { diff --git a/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch b/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch deleted file mode 100644 index 172704d521..0000000000 --- a/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 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 db4967f24..804236547 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySkull.java -+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -0,0 +0,0 @@ import com.mojang.authlib.ProfileLookupCallback; - import java.util.concurrent.Callable; - // Spigot end - --public class TileEntitySkull extends TileEntity implements ITickable { -+public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable - - private GameProfile a; - private int e; --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Ensure-Chunks-never-ever-load-async.patch b/Spigot-Server-Patches/Ensure-Chunks-never-ever-load-async.patch index 88d97a7c02..48745058e4 100644 --- a/Spigot-Server-Patches/Ensure-Chunks-never-ever-load-async.patch +++ b/Spigot-Server-Patches/Ensure-Chunks-never-ever-load-async.patch @@ -27,7 +27,7 @@ index 7b7a3d01b..9aaca21a7 100644 public static void queueChunkLoad(World world, ChunkRegionLoader loader, ChunkProviderServer provider, int x, int z, Runnable runnable) { diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -index b5efb9c3f..ef9529add 100644 +index 52a8c48fa..a4fcdbe04 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java @@ -0,0 +0,0 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider -Date: Fri, 22 Apr 2016 01:43:11 -0500 -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 acf0e0281..b12c9e461 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - } - - public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) { -+ // Paper start - Forward -+ heal(f, regainReason, false); -+ } -+ -+ public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason, boolean isFastRegen) { -+ // Paper end - float f1 = this.getHealth(); - - 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()) { -diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java -index bbcc488bd..d886e476b 100644 ---- a/src/main/java/net/minecraft/server/FoodMetaData.java -+++ b/src/main/java/net/minecraft/server/FoodMetaData.java -@@ -0,0 +0,0 @@ public class FoodMetaData { - if (this.foodTickTimer >= 10) { - float f = Math.min(this.saturationLevel, 6.0F); - -- entityhuman.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason -+ entityhuman.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED, true); // CraftBukkit - added RegainReason // Paper - This is fast regen - this.a(f); - this.foodTickTimer = 0; - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Faster-redstone-torch-rapid-clock-removal.patch b/Spigot-Server-Patches/Faster-redstone-torch-rapid-clock-removal.patch index 5f40d75aae..a2bfc7fa77 100644 --- a/Spigot-Server-Patches/Faster-redstone-torch-rapid-clock-removal.patch +++ b/Spigot-Server-Patches/Faster-redstone-torch-rapid-clock-removal.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Faster redstone torch rapid clock removal Only resize the the redstone torch list once, since resizing arrays / lists is costly diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java -index 5b0028a78..429f26ed5 100644 +index 6a54da4d6..ebd47196b 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java @@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch { - boolean flag = this.g(world, blockposition, iblockdata); - List list = (List) BlockRedstoneTorch.g.get(world); + public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random, boolean flag) { + List list = (List) BlockRedstoneTorch.b.get(world); - while (list != null && !list.isEmpty() && world.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) { - list.remove(0); @@ -30,11 +30,11 @@ index 5b0028a78..429f26ed5 100644 // CraftBukkit start org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); @@ -0,0 +0,0 @@ public class BlockRedstoneTorch extends BlockTorch { - static class RedstoneUpdateInfo { + public static class RedstoneUpdateInfo { - BlockPosition a; -- long b; -+ long b; final long getTime() { return this.b; } // Paper - OBFHELPER + private final BlockPosition a; +- private final long b; ++ private final long b; final long getTime() { return this.b; } // Paper - OBFHELPER public RedstoneUpdateInfo(BlockPosition blockposition, long i) { this.a = blockposition; diff --git a/Spigot-Server-Patches/Fix-Bugs-with-Spigot-Mob-Spawn-Logic.patch b/Spigot-Server-Patches/Fix-Bugs-with-Spigot-Mob-Spawn-Logic.patch deleted file mode 100644 index 9d9ef2747b..0000000000 --- a/Spigot-Server-Patches/Fix-Bugs-with-Spigot-Mob-Spawn-Logic.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 14 Apr 2016 21:01:39 -0400 -Subject: [PATCH] Fix Bugs with Spigot Mob Spawn Logic - -Spigot drastically altered vanilla mob spawn logic and caused a few issues. -1) Used only spawnable chunks vs entire world for entity counting, resulting in ignoring -other entities in the world, and causing the world to go over its intended limit. - -Specially with servers using smaller mob spawn ranges than view distance, as well as affects spawning API - -2) Spigot was using 16x16 division instead of vanilla 17x17 division. - -This patch returns mob counting to use all loaded chunks, and 17x17 division. - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index e07ef14ed..aca1457b0 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - i = this.entitySlices.length - 1; - } - -- this.entitySlices[i].remove(entity); -+ if (!this.entitySlices[i].remove(entity)) { return; } // Paper - // Paper start - update counts - if (entity instanceof EntityItem) { - itemCounts[i]--; -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 45a83ae99..ed22607d9 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -0,0 +0,0 @@ public final class SpawnerCreature { - // Spigot start - get entity count only from chunks being processed in b - private int getEntityCount(WorldServer server, Class oClass) - { -+ // Paper start - use entire world, not just active chunks. Spigot broke vanilla expectations. -+ if (true) { -+ int sum = 0; -+ for (Chunk c : server.getChunkProviderServer().chunks.values()) { -+ sum += c.entityCount.get(oClass); -+ } -+ return sum; -+ } -+ // Paper end - int i = 0; - Iterator it = this.b.iterator(); - while ( it.hasNext() ) -@@ -0,0 +0,0 @@ public final class SpawnerCreature { - int l1 = limit * i / a; // CraftBukkit - use per-world limits - */ // Paper end - -- if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 256) { -+ if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 289) { // Paper - use 17x17 like vanilla (a at top of file) - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); - Iterator iterator1 = this.b.iterator(); - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-Chunk-Unload-Queue-Issues.patch b/Spigot-Server-Patches/Fix-Chunk-Unload-Queue-Issues.patch index 9dc9ddf175..16637d73cd 100644 --- a/Spigot-Server-Patches/Fix-Chunk-Unload-Queue-Issues.patch +++ b/Spigot-Server-Patches/Fix-Chunk-Unload-Queue-Issues.patch @@ -9,20 +9,20 @@ has not resolved all the bugs with the changes. This patch fixes known issues and really should be applied by Spigot team. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ba3ee64f8..857df2937 100644 +index aaa65582b..8ecdf7a5b 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - private long w; - private int x; - private final ConcurrentLinkedQueue y; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + private long A; public long getInhabitedTime() { return A; } // Paper - OBFHELPER + private int B; + private final ConcurrentLinkedQueue C; - public boolean d; + public boolean d; public void setShouldUnload(boolean unload) { this.d = unload; } public boolean isUnloading() { return d; } // Paper - OBFHELPER - protected gnu.trove.map.hash.TObjectIntHashMap entityCount = new gnu.trove.map.hash.TObjectIntHashMap(); // Spigot - - // Paper start + private ChunkStatus D; + private int E; + private final AtomicInteger F; diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 1771a1794..5cc192bbd 100644 +index bb96a7392..7825dc91b 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { diff --git a/Spigot-Server-Patches/Fix-FallingBlocks-being-stuck-on-fences.patch b/Spigot-Server-Patches/Fix-FallingBlocks-being-stuck-on-fences.patch deleted file mode 100644 index db0a98e291..0000000000 --- a/Spigot-Server-Patches/Fix-FallingBlocks-being-stuck-on-fences.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Martin Panzer -Date: Fri, 3 Jun 2016 23:13:39 +0200 -Subject: [PATCH] Fix FallingBlocks being stuck on fences - -Fallingblocks would previously only check if directly beneath them a block exists. They also -hover on top of the 1.5 block tall hitbox of fences during these check. This -resulted in them always thinking they would be on air. - -We now first check, if if we are already on the ground. -if not, we check if the falling block is inside of the hitbox of the block at y - 1. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 06acdaaf0..600e603bd 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false); - log("Prevent TNT from moving in water: " + preventTntFromMovingInWater); - } -+ -+ public boolean altFallingBlockOnGround; -+ private void altFallingBlockOnGround() { -+ altFallingBlockOnGround = getBoolean("use-alternate-fallingblock-onGround-detection", false); -+ } - } -diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java -index 674395756..1086e3117 100644 ---- a/src/main/java/net/minecraft/server/BlockFalling.java -+++ b/src/main/java/net/minecraft/server/BlockFalling.java -@@ -0,0 +0,0 @@ public class BlockFalling extends Block { - return block == Blocks.FIRE || material == Material.AIR || material == Material.WATER || material == Material.LAVA; - } - -+ // Paper start - OBFHELPER -+ public static boolean canMoveThrough(IBlockData blockdata) { -+ return BlockFalling.x(blockdata); -+ } -+ // Paper end -+ - public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} - - public void a_(World world, BlockPosition blockposition) {} -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index abdc2dea9..59acc9088 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - import com.google.common.collect.Lists; - import java.util.ArrayList; - import java.util.Iterator; -+import java.util.List; - import javax.annotation.Nullable; - - import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit -@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { - } - } else { - IBlockData iblockdata = this.world.getType(blockposition); -- -- if (!flag1 && BlockFalling.x(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) { -+ -+ if (!isOnGround()) { - this.onGround = false; -- // return; // CraftBukkit -+ if (this.world.paperConfig.altFallingBlockOnGround) return; // Paper - } - - this.motX *= 0.699999988079071D; -@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { - } - } - -+ // Paper start -+ private boolean isOnGround() { -+ BlockPosition where = new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ); -+ boolean cannotMoveThrough = !BlockFalling.canMoveThrough(this.world.getType(where)); -+ if (!this.world.paperConfig.altFallingBlockOnGround) return cannotMoveThrough; -+ -+ if (cannotMoveThrough) { -+ return true; -+ } -+ -+ IBlockData blockData = this.world.getType(where.down()); -+ if (BlockFalling.canMoveThrough(blockData)) { -+ return false; -+ } -+ -+ List list = new ArrayList<>(); -+ addCollisions(blockData, getWorld(), where, this.getBoundingBox(), list, this); -+ return list.size() > 0; -+ } -+ -+ // OBFHELPER -+ private void addCollisions(IBlockData blockData, World world, BlockPosition where, AxisAlignedBB collider, List list, Entity entity) { -+ blockData.a(world, where, collider, list, entity, false); -+ } -+ // Paper end -+ - public void e(float f, float f1) { - Block block = this.block.getBlock(); - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch deleted file mode 100644 index cd583db25a..0000000000 --- a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 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 5ca0dec1f..8b5cfc78a 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - private static final Logger cc = LogManager.getLogger(); - private static final IChatBaseComponent cd = (new ChatMessage("multiplayer.message_not_delivered", new Object[0])).a(EnumChatFormat.RED); -- 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; -@@ -0,0 +0,0 @@ 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); - } -- if (!this.locale.equals(packetplayinsettings.a())) { -+ if (this.locale == null || !this.locale.equals(packetplayinsettings.b())) { // Paper - fix bug and check for null - PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.b()); - this.server.server.getPluginManager().callEvent(event); - } - // CraftBukkit end -+ // Paper start - add PlayerLocaleChangeEvent -+ // Since the field is initialized to null, this event should always fire the first time the packet is received -+ String oldLocale = this.locale; - this.locale = packetplayinsettings.b(); -+ if (!this.locale.equals(oldLocale)) { -+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent(); -+ } -+ // Paper end - this.ct = packetplayinsettings.d(); - this.cu = packetplayinsettings.e(); - this.getDataWatcher().set(EntityPlayer.bx, Byte.valueOf((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 3871f3100..7d4355439 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - - @Override - public String getLocale() { -- return getHandle().locale; -- -+ // Paper start - Locale change event -+ final String locale = getHandle().locale; -+ return locale != null ? locale : "en_us"; -+ // Paper end - } - - // Paper start -@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - @Override - public String getLocale() - { -- return getHandle().locale; -+ return CraftPlayer.this.getLocale(); // Paper - } - - @Override --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index 3a22df4c15..e3512eeca8 100644 --- a/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -13,7 +13,7 @@ custom renderers are in use, defaulting to the much simpler Vanilla system. Additionally, numerous issues to player position tracking on maps has been fixed. diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 467c5bf1a..0f1d99636 100644 +index 1aa32bf11..36a961cb7 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -30,7 +30,7 @@ index 467c5bf1a..0f1d99636 100644 ItemStack itemstack1 = this.a(entityitem); diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 4c6eb6ed1..759dacba7 100644 +index 6ae576a2e..af1981967 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -0,0 +0,0 @@ public class EntityTrackerEntry { @@ -42,16 +42,11 @@ index 4c6eb6ed1..759dacba7 100644 EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker; ItemStack itemstack = entityitemframe.getItem(); -- if (this.a % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.a % 10 logic here so item frames do not enter the other blocks -+ if (itemstack != null && itemstack.getItem() instanceof ItemWorldMap) { // Paper - moved back up - WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, this.tracker.world); - Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit - diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 5f92355db..eca4903ed 100644 +index 3b3cc69de..4588df4b1 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose { if ( iter.next().trackee == entity ) { @@ -60,13 +55,13 @@ index 5f92355db..eca4903ed 100644 } } diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java -index 1096b5c1f..59173605e 100644 +index 445a016b7..4c64f90be 100644 --- a/src/main/java/net/minecraft/server/WorldMap.java +++ b/src/main/java/net/minecraft/server/WorldMap.java @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { - public List i = Lists.newArrayList(); - public final Map k = Maps.newHashMap(); // Spigot private -> public - public Map decorations = Maps.newLinkedHashMap(); // Spigot + public final Map j = Maps.newHashMap(); // Spigot private -> public + private final Map k = Maps.newHashMap(); + public Map decorations = Maps.newLinkedHashMap(); + private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper // CraftBukkit start @@ -80,8 +75,8 @@ index 1096b5c1f..59173605e 100644 } @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { - } - } + this.k.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 @@ -93,7 +88,7 @@ index 1096b5c1f..59173605e 100644 + public void updateSeenPlayers(EntityHuman entityhuman, ItemStack itemstack) { a(entityhuman, itemstack); } // Paper - OBFHELPER public void a(EntityHuman entityhuman, ItemStack itemstack) { - if (!this.k.containsKey(entityhuman)) { + if (!this.j.containsKey(entityhuman)) { WorldMap.WorldMapHumanTracker worldmap_worldmaphumantracker = new WorldMap.WorldMapHumanTracker(entityhuman); @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { diff --git a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch index 6d73e6a276..ef65110e6e 100644 --- a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch @@ -11,7 +11,7 @@ This feature is good for long term worlds so that newer players do not suffer with "Every chest has been looted" diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d96311f6b..067cb233e 100644 +index 0c50cb4bd..38de48ebc 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -231,7 +231,7 @@ index 000000000..668097620 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java new file mode 100644 -index 000000000..de2eff17e +index 000000000..9a65603bc --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java @@ -0,0 +0,0 @@ @@ -364,7 +364,7 @@ index 000000000..de2eff17e + this.lootedPlayers = new HashMap<>(list.size()); + } + for (int i = 0; i < size; i++) { -+ final NBTTagCompound cmp = list.get(i); ++ final NBTTagCompound cmp = list.getCompound(i); + lootedPlayers.put(cmp.getUUID("UUID"), cmp.getLong("Time")); + } + } @@ -418,7 +418,7 @@ index 000000000..de2eff17e + } +} diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -index d6afa4aa6..50d7d34b8 100644 +index dc329dcc5..d3bf88585 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java +++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -478,9 +478,9 @@ index d6afa4aa6..50d7d34b8 100644 } public void f(@Nullable EntityHuman entityhuman) { -- if (this.c != null) { -+ if (lootableData.shouldReplenish(entityhuman)) { // Paper - LootTable loottable = this.world.getLootTableRegistry().a(this.c); +- if (this.c != null && this.world.getMinecraftServer() != null) { ++ if (lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper + LootTable loottable = this.world.getMinecraftServer().aP().a(this.c); - this.c = null; + lootableData.processRefill(entityhuman); // Paper @@ -497,9 +497,8 @@ index d6afa4aa6..50d7d34b8 100644 this.d = i; } -+ -+ public MinecraftKey getLootTableKey() { return b(); } // Paper - OBFHELPER - public MinecraftKey b() { ++ public MinecraftKey getLootTableKey() { return Q_(); } // Paper - OBFHELPER + public MinecraftKey Q_() { return this.c; } + @@ -541,7 +540,7 @@ index d6afa4aa6..50d7d34b8 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index a97ad2037..618521304 100644 +index ce710d219..9c8bebe4b 100644 --- a/src/main/java/net/minecraft/server/TileEntityLootable.java +++ b/src/main/java/net/minecraft/server/TileEntityLootable.java @@ -0,0 +0,0 @@ @@ -557,18 +556,20 @@ index a97ad2037..618521304 100644 -public abstract class TileEntityLootable extends TileEntityContainer implements ILootable { +public abstract class TileEntityLootable extends TileEntityContainer implements ILootable, CraftLootableInventory { // Paper - protected MinecraftKey m; -- protected long n; -+ protected long n; public long getLootTableSeed() { return n; } // Paper - OBFHELPER - protected String o; + protected MinecraftKey g; +- protected long h; ++ protected long h; public long getLootTableSeed() { return h; } // Paper - OBFHELPER + protected IChatBaseComponent i; - public TileEntityLootable() {} + protected TileEntityLootable(TileEntityTypes tileentitytypes) { +@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer implements + } - protected boolean c(NBTTagCompound nbttagcompound) { + protected boolean d(NBTTagCompound nbttagcompound) { + lootableData.loadNbt(nbttagcompound); // Paper if (nbttagcompound.hasKeyOfType("LootTable", 8)) { - this.m = new MinecraftKey(nbttagcompound.getString("LootTable")); - this.n = nbttagcompound.getLong("LootTableSeed"); + this.g = new MinecraftKey(nbttagcompound.getString("LootTable")); + this.h = nbttagcompound.getLong("LootTableSeed"); - return true; + return false; // Paper - always load the items, table may still remain } else { @@ -576,49 +577,47 @@ index a97ad2037..618521304 100644 } } - protected boolean d(NBTTagCompound nbttagcompound) { + protected boolean e(NBTTagCompound nbttagcompound) { + lootableData.saveNbt(nbttagcompound); // Paper - if (this.m != null) { - nbttagcompound.setString("LootTable", this.m.toString()); - if (this.n != 0L) { - nbttagcompound.setLong("LootTableSeed", this.n); + if (this.g == null) { + return false; + } else { +@@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer implements + nbttagcompound.setLong("LootTableSeed", this.h); } - return true; + return false; // Paper - always save the items, table may still remain - } else { - return false; } } public void d(@Nullable EntityHuman entityhuman) { -- if (this.m != null) { -+ if (lootableData.shouldReplenish(entityhuman)) { // Paper - LootTable loottable = this.world.getLootTableRegistry().a(this.m); +- if (this.g != null && this.world.getMinecraftServer() != null) { ++ if (lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper + LootTable loottable = this.world.getMinecraftServer().aP().a(this.g); -- this.m = null; +- this.g = null; + lootableData.processRefill(entityhuman); // Paper Random random; - if (this.n == 0L) { + if (this.h == 0L) { @@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer implements } -+ public MinecraftKey getLootTableKey() { return b(); } // Paper - OBFHELPER - public MinecraftKey b() { - return this.m; ++ public MinecraftKey getLootTableKey() { return Q_(); } // Paper - OBFHELPER + public MinecraftKey Q_() { + return this.g; } + public void setLootTable(MinecraftKey key, long seed) { a(key, seed);} // Paper - OBFHELPER public void a(MinecraftKey minecraftkey, long i) { - this.m = minecraftkey; - this.n = i; + this.g = minecraftkey; + this.h = i; @@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer implements - } - protected abstract NonNullList q(); -+ + + protected abstract void a(NonNullList nonnulllist); + // Paper start - LootTable API + private final CraftLootableInventoryData lootableData = new CraftLootableInventoryData(this); + @@ -652,13 +651,13 @@ index a97ad2037..618521304 100644 + @Override + public void clearLootTable() { + //noinspection RedundantCast -+ this.m = (MinecraftKey) null; ++ this.g = (MinecraftKey) null; + } + // Paper end + } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 8328ed005..266f87d7f 100644 +index ac9b4297b..0558cafe3 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -0,0 +0,0 @@ public class CraftBlockEntityState extends CraftBlockState @@ -671,16 +670,17 @@ index 8328ed005..266f87d7f 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java -index 85f3bb272..733c04ef7 100644 +index 6a54f2a16..a94c78512 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.block; + import net.minecraft.server.BlockChest; +import com.destroystokyo.paper.loottable.CraftLootableBlockInventory; // Paper import net.minecraft.server.BlockPosition; - import net.minecraft.server.TileEntityChest; - + import net.minecraft.server.Blocks; + import net.minecraft.server.ITileInventory; @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftInventory; import org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest; import org.bukkit.inventory.Inventory; diff --git a/Spigot-Server-Patches/Make-entities-look-for-hoppers.patch b/Spigot-Server-Patches/Make-entities-look-for-hoppers.patch deleted file mode 100644 index 9f786e9369..0000000000 --- a/Spigot-Server-Patches/Make-entities-look-for-hoppers.patch +++ /dev/null @@ -1,381 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Techcable -Date: Sat, 18 Jun 2016 01:01:37 -0500 -Subject: [PATCH] Make entities look for hoppers - -Every tick hoppers try and find an block-inventory to extract from. -If no tile entity is above the hopper (which there often isn't) it will do a bounding box search for minecart chests and minecart hoppers. -If it can't find an inventory, it will then look for a dropped item, which is another bounding box search. -This patch eliminates that expensive check by having dropped items and minecart hoppers/chests look for hoppers instead. -Hoppers are tile entities meaning you can do a simple tile entity lookup to find the nearest hopper in range. -Pushing out of hoppers causes a bouding box lookup, which this patch replaces with a tile entity lookup. - -This patch may causes a decrease in the performance of dropped items, which is why it can be disabled in the configuration. - -diff --git a/src/main/java/com/destroystokyo/paper/HopperPusher.java b/src/main/java/com/destroystokyo/paper/HopperPusher.java -new file mode 100644 -index 000000000..52457e3d8 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/HopperPusher.java -@@ -0,0 +0,0 @@ -+package com.destroystokyo.paper; -+ -+import net.minecraft.server.AxisAlignedBB; -+import net.minecraft.server.BlockPosition; -+import net.minecraft.server.MCUtil; -+import net.minecraft.server.TileEntityHopper; -+import net.minecraft.server.World; -+ -+public interface HopperPusher { -+ -+ default TileEntityHopper findHopper() { -+ BlockPosition pos = new BlockPosition(getX(), getY(), getZ()); -+ int startX = pos.getX() - 1; -+ int endX = pos.getX() + 1; -+ int startY = Math.max(0, pos.getY() - 1); -+ int endY = Math.min(255, pos.getY() + 1); -+ int startZ = pos.getZ() - 1; -+ int endZ = pos.getZ() + 1; -+ BlockPosition.PooledBlockPosition adjacentPos = BlockPosition.PooledBlockPosition.aquire(); -+ for (int x = startX; x <= endX; x++) { -+ for (int y = startY; y <= endY; y++) { -+ for (int z = startZ; z <= endZ; z++) { -+ adjacentPos.setValues(x, y, z); -+ TileEntityHopper hopper = MCUtil.getHopper(getWorld(), adjacentPos); -+ if (hopper == null) continue; // Avoid playing with the bounding boxes, if at all possible -+ AxisAlignedBB hopperBoundingBox = hopper.getHopperLookupBoundingBox(); -+ /* -+ * Check if the entity's bounding box intersects with the hopper's lookup box. -+ * This operation doesn't work both ways! -+ * Make sure you check if the entity's box intersects the hopper's box, not vice versa! -+ */ -+ AxisAlignedBB boundingBox = this.getBoundingBox().shrink(0.1); // Imitate vanilla behavior -+ if (boundingBox.intersects(hopperBoundingBox)) { -+ return hopper; -+ } -+ } -+ } -+ } -+ adjacentPos.free(); -+ return null; -+ } -+ -+ boolean acceptItem(TileEntityHopper hopper); -+ -+ default boolean tryPutInHopper() { -+ if (!getWorld().paperConfig.isHopperPushBased) return false; -+ TileEntityHopper hopper = findHopper(); -+ return hopper != null && hopper.canAcceptItems() && acceptItem(hopper); -+ } -+ -+ AxisAlignedBB getBoundingBox(); -+ -+ World getWorld(); -+ -+ double getX(); -+ -+ double getY(); -+ -+ double getZ(); -+} -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 600e603bd..ce43e7bb7 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - private void altFallingBlockOnGround() { - altFallingBlockOnGround = getBoolean("use-alternate-fallingblock-onGround-detection", false); - } -+ -+ public boolean isHopperPushBased; -+ private void isHopperPushBased() { -+ isHopperPushBased = getBoolean("hopper.push-based", false); -+ } - } -diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java -index 1eb9c2da8..c88b76a79 100644 ---- a/src/main/java/net/minecraft/server/AxisAlignedBB.java -+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java -@@ -0,0 +0,0 @@ public class AxisAlignedBB { - } - } - -+ public final boolean intersects(AxisAlignedBB intersecting) { return this.c(intersecting); } // Paper - OBFHELPER - public boolean c(AxisAlignedBB axisalignedbb) { - return this.a(axisalignedbb.a, axisalignedbb.b, axisalignedbb.c, axisalignedbb.d, axisalignedbb.e, axisalignedbb.f); - } -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 008ed206d..b3c1f550c 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { - super(i, j, k); - } - -+ public static BlockPosition.PooledBlockPosition aquire() { return s(); } // Paper - OBFHELPER - public static BlockPosition.PooledBlockPosition s() { - return e(0, 0, 0); - } -@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { - return new BlockPosition.PooledBlockPosition(i, j, k); - } - -+ public void free() { t(); } // Paper - OBFHELPER - public void t() { - List list = BlockPosition.PooledBlockPosition.g; - -@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { - return this.d; - } - -+ public void setValues(int x, int y, int z) { c(x, y, z); } // Paper - OBFHELPER - public BlockPosition.MutableBlockPosition c(int i, int j, int k) { - this.b = i; - this.c = j; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index cb9ef622c..c675a6e16 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - public double locX; - public double locY; - public double locZ; -+ // Paper start - getters to implement HopperPusher -+ public double getX() { -+ return locX; -+ } -+ -+ public double getY() { -+ return locY; -+ } -+ -+ public double getZ() { -+ return locZ; -+ } -+ // Paper end - public double motX; - public double motY; - public double motZ; -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 4d3aef96b..6593fc633 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - import org.bukkit.event.entity.EntityPickupItemEvent; - import org.bukkit.event.player.PlayerPickupItemEvent; - // CraftBukkit end -+import com.destroystokyo.paper.HopperPusher; // Paper - --public class EntityItem extends Entity { -+// Paper start - implement HopperPusher -+public class EntityItem extends Entity implements HopperPusher { -+ @Override -+ public boolean acceptItem(TileEntityHopper hopper) { -+ return TileEntityHopper.putDropInInventory(null, hopper, this); -+ } -+// Paper end - - private static final Logger b = LogManager.getLogger(); - private static final DataWatcherObject c = DataWatcher.a(EntityItem.class, DataWatcherRegistry.f); -@@ -0,0 +0,0 @@ public class EntityItem extends Entity { - this.die(); - } else { - super.B_(); -+ if (tryPutInHopper()) return; // Paper - // CraftBukkit start - Use wall time for pickup and despawn timers - int elapsedTicks = MinecraftServer.currentTick - this.lastTick; - if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; -@@ -0,0 +0,0 @@ public class EntityItem extends Entity { - // Spigot start - copied from above - @Override - public void inactiveTick() { -+ if (tryPutInHopper()) return; // Paper - // CraftBukkit start - Use wall time for pickup and despawn timers - int elapsedTicks = MinecraftServer.currentTick - this.lastTick; - if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; -diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -index 50d7d34b8..15f392d23 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; - import java.util.List; - import org.bukkit.Location; - -+import com.destroystokyo.paper.HopperPusher; // Paper - import com.destroystokyo.paper.loottable.CraftLootableInventoryData; // Paper - import com.destroystokyo.paper.loottable.CraftLootableInventory; // Paper - import com.destroystokyo.paper.loottable.LootableInventory; // Paper -@@ -0,0 +0,0 @@ import org.bukkit.entity.HumanEntity; - import org.bukkit.inventory.InventoryHolder; - // CraftBukkit end - --public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements ITileInventory, ILootable, CraftLootableInventory { // Paper -+// Paper start - push into hoppers -+public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements ITileInventory, ILootable, CraftLootableInventory, HopperPusher { // Paper - CraftLootableInventory -+ @Override -+ public boolean acceptItem(TileEntityHopper hopper) { -+ return TileEntityHopper.acceptItem(hopper, this); -+ } -+ -+ @Override -+ public void B_() { -+ super.B_(); -+ tryPutInHopper(); -+ } -+ -+ @Override -+ public void inactiveTick() { -+ super.inactiveTick(); -+ tryPutInHopper(); -+ } -+ // Paper end - - private NonNullList items; - private boolean b; -diff --git a/src/main/java/net/minecraft/server/IHopper.java b/src/main/java/net/minecraft/server/IHopper.java -index 804215a1c..e830d8390 100644 ---- a/src/main/java/net/minecraft/server/IHopper.java -+++ b/src/main/java/net/minecraft/server/IHopper.java -@@ -0,0 +0,0 @@ public interface IHopper extends IInventory { - - World getWorld(); - -- double E(); -+ double E(); default double getX() { return E(); } // Paper - OBFHELPER - -- double F(); -+ double F(); default double getY() { return F(); } // Paper - OBFHELPER - -- double G(); -+ double G(); default double getZ() { return G(); } // Paper - OBFHELPER - } -diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index 985513511..e9315f2d5 100644 ---- a/src/main/java/net/minecraft/server/TileEntityHopper.java -+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - } - - private boolean o() { -+ mayAcceptItems = false; // Paper - at the beginning of a tick, assume we can't accept items - if (this.world != null && !this.world.isClientSide) { - if (!this.J() && BlockHopper.f(this.v())) { - boolean flag = false; -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - } - - if (!this.r()) { -+ mayAcceptItems = true; // Paper - flag this hopper to be able to accept items - flag = a((IHopper) this) || flag; - } - -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - } - } - -+ // Paper start -+ private boolean mayAcceptItems = false; -+ -+ public boolean canAcceptItems() { -+ return mayAcceptItems; -+ } -+ // Paper end -+ - private boolean p() { - Iterator iterator = this.items.iterator(); - -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - return true; - } - -+ // Paper start - split methods, and only do entity lookup if in pull mode - public static boolean a(IHopper ihopper) { -- IInventory iinventory = b(ihopper); -+ IInventory iinventory = getInventory(ihopper, !(ihopper instanceof TileEntityHopper) || !ihopper.getWorld().paperConfig.isHopperPushBased); -+ -+ return acceptItem(ihopper, iinventory); -+ } -+ -+ public static boolean acceptItem(IHopper ihopper, IInventory iinventory) { -+ // Paper end - - if (iinventory != null) { - EnumDirection enumdirection = EnumDirection.DOWN; -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - } - } - } -- } else { -- Iterator iterator = a(ihopper.getWorld(), ihopper.E(), ihopper.F(), ihopper.G()).iterator(); -+ } else if (!ihopper.getWorld().paperConfig.isHopperPushBased || !(ihopper instanceof TileEntityHopper)) { // Paper - only search for entities in 'pull mode' -+ Iterator iterator = a(ihopper.getWorld(), ihopper.E(), ihopper.F(), ihopper.G()).iterator(); // Change getHopperLookupBoundingBox() if this ever changes - - while (iterator.hasNext()) { - EntityItem entityitem = (EntityItem) iterator.next(); -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - return false; - } - -+ public static boolean putDropInInventory(IInventory iinventory, IInventory iinventory1, EntityItem entityitem) { return a(iinventory, iinventory1, entityitem); } // Paper - OBFHELPER - public static boolean a(IInventory iinventory, IInventory iinventory1, EntityItem entityitem) { - boolean flag = false; - -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - private IInventory I() { - EnumDirection enumdirection = BlockHopper.b(this.v()); - -- return b(this.getWorld(), this.E() + (double) enumdirection.getAdjacentX(), this.F() + (double) enumdirection.getAdjacentY(), this.G() + (double) enumdirection.getAdjacentZ()); -+ // Paper start - don't search for entities in push mode -+ World world = getWorld(); -+ return getInventory(world, this.E() + (double) enumdirection.getAdjacentX(), this.F() + (double) enumdirection.getAdjacentY(), this.G() + (double) enumdirection.getAdjacentZ(), !world.paperConfig.isHopperPushBased); -+ // Paper end - } - -- public static IInventory b(IHopper ihopper) { -- return b(ihopper.getWorld(), ihopper.E(), ihopper.F() + 1.0D, ihopper.G()); -+ // Paper start - add option to search for entities -+ public static IInventory b(IHopper hopper) { -+ return getInventory(hopper, true); -+ } -+ -+ public static IInventory getInventory(IHopper ihopper, boolean searchForEntities) { -+ return getInventory(ihopper.getWorld(), ihopper.E(), ihopper.F() + 1.0D, ihopper.G(), searchForEntities); -+ // Paper end - } - - public static List a(World world, double d0, double d1, double d2) { -- return world.a(EntityItem.class, new AxisAlignedBB(d0 - 0.5D, d1, d2 - 0.5D, d0 + 0.5D, d1 + 1.5D, d2 + 0.5D), IEntitySelector.a); -+ return world.a(EntityItem.class, new AxisAlignedBB(d0 - 0.5D, d1, d2 - 0.5D, d0 + 0.5D, d1 + 1.5D, d2 + 0.5D), IEntitySelector.a); // Change getHopperLookupBoundingBox(double, double, double) if the bounding box calculation is ever changed -+ } -+ -+ // Paper start -+ public AxisAlignedBB getHopperLookupBoundingBox() { -+ return getHopperLookupBoundingBox(this.getX(), this.getY(), this.getZ()); - } - -+ private static AxisAlignedBB getHopperLookupBoundingBox(double d0, double d1, double d2) { -+ // Change this if a(World, double, double, double) above ever changes -+ return new AxisAlignedBB(d0 - 0.5D, d1, d2 - 0.5D, d0 + 0.5D, d1 + 1.5D, d2 + 0.5D); -+ } -+ // Paper end -+ -+ // Paper start - add option to searchForEntities - public static IInventory b(World world, double d0, double d1, double d2) { -+ return getInventory(world, d0, d1, d2, true); -+ } -+ -+ public static IInventory getInventory(World world, double d0, double d1, double d2, boolean searchForEntities) { -+ // Paper end - Object object = null; - int i = MathHelper.floor(d0); - int j = MathHelper.floor(d1); -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - } - } - -- if (object == null) { -+ if (object == null && searchForEntities) { // Paper - only if searchForEntities - List list = world.getEntities((Entity) null, new AxisAlignedBB(d0 - 0.5D, d1 - 0.5D, d2 - 0.5D, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D), IEntitySelector.c); - - if (!list.isEmpty()) { --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Only-send-Dragon-Wither-Death-sounds-to-same-world.patch b/Spigot-Server-Patches/Only-send-Dragon-Wither-Death-sounds-to-same-world.patch index 30ba714670..ce5f31ff21 100644 --- a/Spigot-Server-Patches/Only-send-Dragon-Wither-Death-sounds-to-same-world.patch +++ b/Spigot-Server-Patches/Only-send-Dragon-Wither-Death-sounds-to-same-world.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Only send Dragon/Wither Death sounds to same world Also fix view distance lookup diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 0f94d2f0a..a8cc6b61a 100644 +index 24cce6c03..e5f064577 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - if (this.bH == 1) { + if (this.bO == 1) { // CraftBukkit start - Use relative location for far away sounds // this.world.a(1028, new BlockPosition(this), 0); - int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; @@ -25,7 +25,7 @@ index 0f94d2f0a..a8cc6b61a 100644 double deltaZ = this.locZ - player.locZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index 97cf75b9f..967852605 100644 +index e9d9ec239..28f524468 100644 --- a/src/main/java/net/minecraft/server/EntityWither.java +++ b/src/main/java/net/minecraft/server/EntityWither.java @@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity { diff --git a/Spigot-Server-Patches/Optimize-EAR.patch b/Spigot-Server-Patches/Optimize-EAR.patch index b8c5fa8890..791144f56d 100644 --- a/Spigot-Server-Patches/Optimize-EAR.patch +++ b/Spigot-Server-Patches/Optimize-EAR.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize EAR diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 3265a6c25..47865c027 100644 +index 1aade75f3..a9b84fdec 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -0,0 +0,0 @@ package org.spigotmc; @@ -33,6 +33,7 @@ index 3265a6c25..47865c027 100644 -import net.minecraft.server.EntitySlice; import net.minecraft.server.EntitySlime; import net.minecraft.server.EntityTNTPrimed; + import net.minecraft.server.EntityThrownTrident; import net.minecraft.server.EntityVillager; import net.minecraft.server.EntityWeather; import net.minecraft.server.EntityWither; diff --git a/Spigot-Server-Patches/Optimize-Hoppers.patch b/Spigot-Server-Patches/Optimize-Hoppers.patch deleted file mode 100644 index 2c4f1253f0..0000000000 --- a/Spigot-Server-Patches/Optimize-Hoppers.patch +++ /dev/null @@ -1,282 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 27 Apr 2016 22:09:52 -0400 -Subject: [PATCH] Optimize Hoppers - -* Removes unnecessary extra calls to .update() that are very expensive -* Lots of itemstack cloning removed. Only clone if the item is actually moved -* Return true when a plugin cancels inventory move item event instead of false, as false causes pulls to cycle through all items. - However, pushes do not exhibit the same behavior, so this is not something plugins could of been relying on. -* Add option (Default on) to cooldown hoppers when they fail to move an item due to full inventory -* Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9fd76dcc9..363e03b65 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D); - } - -+ public boolean cooldownHopperWhenFull = true; -+ public boolean disableHopperMoveEvents = false; -+ private void hopperOptimizations() { -+ cooldownHopperWhenFull = getBoolean("hopper.cooldown-when-full", cooldownHopperWhenFull); -+ log("Cooldown Hoppers when Full: " + (cooldownHopperWhenFull ? "enabled" : "disabled")); -+ disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents); -+ log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled")); -+ } - } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fcf6bac08..3092913f5 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - - // if (i == 0 || this.getAllowNether()) { - WorldServer worldserver = this.worlds.get(i); -+ TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; - - this.methodProfiler.a(() -> { - return worldserver.getWorldData().getName(); -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 5b5f102e2..3f6b34489 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { - return (MinecraftKey) TileEntity.f.b(oclass); - } - -+ static boolean IGNORE_TILE_UPDATES = false; // Paper - public World getWorld() { - return this.world; - } -@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { - - public void update() { - if (this.world != null) { -+ if (IGNORE_TILE_UPDATES) return; // Paper - IBlockData iblockdata = this.world.getType(this.position); - - this.g = iblockdata.getBlock().toLegacyData(iblockdata); -diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index e9315f2d5..5198a590a 100644 ---- a/src/main/java/net/minecraft/server/TileEntityHopper.java -+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - return false; - } - -+ // Paper start - Optimize Hoppers -+ private static boolean skipPullModeEventFire = false; -+ private static boolean skipPushModeEventFire = false; -+ static boolean skipHopperEvents = false; -+ -+ private boolean hopperPush(IInventory iinventory, EnumDirection enumdirection) { -+ skipPushModeEventFire = skipHopperEvents; -+ boolean foundItem = false; -+ for (int i = 0; i < this.getSize(); ++i) { -+ if (!this.getItem(i).isEmpty()) { -+ foundItem = true; -+ ItemStack origItemStack = this.getItem(i); -+ ItemStack itemstack = origItemStack; -+ -+ final int origCount = origItemStack.getCount(); -+ final int moved = Math.min(world.spigotConfig.hopperAmount, origCount); -+ origItemStack.setCount(moved); -+ -+ // We only need to fire the event once to give protection plugins a chance to cancel this event -+ // Because nothing uses getItem, every event call should end up the same result. -+ if (!skipPushModeEventFire) { -+ itemstack = callPushMoveEvent(iinventory, itemstack); -+ if (itemstack == null) { // cancelled -+ origItemStack.setCount(origCount); -+ return false; -+ } -+ } -+ final ItemStack itemstack2 = addItem(this, iinventory, itemstack, enumdirection); -+ final int remaining = itemstack2.getCount(); -+ if (remaining != moved) { -+ origItemStack = origItemStack.cloneItemStack(); -+ origItemStack.setCount(origCount - moved + remaining); -+ this.setItem(i, origItemStack); -+ iinventory.update(); -+ return true; -+ } -+ origItemStack.setCount(origCount); -+ } -+ } -+ if (foundItem && world.paperConfig.cooldownHopperWhenFull) { // Inventory was full - cooldown -+ this.setCooldown(world.spigotConfig.hopperTransfer); -+ } -+ return false; -+ } -+ -+ private static boolean hopperPull(IHopper ihopper, IInventory iinventory, int i) { -+ ItemStack origItemStack = iinventory.getItem(i); -+ ItemStack itemstack = origItemStack; -+ final int origCount = origItemStack.getCount(); -+ final World world = ihopper.getWorld(); -+ final int moved = Math.min(world.spigotConfig.hopperAmount, origCount); -+ itemstack.setCount(moved); -+ -+ if (!skipPullModeEventFire) { -+ itemstack = callPullMoveEvent(ihopper, iinventory, itemstack); -+ if (itemstack == null) { // cancelled -+ origItemStack.setCount(origCount); -+ // Drastically improve performance by returning true. -+ // No plugin could of relied on the behavior of false as the other call -+ // site for IMIE did not exhibit the same behavior -+ return true; -+ } -+ } -+ -+ final ItemStack itemstack2 = addItem(iinventory, ihopper, itemstack, null); -+ final int remaining = itemstack2.getCount(); -+ if (remaining != moved) { -+ origItemStack = origItemStack.cloneItemStack(); -+ origItemStack.setCount(origCount - moved + remaining); -+ IGNORE_TILE_UPDATES = true; -+ iinventory.setItem(i, origItemStack); -+ IGNORE_TILE_UPDATES = false; -+ iinventory.update(); -+ return true; -+ } -+ origItemStack.setCount(origCount); -+ -+ if (world.paperConfig.cooldownHopperWhenFull) { -+ cooldownHopper(ihopper); -+ } -+ -+ return false; -+ } -+ -+ private ItemStack callPushMoveEvent(IInventory iinventory, ItemStack itemstack) { -+ Inventory destinationInventory = getInventory(iinventory); -+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(this.getOwner(false).getInventory(), -+ CraftItemStack.asCraftMirror(itemstack), destinationInventory, true); -+ boolean result = event.callEvent(); -+ if (!event.calledGetItem && !event.calledSetItem) { -+ skipPushModeEventFire = true; -+ } -+ if (!result) { -+ cooldownHopper(this); -+ return null; -+ } -+ -+ if (event.calledSetItem) { -+ return CraftItemStack.asNMSCopy(event.getItem()); -+ } else { -+ return itemstack; -+ } -+ } -+ -+ private static ItemStack callPullMoveEvent(IHopper hopper, IInventory iinventory, ItemStack itemstack) { -+ Inventory sourceInventory = getInventory(iinventory); -+ Inventory destination = getInventory(hopper); -+ -+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(sourceInventory, -+ // Mirror is safe as we no plugins ever use this item -+ CraftItemStack.asCraftMirror(itemstack), destination, false); -+ boolean result = event.callEvent(); -+ if (!event.calledGetItem && !event.calledSetItem) { -+ skipPullModeEventFire = true; -+ } -+ if (!result) { -+ cooldownHopper(hopper); -+ return null; -+ } -+ -+ if (event.calledSetItem) { -+ return CraftItemStack.asNMSCopy(event.getItem()); -+ } else { -+ return itemstack; -+ } -+ } -+ -+ private static Inventory getInventory(IInventory iinventory) { -+ Inventory sourceInventory;// Have to special case large chests as they work oddly -+ if (iinventory instanceof InventoryLargeChest) { -+ sourceInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((InventoryLargeChest) iinventory); -+ } else if (iinventory instanceof TileEntity) { -+ sourceInventory = ((TileEntity) iinventory).getOwner(false).getInventory(); -+ } else { -+ sourceInventory = iinventory.getOwner().getInventory(); -+ } -+ return sourceInventory; -+ } -+ -+ private static void cooldownHopper(IHopper hopper) { -+ if (hopper instanceof TileEntityHopper) { -+ ((TileEntityHopper) hopper).setCooldown(hopper.getWorld().spigotConfig.hopperTransfer); -+ } else if (hopper instanceof EntityMinecartHopper) { -+ ((EntityMinecartHopper) hopper).setCooldown(hopper.getWorld().spigotConfig.hopperTransfer / 2); -+ } -+ } -+ -+ // Paper end - private boolean s() { - IInventory iinventory = this.I(); - -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - if (this.a(iinventory, enumdirection)) { - return false; - } else { -+ return hopperPush(iinventory, enumdirection); /* // Paper - disable rest - for (int i = 0; i < this.getSize(); ++i) { - if (!this.getItem(i).isEmpty()) { - ItemStack itemstack = this.getItem(i).cloneItemStack(); -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - } - } - -- return false; -+ return false;*/ // Paper - end commenting out replaced block for Hopper Optimizations - } - } - } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - if (b(iinventory, enumdirection)) { - return false; - } -+ skipPullModeEventFire = skipHopperEvents; // Paper - - if (iinventory instanceof IWorldInventory) { - IWorldInventory iworldinventory = (IWorldInventory) iinventory; -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - ItemStack itemstack = iinventory.getItem(i); - - if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) { -+ return hopperPull(ihopper, iinventory, i); /* // Paper - disable rest - ItemStack itemstack1 = itemstack.cloneItemStack(); - // ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.splitStack(i, 1), (EnumDirection) null); - // CraftBukkit start - Call event on collection of items from inventories into the hopper -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - } - - itemstack1.subtract(origCount - itemstack2.getCount()); // Spigot -- iinventory.setItem(i, itemstack1); -+ iinventory.setItem(i, itemstack1);*/ // Paper - end commenting out replaced block for Hopper Optimizations - } - - return false; -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - return false; - } else { - // CraftBukkit start -- InventoryPickupItemEvent event = new InventoryPickupItemEvent(iinventory1.getOwner().getInventory(), (org.bukkit.entity.Item) entityitem.getBukkitEntity()); -+ InventoryPickupItemEvent event = new InventoryPickupItemEvent(getInventory(iinventory1), (org.bukkit.entity.Item) entityitem.getBukkitEntity()); // Paper - avoid snapshot creation - entityitem.world.getServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - return false; -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - boolean flag1 = iinventory1.x_(); - - if (itemstack1.isEmpty()) { -+ IGNORE_TILE_UPDATES = true; // Paper - iinventory1.setItem(i, itemstack); -+ IGNORE_TILE_UPDATES = false; // Paper - itemstack = ItemStack.a; - flag = true; - } else if (a(itemstack1, itemstack)) { --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch b/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch index 720fc9539a..b1fdaad9eb 100644 --- a/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch +++ b/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch @@ -10,20 +10,20 @@ Additionally, move Saving of the User cache to be done async, incase the user never changed the default setting for Spigot's save on stop only. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 45d3dbde2..ab7933079 100644 +index e11289217..49b2c27c6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati // Spigot start if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { LOGGER.info("Saving usercache.json"); -- this.Y.c(); -+ this.Y.c(false); // Paper +- this.getUserCache().c(); ++ this.getUserCache().c(false); // Paper } // Spigot end } diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 487fc11f1..4fb17a801 100644 +index 0e168ad34..f8b7d695c 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { @@ -36,7 +36,7 @@ index 487fc11f1..4fb17a801 100644 if (date == null) { @@ -0,0 +0,0 @@ public class UserCache { - String s = gameprofile.getName().toLowerCase(Locale.ROOT); + UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date, null); - if (this.e.containsKey(uuid)) { @@ -59,13 +59,6 @@ index 487fc11f1..4fb17a801 100644 return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); } -- public String[] a() { -+ public synchronized String[] a() { // Paper - synchronize - ArrayList arraylist = Lists.newArrayList(this.d.keySet()); - - return (String[]) arraylist.toArray(new String[arraylist.size()]); - } - + @Nullable public GameProfile getProfile(UUID uuid) { return a(uuid); } // Paper - OBFHELPER @Nullable - public GameProfile a(UUID uuid) { diff --git a/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch b/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch index 8ed18760d8..3650dee296 100644 --- a/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch +++ b/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optional TNT doesn't move in water diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 067cb233e..06acdaaf0 100644 +index 38de48ebc..321da3be3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ package com.destroystokyo.paper; @@ -32,25 +32,26 @@ index 067cb233e..06acdaaf0 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index c105dd9b0..334441ed7 100644 +index 509254b35..1aa4519a6 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } public boolean aq() { ++ // Paper start + return this.doWaterMovement(); + } + + public boolean doWaterMovement() { + // Paper end - if (this.bJ() instanceof EntityBoat) { - this.inWater = false; - } else if (this.world.a(this.getBoundingBox().grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D), Material.WATER, this)) { -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper + return this.isInWater() || this.q(); } - public boolean bo() { +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + } + + public boolean bw() { + return this.pushedByWater(); + } + @@ -60,7 +61,7 @@ index c105dd9b0..334441ed7 100644 } diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index bb0904f86..50811852a 100644 +index 87f3205f8..8c1d25979 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { diff --git a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch b/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch deleted file mode 100644 index dc8af97e21..0000000000 --- a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 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 - -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 b6caf4c8a..f3a278c0b 100644 ---- a/src/main/java/net/minecraft/server/BlockFire.java -+++ b/src/main/java/net/minecraft/server/BlockFire.java -@@ -0,0 +0,0 @@ public class BlockFire extends Block { - } - - blockposition_mutableblockposition.g(blockposition).d(l, j1, i1); -+ if (!world.isLoaded(blockposition_mutableblockposition)) continue; // Paper - int l1 = this.a((IWorldReader) world, (BlockPosition) blockposition_mutableblockposition); - - if (l1 > 0) { -@@ -0,0 +0,0 @@ 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()); -+ // Paper start -+ final IBlockData iblockdata = world.getTypeIfLoaded(blockposition); -+ if (iblockdata == null) return; -+ int k = this.f(iblockdata.getBlock()); -+ // Paper end - - if (random.nextInt(i) < k) { -- IBlockData iblockdata = world.getType(blockposition); -+ //IBlockData iblockdata = world.getType(blockposition); // Paper - - // CraftBukkit start - org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -@@ -0,0 +0,0 @@ public class BlockFire extends Block { - for (int k = 0; k < j; ++k) { - EnumDirection enumdirection = aenumdirection[k]; - -- i = Math.max(this.g(iworldreader.getType(blockposition.shift(enumdirection)).getBlock()), i); -+ // Paper start -+ final IBlockData type = ((World)iworldreader).getTypeIfLoaded(blockposition.shift(enumdirection)); -+ if (type == null) continue; -+ i = Math.max(this.g(type.getBlock()), i); -+ // Paper end - } - - return i; --- \ No newline at end of file diff --git a/Spigot-Server-Patches/SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch b/Spigot-Server-Patches/SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch deleted file mode 100644 index fb8c8823a8..0000000000 --- a/Spigot-Server-Patches/SPIGOT-1401-Fix-dispenser-dropper-furnace-placement.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sun, 24 Apr 2016 19:49:33 -0500 -Subject: [PATCH] SPIGOT-1401: Fix dispenser, dropper, furnace placement - - -diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java -index 8e794976a..539b2b3ce 100644 ---- a/src/main/java/net/minecraft/server/BlockDispenser.java -+++ b/src/main/java/net/minecraft/server/BlockDispenser.java -@@ -0,0 +0,0 @@ public class BlockDispenser extends BlockTileEntity { - return 4; - } - -+ // Paper start - Removed override of onPlace that was reversing placement direction when -+ // adjacent to another block, which was not consistent with single player block placement -+ /* - public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { - super.onPlace(world, blockposition, iblockdata); - this.e(world, blockposition, iblockdata); -@@ -0,0 +0,0 @@ public class BlockDispenser extends BlockTileEntity { - world.setTypeAndData(blockposition, iblockdata.set(BlockDispenser.FACING, enumdirection).set(BlockDispenser.TRIGGERED, Boolean.valueOf(false)), 2); - } - } -+ */ -+ // Paper end - - public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { - if (world.isClientSide) { -diff --git a/src/main/java/net/minecraft/server/BlockFurnace.java b/src/main/java/net/minecraft/server/BlockFurnace.java -index b6834d2d1..dae711708 100644 ---- a/src/main/java/net/minecraft/server/BlockFurnace.java -+++ b/src/main/java/net/minecraft/server/BlockFurnace.java -@@ -0,0 +0,0 @@ public class BlockFurnace extends BlockTileEntity { - return Item.getItemOf(Blocks.FURNACE); - } - -+ // Paper start - Removed override of onPlace that was reversing placement direction when -+ // adjacent to another block, which was not consistent with single player block placement -+ /* - public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { - this.e(world, blockposition, iblockdata); - } -@@ -0,0 +0,0 @@ public class BlockFurnace extends BlockTileEntity { - world.setTypeAndData(blockposition, iblockdata.set(BlockFurnace.FACING, enumdirection), 2); - } - } -+ */ -+ // Paper end - - public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { - if (world.isClientSide) { --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Toggleable-Elytra-Wall-Damage.patch b/Spigot-Server-Patches/Toggleable-Elytra-Wall-Damage.patch deleted file mode 100644 index ba68a1362f..0000000000 --- a/Spigot-Server-Patches/Toggleable-Elytra-Wall-Damage.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jadon Fowler -Date: Sat, 18 Jun 2016 23:13:59 -0700 -Subject: [PATCH] Toggleable Elytra Wall Damage - -Instead of calculating the damage taken from hitting a wall, you can -disable it in the config. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index e35e72e8b..1b9eb7f45 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - private void skipEntityTickingInChunksScheduledForUnload() { - skipEntityTickingInChunksScheduledForUnload = getBoolean("skip-entity-ticking-in-chunks-scheduled-for-unload", skipEntityTickingInChunksScheduledForUnload); - } -+ -+ public boolean elytraHitWallDamage = true; -+ private void elytraHitWallDamage() { -+ elytraHitWallDamage = getBoolean("elytra-hit-wall-damage", true); -+ } - } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 4b6bb38ae..dda6219a7 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.motY = 0.30000001192092896D; - } - } else if (this.cP()) { -+ if (world.paperConfig.elytraHitWallDamage) { // Paper start - Toggleable Elytra Wall Damage - if (this.motY > -0.5D) { - this.fallDistance = 1.0F; - } -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.damageEntity(DamageSource.FLY_INTO_WALL, f8); - } - } -+ } // Paper end - Elyta Wall Damage if statement - - if (this.onGround && !this.world.isClientSide) { - if (getFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Vehicle-Event-Cancellation-Changes.patch b/Spigot-Server-Patches/Vehicle-Event-Cancellation-Changes.patch index ef41df90ca..ef266f6742 100644 --- a/Spigot-Server-Patches/Vehicle-Event-Cancellation-Changes.patch +++ b/Spigot-Server-Patches/Vehicle-Event-Cancellation-Changes.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Vehicle Event Cancellation Changes diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 88faa4601..aece54d26 100644 +index fecf29710..115504bf6 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - public boolean i; +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + public boolean j; public final List passengers; - protected int j; -- private Entity au; -+ private Entity au;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER + protected int k; +- private Entity ax; ++ private Entity ax;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER public boolean attachedToPlayer; public World world; public double lastX; -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { // CraftBukkit start @@ -25,7 +25,7 @@ index 88faa4601..aece54d26 100644 CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle(); Entity orig = craft == null ? null : craft.getHandle(); if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } } // CraftBukkit end @@ -38,6 +38,6 @@ index 88faa4601..aece54d26 100644 + // Paper end + this.passengers.remove(entity); - entity.j = 60; + entity.k = 60; } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch b/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch index 3b9ee45706..89435b2de8 100644 --- a/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch +++ b/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch @@ -6,26 +6,26 @@ 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 b6c4d98fd..45d3dbde2 100644 +index c5670fe8d..e11289217 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ import co.aikar.timings.MinecraftTimings; // Paper - public abstract class MinecraftServer implements ICommandListener, Runnable, IAsyncTaskHandler, IMojangStatistics { + public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable { + private static MinecraftServer SERVER; // Paper public static final Logger LOGGER = LogManager.getLogger(); public static final File a = new File("usercache.json"); public Convertable convertable; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { + public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { + SERVER = this; // Paper - better singleton - io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable - this.e = proxy; - this.V = yggdrasilauthenticationservice; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + this.commandDispatcher = commanddispatcher; // CraftBukkit + this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA); + this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati // CraftBukkit start @Deprecated public static MinecraftServer getServer() { diff --git a/work/Bukkit b/work/Bukkit index 55a3379d9b..1d21dc022e 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 55a3379d9bcd38efb5c4f4d0db8bcee39db853df +Subproject commit 1d21dc022e7e6905ef64f54b165e7559dfa40ade diff --git a/work/CraftBukkit b/work/CraftBukkit index 8fbc72b714..1fccb89501 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 8fbc72b714a5051c6df8f05ac97528d747f1bdeb +Subproject commit 1fccb8950186caae273e45f1b08ebe2797214293 diff --git a/work/Spigot b/work/Spigot index 6505f06b35..1d0aef704b 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 6505f06b355d5f1ea0fff2d0e8edbd60b2f75354 +Subproject commit 1d0aef704b8cca70ab2c71dbabad4a09b91287e3