From 3a3831d6aacf627da6e674afcbb59aae45b4a032 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 11 Jun 2021 15:37:16 -0700 Subject: [PATCH] more patches --- patches/api/0006-Adventure.patch | 16 ++++ .../0007-Player-affects-spawning-API.patch} | 0 .../0008-Add-getTPS-method.patch} | 4 +- .../0009-Entity-Origin-API.patch} | 0 .../0010-Version-Command-2.0.patch} | 0 .../0025-Optimize-TileEntity-Ticking.patch | 2 + ...nfigurable-top-of-nether-void-damage.patch | 93 ------------------- patches/server/0009-Timings-v2.patch | 6 +- patches/server/0010-Adventure.patch | 48 ++++++---- ...ctus-bamboo-and-reed-growth-heights.patch} | 24 ++--- ...igurable-baby-zombie-movement-speed.patch} | 4 +- ...13-Configurable-fishing-time-ranges.patch} | 8 +- ...-mobs-to-jump-and-take-water-damage.patch} | 31 +++---- ...despawn-distances-for-living-entiti.patch} | 8 +- ...-Allow-for-toggling-of-spawn-chunks.patch} | 4 +- ...k-and-tnt-entities-at-the-specified.patch} | 30 ++---- ...ent-crashes-server-lists-and-Mojang.patch} | 38 ++++---- ...0019-Implement-Paper-VersionChecker.patch} | 2 +- ...-version-history-to-version-command.patch} | 4 +- .../0021-Player-affects-spawning-API.patch} | 73 +++++++-------- ...e-invalid-mob-spawner-tile-entities.patch} | 19 ++-- ...23-Further-improve-server-tick-loop.patch} | 49 +++++----- ...24-Only-refresh-abilities-if-needed.patch} | 14 +-- .../0025-Entity-Origin-API.patch} | 82 ++++++++-------- ...vent-tile-entity-and-entity-crashes.patch} | 59 ++++++------ ...nfigurable-top-of-nether-void-damage.patch | 47 ++++++++++ ...-before-converting-and-renaming-pla.patch} | 6 +- .../0029-Always-tick-falling-blocks.patch} | 6 +- .../0030-Configurable-end-credits.patch} | 17 +--- ...explosions-processing-dead-entities.patch} | 4 +- .../0032-Optimize-explosions.patch} | 16 ++-- 31 files changed, 332 insertions(+), 382 deletions(-) rename patches/{api-unmapped/0006-Player-affects-spawning-API.patch => api/0007-Player-affects-spawning-API.patch} (100%) rename patches/{api-unmapped/0007-Add-getTPS-method.patch => api/0008-Add-getTPS-method.patch} (87%) rename patches/{api-unmapped/0008-Entity-Origin-API.patch => api/0009-Entity-Origin-API.patch} (100%) rename patches/{api-unmapped/0009-Version-Command-2.0.patch => api/0010-Version-Command-2.0.patch} (100%) rename patches/{server-remapped => removed/1.17}/0025-Optimize-TileEntity-Ticking.patch (99%) delete mode 100644 patches/server-remapped/0030-Configurable-top-of-nether-void-damage.patch rename patches/{server-remapped/0013-Configurable-cactus-bamboo-and-reed-growth-heights.patch => server/0011-Configurable-cactus-bamboo-and-reed-growth-heights.patch} (87%) rename patches/{server-remapped/0014-Configurable-baby-zombie-movement-speed.patch => server/0012-Configurable-baby-zombie-movement-speed.patch} (95%) rename patches/{server-remapped/0015-Configurable-fishing-time-ranges.patch => server/0013-Configurable-fishing-time-ranges.patch} (83%) rename patches/{server-remapped/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch => server/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch} (78%) rename patches/{server-remapped/0017-Add-configurable-despawn-distances-for-living-entiti.patch => server/0015-Add-configurable-despawn-distances-for-living-entiti.patch} (92%) rename patches/{server-remapped/0018-Allow-for-toggling-of-spawn-chunks.patch => server/0016-Allow-for-toggling-of-spawn-chunks.patch} (91%) rename patches/{server-remapped/0019-Drop-falling-block-and-tnt-entities-at-the-specified.patch => server/0017-Drop-falling-block-and-tnt-entities-at-the-specified.patch} (74%) rename patches/{server-remapped/0020-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch => server/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch} (84%) rename patches/{server-remapped/0021-Implement-Paper-VersionChecker.patch => server/0019-Implement-Paper-VersionChecker.patch} (98%) rename patches/{server-remapped/0022-Add-version-history-to-version-command.patch => server/0020-Add-version-history-to-version-command.patch} (98%) rename patches/{server-remapped/0023-Player-affects-spawning-API.patch => server/0021-Player-affects-spawning-API.patch} (71%) rename patches/{server-remapped/0024-Remove-invalid-mob-spawner-tile-entities.patch => server/0022-Remove-invalid-mob-spawner-tile-entities.patch} (62%) rename patches/{server-remapped/0026-Further-improve-server-tick-loop.patch => server/0023-Further-improve-server-tick-loop.patch} (82%) rename patches/{server-remapped/0027-Only-refresh-abilities-if-needed.patch => server/0024-Only-refresh-abilities-if-needed.patch} (56%) rename patches/{server-remapped/0028-Entity-Origin-API.patch => server/0025-Entity-Origin-API.patch} (61%) rename patches/{server-remapped/0029-Prevent-tile-entity-and-entity-crashes.patch => server/0026-Prevent-tile-entity-and-entity-crashes.patch} (60%) create mode 100644 patches/server/0027-Configurable-top-of-nether-void-damage.patch rename patches/{server-remapped/0031-Check-online-mode-before-converting-and-renaming-pla.patch => server/0028-Check-online-mode-before-converting-and-renaming-pla.patch} (75%) rename patches/{server-remapped/0032-Always-tick-falling-blocks.patch => server/0029-Always-tick-falling-blocks.patch} (73%) rename patches/{server-remapped/0033-Configurable-end-credits.patch => server/0030-Configurable-end-credits.patch} (63%) rename patches/{server-remapped/0034-Fix-lag-from-explosions-processing-dead-entities.patch => server/0031-Fix-lag-from-explosions-processing-dead-entities.patch} (89%) rename patches/{server-remapped/0035-Optimize-explosions.patch => server/0032-Optimize-explosions.patch} (91%) diff --git a/patches/api/0006-Adventure.patch b/patches/api/0006-Adventure.patch index bbfafdf464..002a345853 100644 --- a/patches/api/0006-Adventure.patch +++ b/patches/api/0006-Adventure.patch @@ -6,6 +6,22 @@ Subject: [PATCH] Adventure Co-authored-by: zml Co-authored-by: Jake Potrebic +diff --git a/build.gradle.kts b/build.gradle.kts +index 95327c3971cd57e01da2a62e1b72ba15fcbb63f4..4c197e7d9966f8789e6709461e59fc89355afd9c 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -17,6 +17,11 @@ dependencies { + api("org.yaml:snakeyaml:1.29") + api("com.googlecode.json-simple:json-simple:1.1.1") // Paper + api("it.unimi.dsi:fastutil:8.2.2") ++ api(platform("net.kyori:adventure-bom:4.7.0")) ++ api("net.kyori:adventure-api") ++ api("net.kyori:adventure-text-serializer-gson") ++ api("net.kyori:adventure-text-serializer-legacy") ++ api("net.kyori:adventure-text-serializer-plain") + + compileOnly("org.apache.maven:maven-resolver-provider:3.8.1") + compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0") diff --git a/pom.xml b/pom.xml index 1ebc4c096638128194cea9c2a4131f901e7d6896..cae43ce5c1287a4cd117fd069d34ebc1b64b7fdb 100644 --- a/pom.xml diff --git a/patches/api-unmapped/0006-Player-affects-spawning-API.patch b/patches/api/0007-Player-affects-spawning-API.patch similarity index 100% rename from patches/api-unmapped/0006-Player-affects-spawning-API.patch rename to patches/api/0007-Player-affects-spawning-API.patch diff --git a/patches/api-unmapped/0007-Add-getTPS-method.patch b/patches/api/0008-Add-getTPS-method.patch similarity index 87% rename from patches/api-unmapped/0007-Add-getTPS-method.patch rename to patches/api/0008-Add-getTPS-method.patch index 22aef5d962..fc33d04f13 100644 --- a/patches/api-unmapped/0007-Add-getTPS-method.patch +++ b/patches/api/0008-Add-getTPS-method.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add getTPS method diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index ab4d5aca6251b620ef5d654fa4ea3fc31783c2f2..0636edd8d9121eabfa60957c8c224261d228a16b 100644 +index f3b07f0f1b3be14c8ecd059e1f3594cc90f84442..1014871a3d7bfcf2b749d20e6ef8096876f9b4d7 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1543,6 +1543,17 @@ public final class Bukkit { @@ -27,7 +27,7 @@ index ab4d5aca6251b620ef5d654fa4ea3fc31783c2f2..0636edd8d9121eabfa60957c8c224261 * Get the advancement specified by this key. * diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index b862f22d5f31934eb46b50ecf04f8c1bf23c5044..5c638e0d45e8896382bdbf9b9c10474b05a97df5 100644 +index 7abdbf43e2f52e8e9e0f7bd7c7a58baf347e3929..3f74dc04df61e7d038c99ad9c1c3bfff086a019a 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1301,6 +1301,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi diff --git a/patches/api-unmapped/0008-Entity-Origin-API.patch b/patches/api/0009-Entity-Origin-API.patch similarity index 100% rename from patches/api-unmapped/0008-Entity-Origin-API.patch rename to patches/api/0009-Entity-Origin-API.patch diff --git a/patches/api-unmapped/0009-Version-Command-2.0.patch b/patches/api/0010-Version-Command-2.0.patch similarity index 100% rename from patches/api-unmapped/0009-Version-Command-2.0.patch rename to patches/api/0010-Version-Command-2.0.patch diff --git a/patches/server-remapped/0025-Optimize-TileEntity-Ticking.patch b/patches/removed/1.17/0025-Optimize-TileEntity-Ticking.patch similarity index 99% rename from patches/server-remapped/0025-Optimize-TileEntity-Ticking.patch rename to patches/removed/1.17/0025-Optimize-TileEntity-Ticking.patch index db2d2e1d05..79f438b892 100644 --- a/patches/server-remapped/0025-Optimize-TileEntity-Ticking.patch +++ b/patches/removed/1.17/0025-Optimize-TileEntity-Ticking.patch @@ -3,6 +3,8 @@ From: Aikar Date: Sun, 8 Mar 2015 22:55:25 -0600 Subject: [PATCH] Optimize TileEntity Ticking +ticking logic changes implemented by mojang + diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java index 94adf0275a2e7093c152cc3b8b0a5747b3a13a86..5bcf9cefc29eb20e2cfbfb49e2b2662ec394a87e 100644 diff --git a/patches/server-remapped/0030-Configurable-top-of-nether-void-damage.patch b/patches/server-remapped/0030-Configurable-top-of-nether-void-damage.patch deleted file mode 100644 index 805929cc33..0000000000 --- a/patches/server-remapped/0030-Configurable-top-of-nether-void-damage.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Tue, 1 Mar 2016 23:58:50 -0600 -Subject: [PATCH] Configurable top of nether void damage - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d16ae924bcbe31c964f7fb448757c748e5c4418c..4bba6977a0287837b8927718c040ac61463f0469 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -134,4 +134,19 @@ public class PaperWorldConfig { - if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf); - if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); - } -+ -+ public int netherVoidTopDamageHeight; -+ public boolean doNetherTopVoidDamage() { return netherVoidTopDamageHeight > 0; } -+ private void netherVoidTopDamageHeight() { -+ netherVoidTopDamageHeight = getInt("nether-ceiling-void-damage-height", 0); -+ log("Top of the nether void damage height: " + netherVoidTopDamageHeight); -+ -+ if (PaperConfig.version < 18) { -+ boolean legacy = getBoolean("nether-ceiling-void-damage", false); -+ if (legacy) { -+ netherVoidTopDamageHeight = 128; -+ set("nether-ceiling-void-damage-height", netherVoidTopDamageHeight); -+ } -+ } -+ } - } -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index fd5b41ceb97dc8aa975f1c0ae05b58d0b09f2cd6..f3f48c268639937874dd39eea9bd8e119eebdce7 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -499,9 +499,16 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - this.fallDistance *= 0.5F; - } - -- if (this.getY() < -64.0D) { -- this.outOfWorld(); -+ // Paper start - Configurable nether ceiling damage -+ -+ // Extracted to own function -+ /* -+ if (this.locY() < -64.0D) { -+ this.an(); - } -+ */ -+ this.performVoidDamage(); -+ // Paper end - - if (!this.level.isClientSide) { - this.setSharedFlag(0, this.remainingFireTicks > 0); -@@ -594,6 +601,17 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - this.setRemainingFireTicks(0); - } - -+ // Paper start -+ protected void performVoidDamage() { -+ if (this.getY() < -64.0D || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER -+ && level.paperConfig.doNetherTopVoidDamage() -+ && this.getY() >= level.paperConfig.netherVoidTopDamageHeight)) { -+ this.doVoidDamage(); -+ } -+ } -+ // Paper end -+ -+ protected final void doVoidDamage() { this.outOfWorld(); } // Paper - OBFHELPER - protected void outOfWorld() { - this.remove(); - } -diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -index 9503376895d90e8db0d4f7b164e2d813dd1a4a3a..7ba74b0a9319e29077b5afe3019a463ed3004813 100644 ---- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -@@ -329,9 +329,15 @@ public abstract class AbstractMinecart extends Entity { - this.setDamage(this.getDamage() - 1.0F); - } - -- if (this.getY() < -64.0D) { -- this.outOfWorld(); -+ // Paper start - Configurable nether ceiling damage -+ // Extracted to own function -+ /* -+ if (this.locY() < -64.0D) { -+ this.an(); - } -+ */ -+ this.performVoidDamage(); -+ // Paper end - - // this.doPortalTick(); // CraftBukkit - handled in postTick - if (this.level.isClientSide) { diff --git a/patches/server/0009-Timings-v2.patch b/patches/server/0009-Timings-v2.patch index 77a87bfdee..0c79786b74 100644 --- a/patches/server/0009-Timings-v2.patch +++ b/patches/server/0009-Timings-v2.patch @@ -163,7 +163,7 @@ index 0000000000000000000000000000000000000000..72f9e1978394afb6e5cc1c0d085d4158 +} diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java new file mode 100644 -index 0000000000000000000000000000000000000000..2afec58d8eadc9357d8aa6b171d9249cdc5b8c4a +index 0000000000000000000000000000000000000000..f27fadc15cb7f5c782e45885ec6a5a69963beade --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingsExport.java @@ -0,0 +1,376 @@ @@ -316,8 +316,8 @@ index 0000000000000000000000000000000000000000..2afec58d8eadc9357d8aa6b171d9249c + ); + + parent.put("worlds", toObjectMapper(MinecraftServer.getServer().getAllLevels(), world -> { -+ if (world.serverLevelData.getLevelName().equals("worldeditregentempworld")) return null; -+ return pair(world.serverLevelData.getLevelName(), createObject( ++ if (world.getWorld().getName().equals("worldeditregentempworld")) return null; ++ return pair(world.getWorld().getName(), createObject( + pair("gamerules", toObjectMapper(world.getWorld().getGameRules(), rule -> { + return pair(rule, world.getWorld().getGameRuleValue(rule)); + })), diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index 91f7f04894..1b8b859d8f 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -22,10 +22,10 @@ index 1d03a79e9010bc514b72a81ba0ad4a62aeff1bb7..429b74474ced04d8dd8f038b8590b8df } diff --git a/src/main/java/io/papermc/paper/adventure/AdventureComponent.java b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java new file mode 100644 -index 0000000000000000000000000000000000000000..4b4cec054ad0146773b722c7e3708f988aeeb76d +index 0000000000000000000000000000000000000000..e597a90def72c5903382d7169fb7a2fb667b8a69 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java -@@ -0,0 +1,76 @@ +@@ -0,0 +1,82 @@ +package io.papermc.paper.adventure; + +import com.google.gson.JsonElement; @@ -37,12 +37,13 @@ index 0000000000000000000000000000000000000000..4b4cec054ad0146773b722c7e3708f98 +import net.kyori.adventure.text.TextComponent; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; ++import net.minecraft.util.FormattedCharSequence; +import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.checkerframework.checker.nullness.qual.Nullable; + +public final class AdventureComponent implements net.minecraft.network.chat.Component { + final Component wrapped; -+ private @MonotonicNonNull net.minecraft.network.chat.Component converted; ++ private net.minecraft.network.chat.@MonotonicNonNull Component converted; + + public AdventureComponent(final Component wrapped) { + this.wrapped = wrapped; @@ -57,7 +58,7 @@ index 0000000000000000000000000000000000000000..4b4cec054ad0146773b722c7e3708f98 + return converted; + } + -+ public @Nullable net.minecraft.network.chat.Component deepConvertedIfPresent() { ++ public net.minecraft.network.chat.@Nullable Component deepConvertedIfPresent() { + return this.converted; + } + @@ -95,6 +96,11 @@ index 0000000000000000000000000000000000000000..4b4cec054ad0146773b722c7e3708f98 + return this.deepConverted().copy(); + } + ++ @Override ++ public FormattedCharSequence getVisualOrderText() { ++ return this.deepConverted().getVisualOrderText(); ++ } ++ + public static class Serializer implements JsonSerializer { + @Override + public JsonElement serialize(final AdventureComponent src, final Type type, final JsonSerializationContext context) { @@ -821,49 +827,52 @@ index 0000000000000000000000000000000000000000..f72511a71c01718be48ee6b714e902d0 +} diff --git a/src/main/java/io/papermc/paper/adventure/VanillaBossBarListener.java b/src/main/java/io/papermc/paper/adventure/VanillaBossBarListener.java new file mode 100644 -index 0000000000000000000000000000000000000000..ee6d9d5c072d68cace63068a8e2ed603ad475378 +index 0000000000000000000000000000000000000000..7493efba31403cbe7f26e493f165f1b83aa847bb --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/VanillaBossBarListener.java -@@ -0,0 +1,41 @@ +@@ -0,0 +1,44 @@ +package io.papermc.paper.adventure; + +import java.util.Set; +import java.util.function.Consumer; ++import java.util.function.Function; ++ +import net.kyori.adventure.bossbar.BossBar; +import net.kyori.adventure.text.Component; +import net.minecraft.network.protocol.game.ClientboundBossEventPacket; ++import net.minecraft.world.BossEvent; +import org.checkerframework.checker.nullness.qual.NonNull; + +public final class VanillaBossBarListener implements BossBar.Listener { -+ private final Consumer action; ++ private final Consumer> action; + -+ public VanillaBossBarListener(final Consumer action) { ++ public VanillaBossBarListener(final Consumer> action) { + this.action = action; + } + + @Override + public void bossBarNameChanged(final @NonNull BossBar bar, final @NonNull Component oldName, final @NonNull Component newName) { -+ this.action.accept(ClientboundBossEventPacket.Operation.UPDATE_NAME); ++ this.action.accept(ClientboundBossEventPacket::createUpdateNamePacket); + } + + @Override + public void bossBarProgressChanged(final @NonNull BossBar bar, final float oldProgress, final float newProgress) { -+ this.action.accept(ClientboundBossEventPacket.Operation.UPDATE_PCT); ++ this.action.accept(ClientboundBossEventPacket::createUpdateProgressPacket); + } + + @Override + public void bossBarColorChanged(final @NonNull BossBar bar, final BossBar.@NonNull Color oldColor, final BossBar.@NonNull Color newColor) { -+ this.action.accept(ClientboundBossEventPacket.Operation.UPDATE_STYLE); ++ this.action.accept(ClientboundBossEventPacket::createUpdateStylePacket); + } + + @Override + public void bossBarOverlayChanged(final @NonNull BossBar bar, final BossBar.@NonNull Overlay oldOverlay, final BossBar.@NonNull Overlay newOverlay) { -+ this.action.accept(ClientboundBossEventPacket.Operation.UPDATE_STYLE); ++ this.action.accept(ClientboundBossEventPacket::createUpdateStylePacket); + } + + @Override + public void bossBarFlagsChanged(final @NonNull BossBar bar, final @NonNull Set flagsAdded, final @NonNull Set flagsRemoved) { -+ this.action.accept(ClientboundBossEventPacket.Operation.UPDATE_PROPERTIES); ++ this.action.accept(ClientboundBossEventPacket::createUpdatePropertiesPacket); + } +} diff --git a/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java b/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java @@ -2373,7 +2382,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.javaE new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -index 6486a76466691f958349a4706d7c9caff9cb8f64..1a4e2534e8a2114125c505f46868ba4e3f2880a0 100644 +index 6486a76466691f958349a4706d7c9caff9cb8f64..08fc05836b26f5f93ae74324705d5f593b57315a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java @@ -19,6 +19,12 @@ public class CraftInventoryCustom extends CraftInventory { @@ -2433,7 +2442,7 @@ index 6486a76466691f958349a4706d7c9caff9cb8f64..1a4e2534e8a2114125c505f46868ba4e + // Paper start + public MinecraftInventory(final InventoryHolder owner, final int size, final net.kyori.adventure.text.Component title) { + Validate.notNull(title, "Title cannot be null"); -+ this.items = NonNullList.a(size, ItemStack.EMPTY); ++ this.items = NonNullList.withSize(size, ItemStack.EMPTY); + this.title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(title); + this.adventure$title = title; + this.viewers = new ArrayList(); @@ -2539,7 +2548,7 @@ index b7cb3c94d88b2753fd1fc17c2842607576fd7874..f40d6a0048ad5b3f6e31d83894ee89f5 @Override public CraftMerchant getCraftMerchant() { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -index ca359cb1ac5f48d4f75d33946fcddedb270407c2..f8796e5b450cfcd5091d7bd50e873f45bcdbf484 100644 +index ca359cb1ac5f48d4f75d33946fcddedb270407c2..a33dd184ea51df7e59ed08e5e2b0ea4ed9dadff5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -1,8 +1,9 @@ @@ -2553,7 +2562,7 @@ index ca359cb1ac5f48d4f75d33946fcddedb270407c2..f8796e5b450cfcd5091d7bd50e873f45 import java.util.ArrayList; import java.util.Arrays; import java.util.List; -@@ -17,9 +18,12 @@ import org.bukkit.craftbukkit.util.CraftChatMessage; +@@ -17,9 +18,11 @@ import org.bukkit.craftbukkit.util.CraftChatMessage; import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.BookMeta.Generation; @@ -2562,11 +2571,10 @@ index ca359cb1ac5f48d4f75d33946fcddedb270407c2..f8796e5b450cfcd5091d7bd50e873f45 // Spigot start import static org.spigotmc.ValidateUtils.*; + -+import BookMetaBuilder; import java.util.AbstractList; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; -@@ -269,6 +273,141 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { +@@ -269,6 +272,141 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { this.generation = (generation == null) ? null : generation.ordinal(); } @@ -2708,7 +2716,7 @@ index ca359cb1ac5f48d4f75d33946fcddedb270407c2..f8796e5b450cfcd5091d7bd50e873f45 @Override public String getPage(final int page) { Validate.isTrue(this.isValidPage(page), "Invalid page number"); -@@ -413,7 +552,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { +@@ -413,7 +551,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { } @Override diff --git a/patches/server-remapped/0013-Configurable-cactus-bamboo-and-reed-growth-heights.patch b/patches/server/0011-Configurable-cactus-bamboo-and-reed-growth-heights.patch similarity index 87% rename from patches/server-remapped/0013-Configurable-cactus-bamboo-and-reed-growth-heights.patch rename to patches/server/0011-Configurable-cactus-bamboo-and-reed-growth-heights.patch index 2bef4fada9..39e3250118 100644 --- a/patches/server-remapped/0013-Configurable-cactus-bamboo-and-reed-growth-heights.patch +++ b/patches/server/0011-Configurable-cactus-bamboo-and-reed-growth-heights.patch @@ -29,19 +29,19 @@ index b31109d2dadd29e8852468c19265066b773d2be0..3618cc017feb60e257a28f67cbddca3f + } } diff --git a/src/main/java/net/minecraft/world/level/block/BambooBlock.java b/src/main/java/net/minecraft/world/level/block/BambooBlock.java -index 8f423ae6261434a670bb94aa70b6bc1694f1fc45..36583c189aa5e55de7f5eba362285e57c8279176 100644 +index 7f40f6206f10a78fb74c19bd62c584f9f5c3e635..878b8fb992b448f0a644f7fa2c2bded191ff8268 100644 --- a/src/main/java/net/minecraft/world/level/block/BambooBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BambooBlock.java -@@ -124,7 +124,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -137,7 +137,7 @@ public class BambooBlock extends Block implements BonemealableBlock { if (random.nextInt(Math.max(1, (int) (100.0F / world.spigotConfig.bambooModifier) * 3)) == 0 && world.isEmptyBlock(pos.above()) && world.getRawBrightness(pos.above(), 0) >= 9) { // Spigot - int i = this.getHeightBelowUpToMax(world, pos) + 1; + int i = this.getHeightBelowUpToMax((BlockGetter) world, pos) + 1; - if (i < 16) { + if (i < world.paperConfig.bambooMaxHeight) { // Paper this.growBamboo(state, (Level) world, pos, random, i); } } -@@ -155,7 +155,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -168,7 +168,7 @@ public class BambooBlock extends Block implements BonemealableBlock { int i = this.getHeightAboveUpToMax(world, pos); int j = this.getHeightBelowUpToMax(world, pos); @@ -50,7 +50,7 @@ index 8f423ae6261434a670bb94aa70b6bc1694f1fc45..36583c189aa5e55de7f5eba362285e57 } @Override -@@ -174,7 +174,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -187,7 +187,7 @@ public class BambooBlock extends Block implements BonemealableBlock { BlockPos blockposition1 = pos.above(i); BlockState iblockdata1 = world.getBlockState(blockposition1); @@ -59,7 +59,7 @@ index 8f423ae6261434a670bb94aa70b6bc1694f1fc45..36583c189aa5e55de7f5eba362285e57 return; } -@@ -215,7 +215,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -228,7 +228,7 @@ public class BambooBlock extends Block implements BonemealableBlock { } int j = (Integer) state.getValue(BambooBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1; @@ -68,7 +68,7 @@ index 8f423ae6261434a670bb94aa70b6bc1694f1fc45..36583c189aa5e55de7f5eba362285e57 // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, pos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooBlock.AGE, j)).setValue(BambooBlock.LEAVES, blockpropertybamboosize)).setValue(BambooBlock.STAGE, k), 3)) { -@@ -230,7 +230,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -243,7 +243,7 @@ public class BambooBlock extends Block implements BonemealableBlock { protected int getHeightAboveUpToMax(BlockGetter world, BlockPos pos) { int i; @@ -77,7 +77,7 @@ index 8f423ae6261434a670bb94aa70b6bc1694f1fc45..36583c189aa5e55de7f5eba362285e57 ; } -@@ -240,7 +240,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -253,7 +253,7 @@ public class BambooBlock extends Block implements BonemealableBlock { protected int getHeightBelowUpToMax(BlockGetter world, BlockPos pos) { int i; @@ -87,10 +87,10 @@ index 8f423ae6261434a670bb94aa70b6bc1694f1fc45..36583c189aa5e55de7f5eba362285e57 } diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -index d07fd9c1f726b1d45992352408499034c12683e6..de61393e3f702554817d81ff10693ec3fb63d492 100644 +index d6aad164b4910f86ff613db9b337ff174e69e4d7..722f1816cd4130fa4b1e2310badedc77ab96eee6 100644 --- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -@@ -54,7 +54,7 @@ public class CactusBlock extends Block { +@@ -56,7 +56,7 @@ public class CactusBlock extends Block { ; } @@ -100,10 +100,10 @@ index d07fd9c1f726b1d45992352408499034c12683e6..de61393e3f702554817d81ff10693ec3 if (j >= (byte) range(3, ((100.0F / world.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java -index 25f634ee93fa4678eaf09694d98783f2aef9d0f0..a795732af122204b88a01311e73892658132da25 100644 +index 77e9c50d2c64e7c7a6e658a2dba8919953c1842c..dbd0147ad08fb825b10665859054f17c9125b621 100644 --- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java -@@ -51,7 +51,7 @@ public class SugarCaneBlock extends Block { +@@ -53,7 +53,7 @@ public class SugarCaneBlock extends Block { ; } diff --git a/patches/server-remapped/0014-Configurable-baby-zombie-movement-speed.patch b/patches/server/0012-Configurable-baby-zombie-movement-speed.patch similarity index 95% rename from patches/server-remapped/0014-Configurable-baby-zombie-movement-speed.patch rename to patches/server/0012-Configurable-baby-zombie-movement-speed.patch index 1b143bb4a0..11104d0177 100644 --- a/patches/server-remapped/0014-Configurable-baby-zombie-movement-speed.patch +++ b/patches/server/0012-Configurable-baby-zombie-movement-speed.patch @@ -25,7 +25,7 @@ index 3618cc017feb60e257a28f67cbddca3f792a9833..796c17e0941922a9716212c6eae91643 + } } diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 992c9646c274350b30c1abb75e0469adc471397f..94e2a8f74e74d68d4a9b82b667fbff24b7e9e629 100644 +index 84a8269060acaa5bf55a1d0a3f79e093bf2e30e5..017d8de4d09f524aed2ee03af7ef79468503edf0 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -79,7 +79,7 @@ import org.bukkit.event.entity.EntityTransformEvent; @@ -37,7 +37,7 @@ index 992c9646c274350b30c1abb75e0469adc471397f..94e2a8f74e74d68d4a9b82b667fbff24 private static final EntityDataAccessor DATA_BABY_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT); public static final EntityDataAccessor DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); -@@ -182,9 +182,9 @@ public class Zombie extends Monster { +@@ -187,9 +187,9 @@ public class Zombie extends Monster { if (this.level != null && !this.level.isClientSide) { AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); diff --git a/patches/server-remapped/0015-Configurable-fishing-time-ranges.patch b/patches/server/0013-Configurable-fishing-time-ranges.patch similarity index 83% rename from patches/server-remapped/0015-Configurable-fishing-time-ranges.patch rename to patches/server/0013-Configurable-fishing-time-ranges.patch index 33edff1ef7..067aef2db8 100644 --- a/patches/server-remapped/0015-Configurable-fishing-time-ranges.patch +++ b/patches/server/0013-Configurable-fishing-time-ranges.patch @@ -22,11 +22,11 @@ index 796c17e0941922a9716212c6eae91643d8360418..78948c42b13194005bdbbbc69c2b7ae0 + } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index d74dae6d7bd78c082b39a4e38da640a57c40b341..2f67c2065ef29f17f12190b25bd1ea53e1fb55b4 100644 +index dde25bf5e4e6e6514a8141e4dee473d96eee83f5..c30b53d07bcd2575d65c323d8170573bbe85f212 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -@@ -82,6 +82,10 @@ public class FishingHook extends Projectile { - owner.fishing = this; +@@ -83,6 +83,10 @@ public class FishingHook extends Projectile { + this.noCulling = true; this.luck = Math.max(0, lureLevel); this.lureSpeed = Math.max(0, luckOfTheSeaLevel); + // Paper start @@ -35,4 +35,4 @@ index d74dae6d7bd78c082b39a4e38da640a57c40b341..2f67c2065ef29f17f12190b25bd1ea53 + // paper end } - public FishingHook(net.minecraft.world.entity.player.Player thrower, Level world, int lureLevel, int luckOfTheSeaLevel) { + public FishingHook(EntityType type, Level world) { diff --git a/patches/server-remapped/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch similarity index 78% rename from patches/server-remapped/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch rename to patches/server/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index 6f5fd676df..c8750f1179 100644 --- a/patches/server-remapped/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/patches/server/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -19,10 +19,10 @@ index 78948c42b13194005bdbbbc69c2b7ae0732a78c5..b41e7922dd96c3358eb849ab39982a75 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2a7f587e19fcdd6d01b360d6b47d9eadd9df92cc..584e83441a9fef88eb1b0a29bec8bda29d6a0c9c 100644 +index c8ebce55b4e3838bf70b115ffb0b634b3548a7dd..b82dd96147224057ea0e0dc92506b27ffbc9f034 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1104,6 +1104,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -1264,6 +1264,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return this.isInWater() || this.isInRain(); } @@ -31,25 +31,18 @@ index 2a7f587e19fcdd6d01b360d6b47d9eadd9df92cc..584e83441a9fef88eb1b0a29bec8bda2 return this.isInWater() || this.isInRain() || this.isInBubbleColumn(); } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 99cb4dc1a1009d4a29e651c94d21babcc61388ed..151ebcffc1f2ae02fa55ab83d2ae7d8a0057f29d 100644 +index e4f3dbff2605243039f9f59f025c931b3fb309c5..a5d90af5275c9c8069932f711069a6d422303d05 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1,5 +1,6 @@ - package net.minecraft.world.entity; - -+import PathfinderGoalFloat; - import com.google.common.collect.Maps; - import java.util.Arrays; - import java.util.Iterator; -@@ -96,6 +97,7 @@ public abstract class Mob extends LivingEntity { +@@ -103,6 +103,7 @@ public abstract class Mob extends LivingEntity { private final BodyRotationControl bodyRotationControl; protected PathNavigation navigation; public GoalSelector goalSelector; -+ @Nullable public PathfinderGoalFloat goalFloat; // Paper ++ @Nullable public net.minecraft.world.entity.ai.goal.FloatGoal goalFloat; // Paper public GoalSelector targetSelector; private LivingEntity target; private final Sensing sensing; -@@ -782,7 +784,17 @@ public abstract class Mob extends LivingEntity { +@@ -794,7 +795,17 @@ public abstract class Mob extends LivingEntity { @Override protected final void serverAiStep() { ++this.noActionTime; @@ -59,7 +52,7 @@ index 99cb4dc1a1009d4a29e651c94d21babcc61388ed..151ebcffc1f2ae02fa55ab83d2ae7d8a + if (goalFloat.validConditions()) goalFloat.update(); + this.getJumpControl().jumpIfSet(); + } -+ if ((this instanceof EntityBlaze || this instanceof EntityEnderman) && isInWaterOrRainOrBubble()) { ++ if ((this instanceof net.minecraft.world.entity.monster.Blaze || this instanceof net.minecraft.world.entity.monster.EnderMan) && isInWaterOrRainOrBubble()) { + hurt(DamageSource.DROWN, 1.0F); + } + return; @@ -69,10 +62,10 @@ index 99cb4dc1a1009d4a29e651c94d21babcc61388ed..151ebcffc1f2ae02fa55ab83d2ae7d8a this.sensing.tick(); this.level.getProfiler().pop(); diff --git a/src/main/java/net/minecraft/world/entity/ai/control/JumpControl.java b/src/main/java/net/minecraft/world/entity/ai/control/JumpControl.java -index 5f7ad2b57d8d8f0f6a7d880f55e08b52f017cf51..09d1cda50ce9076e9236d124aa7766a26a50dae1 100644 +index 4b85418a53018ce9a70fddde2ab18d52d2fc97d1..83c68b492d4596583160e3c6d56080a11777719c 100644 --- a/src/main/java/net/minecraft/world/entity/ai/control/JumpControl.java +++ b/src/main/java/net/minecraft/world/entity/ai/control/JumpControl.java -@@ -15,6 +15,7 @@ public class JumpControl { +@@ -14,6 +14,7 @@ public class JumpControl implements Control { this.jump = true; } @@ -81,10 +74,10 @@ index 5f7ad2b57d8d8f0f6a7d880f55e08b52f017cf51..09d1cda50ce9076e9236d124aa7766a2 this.mob.setJumping(this.jump); this.jump = false; diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -index 7ea5cb5a92ff3b66859ebcd53031aa06689bd329..790b5646683247ef757095a0763dc52701afe97b 100644 +index 54085b104547f2fe7c08ff8aa4839b1230877bca..5a2e3cc833b3fa7d6fcea1474e25c469a53b3bae 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -@@ -11,15 +11,18 @@ public class FloatGoal extends Goal { +@@ -9,15 +9,18 @@ public class FloatGoal extends Goal { public FloatGoal(Mob mob) { this.mob = mob; @@ -96,7 +89,7 @@ index 7ea5cb5a92ff3b66859ebcd53031aa06689bd329..790b5646683247ef757095a0763dc527 + public final boolean validConditions() { return this.canUse(); } // Paper - OBFHELPER @Override public boolean canUse() { - return this.mob.isInWater() && this.mob.getFluidHeight((Tag) FluidTags.WATER) > this.mob.getFluidJumpThreshold() || this.mob.isInLava(); + return this.mob.isInWater() && this.mob.getFluidHeight(FluidTags.WATER) > this.mob.getFluidJumpThreshold() || this.mob.isInLava(); } + public void update() { this.tick(); } // Paper - OBFHELPER diff --git a/patches/server-remapped/0017-Add-configurable-despawn-distances-for-living-entiti.patch b/patches/server/0015-Add-configurable-despawn-distances-for-living-entiti.patch similarity index 92% rename from patches/server-remapped/0017-Add-configurable-despawn-distances-for-living-entiti.patch rename to patches/server/0015-Add-configurable-despawn-distances-for-living-entiti.patch index 4a3d5d60ea..c304874a50 100644 --- a/patches/server-remapped/0017-Add-configurable-despawn-distances-for-living-entiti.patch +++ b/patches/server/0015-Add-configurable-despawn-distances-for-living-entiti.patch @@ -30,16 +30,16 @@ index b41e7922dd96c3358eb849ab39982a75736e3476..2f0d582baf0eb2bb477944d0cb1369db + } } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 151ebcffc1f2ae02fa55ab83d2ae7d8a0057f29d..4d3000067ae3d46b7ed4dda6146a21993199c6d9 100644 +index a5d90af5275c9c8069932f711069a6d422303d05..697f73cabfe89e716c9fceeb8362237d27ca3d02 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -762,16 +762,16 @@ public abstract class Mob extends LivingEntity { +@@ -773,16 +773,16 @@ public abstract class Mob extends LivingEntity { int i = this.getType().getCategory().getDespawnDistance(); int j = i * i; - if (d0 > (double) j) { // CraftBukkit - remove isTypeNotPersistent() check + if (d0 > (double) level.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances - this.remove(); + this.discard(); } int k = this.getType().getCategory().getNoDespawnDistance(); @@ -47,7 +47,7 @@ index 151ebcffc1f2ae02fa55ab83d2ae7d8a0057f29d..4d3000067ae3d46b7ed4dda6146a2199 - if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l) { // CraftBukkit - remove isTypeNotPersistent() check + if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > level.paperConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances - this.remove(); + this.discard(); - } else if (d0 < (double) l) { + } else if (d0 < level.paperConfig.softDespawnDistance) { // Paper - custom despawn distances this.noActionTime = 0; diff --git a/patches/server-remapped/0018-Allow-for-toggling-of-spawn-chunks.patch b/patches/server/0016-Allow-for-toggling-of-spawn-chunks.patch similarity index 91% rename from patches/server-remapped/0018-Allow-for-toggling-of-spawn-chunks.patch rename to patches/server/0016-Allow-for-toggling-of-spawn-chunks.patch index 91cd6d02b8..a1cd24c0d5 100644 --- a/patches/server-remapped/0018-Allow-for-toggling-of-spawn-chunks.patch +++ b/patches/server/0016-Allow-for-toggling-of-spawn-chunks.patch @@ -20,10 +20,10 @@ index 2f0d582baf0eb2bb477944d0cb1369db6ca33956..89e76dd73811fd0f6f8c8e7e5af804d5 + } } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c153df1f4dea3dc0ae744bde01e334b3bd3b50af..832abf73bdab2488c5814ea6e57888aac1b26154 100644 +index 59730455fcdf22bada7288833cf7e8b6c9b4096a..d106ab5bbe0647aa2ad285baaabb62b79ced3c06 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -217,6 +217,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -236,6 +236,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { }); // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/patches/server-remapped/0019-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/0017-Drop-falling-block-and-tnt-entities-at-the-specified.patch similarity index 74% rename from patches/server-remapped/0019-Drop-falling-block-and-tnt-entities-at-the-specified.patch rename to patches/server/0017-Drop-falling-block-and-tnt-entities-at-the-specified.patch index 91e53448a3..6530418157 100644 --- a/patches/server-remapped/0019-Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/patches/server/0017-Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -24,23 +24,11 @@ index 89e76dd73811fd0f6f8c8e7e5af804d5a4bb5a75..d16ae924bcbe31c964f7fb448757c748 + if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); + } } -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 584e83441a9fef88eb1b0a29bec8bda29d6a0c9c..706417f44c1eebc7cc5e8e7053fa0ab21f4caeba 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1849,6 +1849,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - return this.spawnAtLocation(stack, 0.0F); - } - -+ @Nullable public final ItemEntity dropItem(ItemStack itemstack, float offset) { return this.spawnAtLocation(itemstack, offset); } // Paper - OBFHELPER - @Nullable - public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) { - if (stack.isEmpty()) { diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 8a9e2316b9f5756503dc06e27981525d2cd7d1a5..5394bc6336cb84025c1c748fb5b3d38e0648a590 100644 +index 86493f18913f6d3a560de2e3f8690bd227d73cee..11ed0127e2ea268f16c6b4b380d132a71ec9b3dc 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -122,6 +122,17 @@ public class FallingBlockEntity extends Entity { +@@ -127,6 +127,17 @@ public class FallingBlockEntity extends Entity { } this.move(MoverType.SELF, this.getDeltaMovement()); @@ -51,7 +39,7 @@ index 8a9e2316b9f5756503dc06e27981525d2cd7d1a5..5394bc6336cb84025c1c748fb5b3d38e + this.spawnAtLocation(block); + } + -+ this.remove(); ++ this.discard(); + return; + } + // Paper end @@ -59,16 +47,16 @@ index 8a9e2316b9f5756503dc06e27981525d2cd7d1a5..5394bc6336cb84025c1c748fb5b3d38e blockposition = this.blockPosition(); boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -index ff15a372b7cad5fa88b7ef6de1f3441d93f9c67e..4c4262b8f0cb44b8cea8cb46194a6e70d4ce56f4 100644 +index 540fe28b16ff0208e23ecdd50fc5fa05960c0299..394164f50256ad9a167e15531a9202875abb6cb6 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -@@ -69,6 +69,12 @@ public class PrimedTnt extends Entity { +@@ -68,6 +68,12 @@ public class PrimedTnt extends Entity { } this.move(MoverType.SELF, this.getDeltaMovement()); + // Paper start - Configurable TNT entity height nerf + if (this.level.paperConfig.entityTNTHeightNerf != 0 && this.getY() > this.level.paperConfig.entityTNTHeightNerf) { -+ this.remove(); ++ this.discard(); + return; + } + // Paper end @@ -76,16 +64,16 @@ index ff15a372b7cad5fa88b7ef6de1f3441d93f9c67e..4c4262b8f0cb44b8cea8cb46194a6e70 if (this.onGround) { this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D)); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java -index c2ed3ba42d29a50386c94b109fdd3b2f2f1b433b..3b5e96f2325e14a94de0fb2d6da86812cecc7395 100644 +index 01d3247501ad228882e9e0a03f964a18e051d4c4..4572a3cf0a067b64f2bd6c31139a773cddf4e872 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java -@@ -47,6 +47,12 @@ public class MinecartTNT extends AbstractMinecart { +@@ -45,6 +45,12 @@ public class MinecartTNT extends AbstractMinecart { public void tick() { super.tick(); if (this.fuse > 0) { + // Paper start - Configurable TNT entity height nerf + if (this.level.paperConfig.entityTNTHeightNerf != 0 && this.getY() > this.level.paperConfig.entityTNTHeightNerf) { -+ this.remove(); ++ this.discard(); + return; + } + // Paper end diff --git a/patches/server-remapped/0020-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch similarity index 84% rename from patches/server-remapped/0020-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch rename to patches/server/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index e00adead2f..a6742d2967 100644 --- a/patches/server-remapped/0020-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -6,36 +6,36 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang diff --git a/src/main/java/net/minecraft/server/Eula.java b/src/main/java/net/minecraft/server/Eula.java -index 6934b0fdfe11ef673a3e4ae7564d04acee169252..9f104b1bd05d9f344579f086b2b9c00af1750690 100644 +index 2c53a400611c78236c5a1c1270d27c02e94251bf..a1d5c0f8fe2adb2ee56f3217e089211ec7c61eb0 100644 --- a/src/main/java/net/minecraft/server/Eula.java +++ b/src/main/java/net/minecraft/server/Eula.java -@@ -72,7 +72,7 @@ public class Eula { +@@ -64,7 +64,7 @@ public class Eula { + try { Properties properties = new Properties(); - properties.setProperty("eula", "false"); -- properties.store(outputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)."); -+ properties.store(outputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).\nYou also agree that tacos are tasty, and the best food in the world."); // Paper - fix lag; - } catch (Throwable throwable1) { - throwable = throwable1; - throw throwable1; +- properties.store(outputStream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)."); ++ properties.store(outputStream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).\nYou also agree that tacos are tasty, and the best food in the world."); // Paper - fix lag; + } catch (Throwable var5) { + if (outputStream != null) { + try { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index a456b9cbf0e5eea4e888e0e3d07ed17558650371..fa29790600021809f31092a90e1a3a9b84d5e0c4 100644 +index 6a6249ad58cc90782d526d89c899f30a59b980b2..e8d732933ddd2b670ff0b9c8d9be84a332f06482 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1340,7 +1340,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop // CraftBukkit - cb > vanilla! + return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! } - public CrashReport fillReport(CrashReport report) { + public SystemReport fillSystemReport(SystemReport systemreport) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f7f5457d20586e0ba72368e64ff6025f6755e61e..f81def94a1a7ab3a24b74a8bbd5f3e8ebae2c0d5 100644 +index ea8d5d95d9aa2d0036f82eca782cb5a633cbc388..6628000abc628efb71c9a0391a429b20920575b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -224,7 +224,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; +@@ -227,7 +227,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; import net.md_5.bungee.api.chat.BaseComponent; // Spigot public final class CraftServer implements Server { @@ -45,11 +45,11 @@ index f7f5457d20586e0ba72368e64ff6025f6755e61e..f81def94a1a7ab3a24b74a8bbd5f3e8e private final String bukkitVersion = Versioning.getBukkitVersion(); private final Logger logger = Logger.getLogger("Minecraft"); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index ce9f10f890a5866ab6208c7253b15b09fe323a81..e8c225fcd1a3fa5a7e1971683b1876dd6462a1e2 100644 +index 4df6b2a155a610953d8d5789bffa33d290d62aaa..399cb06c7ae3570d08430e8675f141657d1026d4 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -206,12 +206,25 @@ public class Main { - deadline.add(Calendar.DAY_OF_YEAR, -28); +@@ -210,12 +210,25 @@ public class Main { + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); @@ -76,7 +76,7 @@ index ce9f10f890a5866ab6208c7253b15b09fe323a81..e8c225fcd1a3fa5a7e1971683b1876dd net.minecraft.server.Main.main(options); } catch (Throwable t) { diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 9a695b80ef57d677fbdee1bfc59f0f9125a7ebd4..21d7b483920841456707fe3f08b180c1f072b7f7 100644 +index 335120afc88a8fc1543c2e6df516fd728e3ab032..d5863b0b06384b25eaa33572fa02649795463ed8 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -19,7 +19,7 @@ public class WatchdogThread extends Thread @@ -112,6 +112,6 @@ index 9a695b80ef57d677fbdee1bfc59f0f9125a7ebd4..21d7b483920841456707fe3f08b180c1 log.log( Level.SEVERE, "------------------------------" ); - log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" ); + log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper - dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log ); + WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log ); log.log( Level.SEVERE, "------------------------------" ); // diff --git a/patches/server-remapped/0021-Implement-Paper-VersionChecker.patch b/patches/server/0019-Implement-Paper-VersionChecker.patch similarity index 98% rename from patches/server-remapped/0021-Implement-Paper-VersionChecker.patch rename to patches/server/0019-Implement-Paper-VersionChecker.patch index 66c45ee1f0..947adba5b8 100644 --- a/patches/server-remapped/0021-Implement-Paper-VersionChecker.patch +++ b/patches/server/0019-Implement-Paper-VersionChecker.patch @@ -133,7 +133,7 @@ index 0000000000000000000000000000000000000000..1a1b50e475b9ede544b2f6d0d36632b2 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 2d4faef5a2b9c4fe8b65ff4f1346b8375e0e02c8..21052d0e88351b075733331d71e07b086354b820 100644 +index 409515c406f5b5cfac9872f925dbc67159a5d41f..c49d2dd323e7164ded499e561821da2c0e4be9da 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -368,6 +368,11 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server-remapped/0022-Add-version-history-to-version-command.patch b/patches/server/0020-Add-version-history-to-version-command.patch similarity index 98% rename from patches/server-remapped/0022-Add-version-history-to-version-command.patch rename to patches/server/0020-Add-version-history-to-version-command.patch index 4985c3e747..332461d12c 100644 --- a/patches/server-remapped/0022-Add-version-history-to-version-command.patch +++ b/patches/server/0020-Add-version-history-to-version-command.patch @@ -202,10 +202,10 @@ index 0000000000000000000000000000000000000000..aac3f66cb23d260729c2a48d8710a9de + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 40fe03c844c8bf6a9c4c5ae028b259f01a81eead..c7655883262f122b373ac30a33ddb4c06cd9aebe 100644 +index 844d3b910cfb1c073b8b58b0eff3f28af5453701..566390d02b2af4a0f2c867b7ff8116a8301e8497 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -193,6 +193,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -202,6 +202,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface return false; } com.destroystokyo.paper.PaperConfig.registerCommands(); diff --git a/patches/server-remapped/0023-Player-affects-spawning-API.patch b/patches/server/0021-Player-affects-spawning-API.patch similarity index 71% rename from patches/server-remapped/0023-Player-affects-spawning-API.patch rename to patches/server/0021-Player-affects-spawning-API.patch index 08d7ac1c4a..4b0545775d 100644 --- a/patches/server-remapped/0023-Player-affects-spawning-API.patch +++ b/patches/server/0021-Player-affects-spawning-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player affects spawning API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 706417f44c1eebc7cc5e8e7053fa0ab21f4caeba..392f2f2d67b688d5b37f77c8e4b3036348472d77 100644 +index b82dd96147224057ea0e0dc92506b27ffbc9f034..568ce924efcad6ab6b986f1a450eb56c80e89b02 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1353,6 +1353,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -1498,6 +1498,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return Mth.sqrt(f * f + f1 * f1 + f2 * f2); } @@ -17,29 +17,28 @@ index 706417f44c1eebc7cc5e8e7053fa0ab21f4caeba..392f2f2d67b688d5b37f77c8e4b30363 double d3 = this.getX() - x; double d4 = this.getY() - y; diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java -index f8c13881f59ccaccf8d8e5496d2f8f49ba7d7343..a3bad391a719363077740aa810c9412df34b4ae5 100644 +index 195989667c7d844399a72787819f62a3fd0d9c78..d17b75ad13bbc8a38cdc2f2d77ee5d88438cec31 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java +++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java -@@ -29,6 +29,12 @@ public final class EntitySelector { - return !entity.isSpectator(); +@@ -28,6 +28,11 @@ public final class EntitySelector { }; + private EntitySelector() {} + // Paper start + public static final Predicate affectsSpawning = (entity) -> { -+ return !entity.isSpectator() && entity.isAlive() && (entity instanceof EntityPlayer) && ((EntityPlayer) entity).affectsSpawning; ++ return !entity.isSpectator() && entity.isAlive() && (entity instanceof net.minecraft.server.level.ServerPlayer) && ((net.minecraft.server.level.ServerPlayer) entity).affectsSpawning; + }; + // Paper end -+ - public static Predicate withinDistance(double x, double y, double z, double d3) { - double d4 = d3 * d3; + public static Predicate withinDistance(double x, double y, double z, double max) { + double d4 = max * max; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 4d3000067ae3d46b7ed4dda6146a21993199c6d9..09d39b73e8a3987e58a502bd914a6451b807421b 100644 +index 697f73cabfe89e716c9fceeb8362237d27ca3d02..b13774873f795b149c15fddb8053d9419f1841ca 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -755,7 +755,7 @@ public abstract class Mob extends LivingEntity { +@@ -766,7 +766,7 @@ public abstract class Mob extends LivingEntity { if (this.level.getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { - this.remove(); + this.discard(); } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { - Player entityhuman = this.level.getNearestPlayer(this, -1.0D); + Player entityhuman = this.level.findNearbyPlayer(this, -1.0D, EntitySelector.affectsSpawning); // Paper @@ -47,10 +46,10 @@ index 4d3000067ae3d46b7ed4dda6146a21993199c6d9..09d39b73e8a3987e58a502bd914a6451 if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java -index 4ce9e37d7334ba0557c397c0ebd2cb7928c7c564..cfdbaec1de6add7a189c26eb66701dfa5f40fe4f 100644 +index 7d741c2aebbc1c6cf1ff59cca6480325db6ca29c..2459ae800a5f6b234a4f4bb1cd3738e4e9cac67d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java +++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java -@@ -122,7 +122,7 @@ public class Silverfish extends Monster { +@@ -123,7 +123,7 @@ public class Silverfish extends Monster { if (checkAnyLightMonsterSpawnRules(type, world, spawnReason, pos, random)) { Player entityhuman = world.getNearestPlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 5.0D, true); @@ -60,10 +59,10 @@ index 4ce9e37d7334ba0557c397c0ebd2cb7928c7c564..cfdbaec1de6add7a189c26eb66701dfa return false; } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 91f605c803c021c8743de87b67dcb0fb9fc807e9..3b451e75a7f49ea6b543aee9f0a51c0be3c4dfba 100644 +index 24530af0382be01e26516d8fa29f61c912ebb9aa..a76f1cab566a3c8c8d1b0204b5c2c8492312c9f0 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -161,6 +161,9 @@ public abstract class Player extends LivingEntity { +@@ -176,6 +176,9 @@ public abstract class Player extends LivingEntity { private final ItemCooldowns cooldowns; @Nullable public FishingHook fishing; @@ -74,23 +73,23 @@ index 91f605c803c021c8743de87b67dcb0fb9fc807e9..3b451e75a7f49ea6b543aee9f0a51c0b // CraftBukkit start public boolean fauxSleeping; diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 98f85d59bc48451ef6381a47fe341f77b9920981..10058d3c3565382faa893b79119c5caf845bf29a 100644 +index 03bdbb832ff6a86f2dac9c008de45f3bb53aa688..a003e1c0d99a4d4c88269ea5bad250ba73bbc9c9 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -66,7 +66,7 @@ public abstract class BaseSpawner { - private boolean isNearPlayer() { - BlockPos blockposition = this.getPos(); - -- return this.getLevel().hasNearbyAlivePlayer((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); -+ return this.getLevel().isAffectsSpawningPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper +@@ -77,7 +77,7 @@ public abstract class BaseSpawner { } - public void tick() { + private boolean isNearPlayer(Level world, BlockPos pos) { +- return world.hasNearbyAlivePlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); ++ return world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper + } + + public void clientTick(Level world, BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index 7e7a58b9a9ececdcc37fc33b33703428eb1d5faf..66681b9f0e2531d3da25629e44180417b32b4d66 100644 +index 389985e022b82c675fb21f363422471bd15b84b0..0b6e5ee9872a73823219bff7f642375fdc4ec243 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -92,8 +92,9 @@ public interface EntityGetter { +@@ -71,8 +71,9 @@ public interface EntityGetter { } } @@ -99,16 +98,16 @@ index 7e7a58b9a9ececdcc37fc33b33703428eb1d5faf..66681b9f0e2531d3da25629e44180417 + default Player findNearbyPlayer(Entity entity, double d0, @Nullable Predicate predicate) { return this.findNearbyPlayer(entity.getX(), entity.getY(), entity.getZ(), d0, predicate); } // Paper + @Nullable default Player findNearbyPlayer(double d0, double d1, double d2, double d3, @Nullable Predicate predicate) { return getNearestPlayer(d0, d1, d2, d3, predicate); } // Paper - OBFHELPER + @Nullable default Player getNearestPlayer(double x, double y, double z, double maxDistance, @Nullable Predicate targetPredicate) { // Paper - double d4 = -1.0D; - Player entityhuman = null; - Iterator iterator = this.players().iterator(); -@@ -126,6 +127,27 @@ public interface EntityGetter { + double d = -1.0D; + Player player = null; + +@@ -100,6 +101,27 @@ public interface EntityGetter { return this.getNearestPlayer(x, y, z, maxDistance, predicate); } + // Paper end + default boolean isAffectsSpawningPlayerNearby(double d0, double d1, double d2, double d3) { -+ Iterator iterator = this.players().iterator(); ++ java.util.Iterator iterator = this.players().iterator(); + double d4; + do { + Player entityhuman; @@ -128,16 +127,16 @@ index 7e7a58b9a9ececdcc37fc33b33703428eb1d5faf..66681b9f0e2531d3da25629e44180417 + // Paper end + default boolean hasNearbyAlivePlayer(double x, double y, double z, double range) { - Iterator iterator = this.players().iterator(); - + for(Player player : this.players()) { + if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 50d11611702e3d1f0e980fb8f2280b05b891167b..e6c39c822c6a910f63e9b4899d53b7d75e1b77cf 100644 +index f4dff38b0f9e33be3495433559935765f77d662e..531ebabd1682539c453825111ba46a9a07f9dc8f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1768,8 +1768,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1769,8 +1769,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { - return getHandle().locale; + return this.getHandle().locale; + + } + @@ -154,4 +153,4 @@ index 50d11611702e3d1f0e980fb8f2280b05b891167b..e6c39c822c6a910f63e9b4899d53b7d7 + @Override public void updateCommands() { - if (getHandle().connection == null) return; + if (this.getHandle().connection == null) return; diff --git a/patches/server-remapped/0024-Remove-invalid-mob-spawner-tile-entities.patch b/patches/server/0022-Remove-invalid-mob-spawner-tile-entities.patch similarity index 62% rename from patches/server-remapped/0024-Remove-invalid-mob-spawner-tile-entities.patch rename to patches/server/0022-Remove-invalid-mob-spawner-tile-entities.patch index 23323c9803..c4cfd682ed 100644 --- a/patches/server-remapped/0024-Remove-invalid-mob-spawner-tile-entities.patch +++ b/patches/server/0022-Remove-invalid-mob-spawner-tile-entities.patch @@ -5,27 +5,30 @@ Subject: [PATCH] Remove invalid mob spawner tile entities diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index f30793b81dfd9018b4879d655c7c18a9f9c25267..300749822d52f9f973e71c6ec9c8bf29d6a6938e 100644 +index 485cb87e83dd4b4b052905fb7f5f83d3c26f542f..ee2df7de72c75e4fbf8a681ff254260554969b66 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -41,7 +41,9 @@ import net.minecraft.world.level.TickList; +@@ -46,10 +46,12 @@ import net.minecraft.world.level.TickList; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.SpawnerBlock; import net.minecraft.world.level.block.entity.BlockEntity; + import net.minecraft.world.level.block.entity.BlockEntityTicker; + import net.minecraft.world.level.block.entity.BlockEntityType; + import net.minecraft.world.level.block.entity.TickingBlockEntity; +import net.minecraft.world.level.block.entity.SpawnerBlockEntity; import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.levelgen.DebugLevelSource; - import net.minecraft.world.level.levelgen.Heightmap; -@@ -647,6 +649,10 @@ public class LevelChunk implements ChunkAccess { + import net.minecraft.world.level.gameevent.EuclideanGameEventDispatcher; + import net.minecraft.world.level.gameevent.GameEventDispatcher; +@@ -608,6 +610,10 @@ public class LevelChunk implements ChunkAccess { } // CraftBukkit start + // Paper start - Remove invalid mob spawner tile entities -+ } else if (blockEntity instanceof SpawnerBlockEntity && !(getBlockData(pos.getX(), pos.getY(), pos.getZ()).getBlock() instanceof SpawnerBlock)) { -+ this.blockEntities.remove(pos); ++ } else if (blockEntity instanceof SpawnerBlockEntity && !(getBlockState(blockposition).getBlock() instanceof SpawnerBlock)) { ++ this.blockEntities.remove(blockposition); + // Paper end } else { System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ() - + " (" + getBlockState(pos) + ") where there was no entity tile!"); + + " (" + this.getBlockState(blockposition) + ") where there was no entity tile!"); diff --git a/patches/server-remapped/0026-Further-improve-server-tick-loop.patch b/patches/server/0023-Further-improve-server-tick-loop.patch similarity index 82% rename from patches/server-remapped/0026-Further-improve-server-tick-loop.patch rename to patches/server/0023-Further-improve-server-tick-loop.patch index ee0ab66ab5..12d66e5007 100644 --- a/patches/server-remapped/0026-Further-improve-server-tick-loop.patch +++ b/patches/server/0023-Further-improve-server-tick-loop.patch @@ -12,10 +12,10 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fa29790600021809f31092a90e1a3a9b84d5e0c4..526d6c0fa45bfba92a3f964f72e4965fd5c841c1 100644 +index e8d732933ddd2b670ff0b9c8d9be84a332f06482..400aac6a37c63f34bf0038780e2137d82bc3416d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -251,7 +251,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; public Commands vanillaCommandDispatcher; -@@ -260,7 +260,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit long j = i / 50L; - if (server.getWarnOnOverload()) // CraftBukkit + if (this.server.getWarnOnOverload()) // CraftBukkit - MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j); + MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j); this.nextTickTime += j * 50L; this.lastOverloadWarning = this.nextTickTime; } -- if ( tickCount++ % SAMPLE_INTERVAL == 0 ) -+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) +- if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 ) ++ if ( ++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0 ) { -- double currentTps = 1E3 / ( curTime - tickSection ) * SAMPLE_INTERVAL; -- recentTps[0] = calcTps( recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min) -- recentTps[1] = calcTps( recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min) -- recentTps[2] = calcTps( recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min) +- double currentTps = 1E3 / ( curTime - tickSection ) * MinecraftServer.SAMPLE_INTERVAL; +- this.recentTps[0] = MinecraftServer.calcTps( this.recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min) +- this.recentTps[1] = MinecraftServer.calcTps( this.recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min) +- this.recentTps[2] = MinecraftServer.calcTps( this.recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min) + final long diff = curTime - tickSection; + java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP); + tps1.add(currentTps, diff); + tps5.add(currentTps, diff); + tps15.add(currentTps, diff); + // Backwards compat with bad plugins -+ recentTps[0] = tps1.getAverage(); -+ recentTps[1] = tps5.getAverage(); -+ recentTps[2] = tps15.getAverage(); ++ this.recentTps[0] = tps1.getAverage(); ++ this.recentTps[1] = tps5.getAverage(); ++ this.recentTps[2] = tps15.getAverage(); + // Paper end tickSection = curTime; } // Spigot end +@@ -1021,7 +1079,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) { diff --git a/patches/server-remapped/0027-Only-refresh-abilities-if-needed.patch b/patches/server/0024-Only-refresh-abilities-if-needed.patch similarity index 56% rename from patches/server-remapped/0027-Only-refresh-abilities-if-needed.patch rename to patches/server/0024-Only-refresh-abilities-if-needed.patch index b310cdcaa1..6c1175df0c 100644 --- a/patches/server-remapped/0027-Only-refresh-abilities-if-needed.patch +++ b/patches/server/0024-Only-refresh-abilities-if-needed.patch @@ -5,21 +5,21 @@ Subject: [PATCH] Only refresh abilities if needed diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e6c39c822c6a910f63e9b4899d53b7d75e1b77cf..2920ba3d8eeb62670897ea19b50aaf395ab84c5a 100644 +index 531ebabd1682539c453825111ba46a9a07f9dc8f..1392d4d5027b3d972b2196af7b19fb409977fb8d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1437,12 +1437,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1438,12 +1438,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setFlying(boolean value) { -+ boolean needsUpdate = getHandle().abilities.flying != value; // Paper - Only refresh abilities if needed - if (!getAllowFlight() && value) { ++ boolean needsUpdate = getHandle().getAbilities().flying != value; // Paper - Only refresh abilities if needed + if (!this.getAllowFlight() && value) { throw new IllegalArgumentException("Cannot make player fly if getAllowFlight() is false"); } - getHandle().abilities.flying = value; -- getHandle().onUpdateAbilities(); -+ if (needsUpdate) getHandle().onUpdateAbilities(); // Paper - Only refresh abilities if needed + this.getHandle().getAbilities().flying = value; +- this.getHandle().onUpdateAbilities(); ++ if (needsUpdate) this.getHandle().onUpdateAbilities(); // Paper - Only refresh abilities if needed } @Override diff --git a/patches/server-remapped/0028-Entity-Origin-API.patch b/patches/server/0025-Entity-Origin-API.patch similarity index 61% rename from patches/server-remapped/0028-Entity-Origin-API.patch rename to patches/server/0025-Entity-Origin-API.patch index cc2e7adc4a..225f30bfa1 100644 --- a/patches/server-remapped/0028-Entity-Origin-API.patch +++ b/patches/server/0025-Entity-Origin-API.patch @@ -5,25 +5,25 @@ Subject: [PATCH] Entity Origin API diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java -index 084340dc73acb3d972e0717b48da820c027a5137..7927ebac41eb1f257738238500cfe0c06031fcaf 100644 +index 88bac72edf19c578902f49d20353989ed4d96f8f..e79faeb26d079de0108268fd2607cf9eb885c003 100644 --- a/src/main/java/net/minecraft/nbt/ListTag.java +++ b/src/main/java/net/minecraft/nbt/ListTag.java -@@ -190,6 +190,7 @@ public class ListTag extends CollectionTag { - return new int[0]; +@@ -179,6 +179,7 @@ public class ListTag extends CollectionTag { + return new long[0]; } + public final double getDoubleAt(int i) { return this.getDouble(i); } // Paper - OBFHELPER public double getDouble(int index) { if (index >= 0 && index < this.list.size()) { - Tag nbtbase = (Tag) this.list.get(index); + Tag tag = this.list.get(index); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0cc86ca4ea4a2e1b5acc3c0507397eef85dec0c1..d2bb9385fbc21cdef6cef06680fac685d3da3570 100644 +index c89c983e6f64718dabb2893996f7eb4a111c97c9..d26e8803222276fb7bb1bedd9fd13a8861ce671c 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1240,6 +1240,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - this.navigations.add(((Mob) entity).getNavigation()); +@@ -1110,6 +1110,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl + entityplayer.connection.send(new ClientboundBlockDestructionPacket(entityId, pos, progress)); + } } - entity.valid = true; // CraftBukkit + // Paper start - Set origin location when the entity is being added to the world + if (entity.origin == null) { + entity.origin = entity.getBukkitEntity().getLocation(); @@ -33,10 +33,10 @@ index 0cc86ca4ea4a2e1b5acc3c0507397eef85dec0c1..d2bb9385fbc21cdef6cef06680fac685 } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 392f2f2d67b688d5b37f77c8e4b3036348472d77..fd5b41ceb97dc8aa975f1c0ae05b58d0b09f2cd6 100644 +index 568ce924efcad6ab6b986f1a450eb56c80e89b02..84c2a14d7336d57d5db66d01c75e31a58860d96c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -246,6 +246,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -280,6 +280,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only public boolean forceExplosionKnockback; // SPIGOT-949 public boolean persistentInvisibility = false; @@ -44,29 +44,29 @@ index 392f2f2d67b688d5b37f77c8e4b3036348472d77..fd5b41ceb97dc8aa975f1c0ae05b58d0 // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -1624,6 +1625,12 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - this.bukkitEntity.storeBukkitValues(tag); +@@ -1813,6 +1814,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + this.bukkitEntity.storeBukkitValues(nbt); } // CraftBukkit end + // Paper start - Save the entity's origin location + if (this.origin != null) { -+ tag.setUUID("Paper.OriginWorld", origin.getWorld().getUID()); -+ tag.put("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); ++ nbt.setUUID("Paper.OriginWorld", origin.getWorld().getUID()); ++ nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); + } + // Paper end - return tag; + return nbt; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); -@@ -1746,6 +1753,17 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -1939,6 +1946,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } // CraftBukkit end + // Paper start - Restore the entity's origin location -+ ListTag originTag = tag.getList("Paper.Origin", 6); ++ ListTag originTag = nbt.getList("Paper.Origin", 6); + if (!originTag.isEmpty()) { + org.bukkit.World originWorld = level.getWorld(); -+ if (tag.contains("Paper.OriginWorld")) { -+ originWorld = Bukkit.getWorld(tag.getUUID("Paper.OriginWorld")); ++ if (nbt.contains("Paper.OriginWorld")) { ++ originWorld = Bukkit.getWorld(nbt.getUUID("Paper.OriginWorld")); + } + origin = new org.bukkit.Location(originWorld, originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); + } @@ -75,46 +75,38 @@ index 392f2f2d67b688d5b37f77c8e4b3036348472d77..fd5b41ceb97dc8aa975f1c0ae05b58d0 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded"); -@@ -1807,6 +1825,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - - protected abstract void addAdditionalSaveData(CompoundTag tag); - -+ protected final ListTag createList(double... adouble) { return newDoubleList(adouble); } // Paper - OBFHELPER - protected ListTag newDoubleList(double... values) { - ListTag nbttaglist = new ListTag(); - double[] adouble1 = values; diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 5394bc6336cb84025c1c748fb5b3d38e0648a590..1d87717cc9002ea202ee2ca614aaa8a4c7ea3cb2 100644 +index 11ed0127e2ea268f16c6b4b380d132a71ec9b3dc..eb838fcad0593573f536d5e043cbd3f4bbe25d74 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -291,6 +291,14 @@ public class FallingBlockEntity extends Entity { +@@ -329,6 +329,14 @@ public class FallingBlockEntity extends Entity { this.blockState = Blocks.SAND.defaultBlockState(); } + // Paper start - Try and load origin location from the old NBT tags for backwards compatibility -+ if (tag.contains("SourceLoc_x")) { -+ int srcX = tag.getInt("SourceLoc_x"); -+ int srcY = tag.getInt("SourceLoc_y"); -+ int srcZ = tag.getInt("SourceLoc_z"); ++ if (nbt.contains("SourceLoc_x")) { ++ int srcX = nbt.getInt("SourceLoc_x"); ++ int srcY = nbt.getInt("SourceLoc_y"); ++ int srcZ = nbt.getInt("SourceLoc_z"); + origin = new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ); + } + // Paper end } - public void setHurtsEntities(boolean hurtEntities) { + public Level getLevel() { diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -index 4c4262b8f0cb44b8cea8cb46194a6e70d4ce56f4..661848084fd986321ef782317934dac19ed4dce3 100644 +index 394164f50256ad9a167e15531a9202875abb6cb6..abc62c560816d945642d830a020deb28ff2efa37 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -@@ -119,6 +119,14 @@ public class PrimedTnt extends Entity { +@@ -120,6 +120,14 @@ public class PrimedTnt extends Entity { @Override - protected void readAdditionalSaveData(CompoundTag tag) { - this.setFuse(tag.getShort("Fuse")); + protected void readAdditionalSaveData(CompoundTag nbt) { + this.setFuse(nbt.getShort("Fuse")); + // Paper start - Try and load origin location from the old NBT tags for backwards compatibility -+ if (tag.contains("SourceLoc_x")) { -+ int srcX = tag.getInt("SourceLoc_x"); -+ int srcY = tag.getInt("SourceLoc_y"); -+ int srcZ = tag.getInt("SourceLoc_z"); ++ if (nbt.contains("SourceLoc_x")) { ++ int srcX = nbt.getInt("SourceLoc_x"); ++ int srcY = nbt.getInt("SourceLoc_y"); ++ int srcZ = nbt.getInt("SourceLoc_z"); + origin = new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ); + } + // Paper end @@ -122,11 +114,11 @@ index 4c4262b8f0cb44b8cea8cb46194a6e70d4ce56f4..661848084fd986321ef782317934dac1 @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 53c231925ef1b17e48c5863570e3c54124874621..e7a59a8e0424a0839dfa73fc65f44c5b04bd3dec 100644 +index f4bcf48060bc704e0b6c690f78faaecfe90d8db3..bac39ee51f36ad86d6a4978306b6612d9376adbf 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1062,4 +1062,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - return spigot; +@@ -1096,4 +1096,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + return this.spigot; } // Spigot end + diff --git a/patches/server-remapped/0029-Prevent-tile-entity-and-entity-crashes.patch b/patches/server/0026-Prevent-tile-entity-and-entity-crashes.patch similarity index 60% rename from patches/server-remapped/0029-Prevent-tile-entity-and-entity-crashes.patch rename to patches/server/0026-Prevent-tile-entity-and-entity-crashes.patch index cf3cf1beaa..ca201ec1e4 100644 --- a/patches/server-remapped/0029-Prevent-tile-entity-and-entity-crashes.patch +++ b/patches/server/0026-Prevent-tile-entity-and-entity-crashes.patch @@ -5,29 +5,10 @@ Subject: [PATCH] Prevent tile entity and entity crashes diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 832abf73bdab2488c5814ea6e57888aac1b26154..870843254d1c1fc49bc101a49cdf9d300ae3ca1b 100644 +index d106ab5bbe0647aa2ad285baaabb62b79ced3c06..c427c105c653a0b0de6ad33d1d6f622a31a5a680 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -737,11 +737,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - - gameprofilerfiller.pop(); - } catch (Throwable throwable) { -- CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking block entity"); -- CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block entity being ticked"); -- -- tileentity.fillCrashReportCategory(crashreportsystemdetails); -- throw new ReportedException(crashreport); -+ // Paper start - Prevent tile entity and entity crashes -+ System.err.println("TileEntity threw exception at " + tileentity.level.getWorld().getName() + ":" + tileentity.worldPosition.getX() + "," + tileentity.worldPosition.getY() + "," + tileentity.worldPosition.getZ()); -+ throwable.printStackTrace(); -+ tilesThisCycle--; -+ this.tickableBlockEntities.remove(tileTickPosition--); -+ continue; -+ // Paper end - // Spigot start - } finally { - tileentity.tickTimer.stopTiming(); -@@ -806,11 +808,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -730,11 +730,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { try { tickConsumer.accept(entity); } catch (Throwable throwable) { @@ -39,27 +20,47 @@ index 832abf73bdab2488c5814ea6e57888aac1b26154..870843254d1c1fc49bc101a49cdf9d30 + // Paper start - Prevent tile entity and entity crashes + System.err.println("Entity threw exception at " + entity.level.getWorld().getName() + ":" + entity.getX() + "," + entity.getY() + "," + entity.getZ()); + throwable.printStackTrace(); -+ entity.removed = true; -+ return; ++ entity.discard(); + // Paper end } } diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index d445a1b7b7605eed66923789c5d8e2199c31c5ac..13115d1b28dfa2d87b45a50bd0feaa7f57769122 100644 +index 0e70d9df226e0843a943b3a57d1319ce1bca2543..d6a4a2a59f1be0cc2e373dc326287b60db5559d2 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -208,7 +208,12 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { - return Registry.BLOCK_ENTITY_TYPE.getKey(this.getType()) + " // " + this.getClass().getCanonicalName(); +@@ -196,7 +196,12 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { + return minecraftkey + " // " + this.getClass().getCanonicalName(); }); if (this.level != null) { -- CrashReportCategory.populateBlockDetails(crashreportsystemdetails, this.worldPosition, this.getBlockState()); +- CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, this.getBlockState()); + // Paper start - Prevent TileEntity and Entity crashes + BlockState block = this.getBlockState(); + if (block != null) { -+ CrashReportCategory.populateBlockDetails(crashreportsystemdetails, this.worldPosition, block); ++ CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, block); + } + // Paper end - CrashReportCategory.populateBlockDetails(crashreportsystemdetails, this.worldPosition, this.level.getBlockState(this.worldPosition)); + CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, this.level.getBlockState(this.worldPosition)); } } +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index ee2df7de72c75e4fbf8a681ff254260554969b66..a6e8a8de17acc6c7c0bdeea01544a334797b69b6 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -1241,11 +1241,11 @@ public class LevelChunk implements ChunkAccess { + + gameprofilerfiller.pop(); + } catch (Throwable throwable) { +- CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking block entity"); +- CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block entity being ticked"); +- +- this.blockEntity.fillCrashReportCategory(crashreportsystemdetails); +- throw new ReportedException(crashreport); ++ // Paper start - Prevent tile entity and entity crashes ++ System.err.println("TileEntity threw exception at " + LevelChunk.this.getLevel().getWorld().getName() + ":" + this.getPos().getX() + "," + this.getPos().getY() + "," + this.getPos().getZ()); ++ throwable.printStackTrace(); ++ LevelChunk.this.removeBlockEntity(this.getPos()); ++ // Paper end + // Spigot start + } finally { + this.blockEntity.tickTimer.stopTiming(); diff --git a/patches/server/0027-Configurable-top-of-nether-void-damage.patch b/patches/server/0027-Configurable-top-of-nether-void-damage.patch new file mode 100644 index 0000000000..594a2b6100 --- /dev/null +++ b/patches/server/0027-Configurable-top-of-nether-void-damage.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 23:58:50 -0600 +Subject: [PATCH] Configurable top of nether void damage + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index d16ae924bcbe31c964f7fb448757c748e5c4418c..4bba6977a0287837b8927718c040ac61463f0469 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -134,4 +134,19 @@ public class PaperWorldConfig { + if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf); + if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); + } ++ ++ public int netherVoidTopDamageHeight; ++ public boolean doNetherTopVoidDamage() { return netherVoidTopDamageHeight > 0; } ++ private void netherVoidTopDamageHeight() { ++ netherVoidTopDamageHeight = getInt("nether-ceiling-void-damage-height", 0); ++ log("Top of the nether void damage height: " + netherVoidTopDamageHeight); ++ ++ if (PaperConfig.version < 18) { ++ boolean legacy = getBoolean("nether-ceiling-void-damage", false); ++ if (legacy) { ++ netherVoidTopDamageHeight = 128; ++ set("nether-ceiling-void-damage-height", netherVoidTopDamageHeight); ++ } ++ } ++ } + } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 84c2a14d7336d57d5db66d01c75e31a58860d96c..7e7291cc41735a6c251738492a4cdd1c7798066f 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -602,7 +602,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + } + + public void checkOutOfWorld() { +- if (this.getY() < (double) (this.level.getMinBuildHeight() - 64)) { ++ // Paper start - Configurable nether ceiling damage ++ if (this.getY() < (double) (this.level.getMinBuildHeight() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER ++ && level.paperConfig.doNetherTopVoidDamage() ++ && this.getY() >= this.level.paperConfig.netherVoidTopDamageHeight)) { ++ // Paper end + this.outOfWorld(); + } + diff --git a/patches/server-remapped/0031-Check-online-mode-before-converting-and-renaming-pla.patch b/patches/server/0028-Check-online-mode-before-converting-and-renaming-pla.patch similarity index 75% rename from patches/server-remapped/0031-Check-online-mode-before-converting-and-renaming-pla.patch rename to patches/server/0028-Check-online-mode-before-converting-and-renaming-pla.patch index 56a96d8cfe..cc4f224bfd 100644 --- a/patches/server-remapped/0031-Check-online-mode-before-converting-and-renaming-pla.patch +++ b/patches/server/0028-Check-online-mode-before-converting-and-renaming-pla.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Check online mode before converting and renaming player data diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -index 067c5acd4aad346ac9ccf6d1b5aa6691b0ccd348..60fe01e824e4657d2601797d7858d5de339ab255 100644 +index 4dcdfda78966df2596b44f7e2d3b1d61c45f17af..7b367e273c2a6869f8d8929c24ee45efdf6d4b1e 100644 --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java @@ -56,7 +56,7 @@ public class PlayerDataStorage { - File file = new File(this.playerDir, entityhuman.getStringUUID() + ".dat"); + File file = new File(this.playerDir, player.getStringUUID() + ".dat"); // Spigot Start boolean usingWrongFile = false; - if ( !file.exists() ) + if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first { - file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getScoreboardName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); + file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + player.getScoreboardName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); if ( file.exists() ) diff --git a/patches/server-remapped/0032-Always-tick-falling-blocks.patch b/patches/server/0029-Always-tick-falling-blocks.patch similarity index 73% rename from patches/server-remapped/0032-Always-tick-falling-blocks.patch rename to patches/server/0029-Always-tick-falling-blocks.patch index 29eba4b28a..204256a0af 100644 --- a/patches/server-remapped/0032-Always-tick-falling-blocks.patch +++ b/patches/server/0029-Always-tick-falling-blocks.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Always tick falling blocks diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 9bb35ec64e1538aabec9ff7831706c4717239449..0a9bd85e0308e962df3b24a74bd5aac919744d6d 100644 +index f023f3a0d1671398363f0caa432ffb61fd07c9b2..84ce3d38d5decb4a2f9fae78e0ef5d715860dc7d 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -91,6 +91,7 @@ public class ActivationRange +@@ -89,6 +89,7 @@ public class ActivationRange || entity instanceof AbstractHurtingProjectile || entity instanceof LightningBolt || entity instanceof PrimedTnt -+ || entity instanceof EntityFallingBlock // Paper - Always tick falling blocks ++ || entity instanceof net.minecraft.world.entity.item.FallingBlockEntity // Paper - Always tick falling blocks || entity instanceof EndCrystal || entity instanceof FireworkRocketEntity || entity instanceof ThrownTrident ) diff --git a/patches/server-remapped/0033-Configurable-end-credits.patch b/patches/server/0030-Configurable-end-credits.patch similarity index 63% rename from patches/server-remapped/0033-Configurable-end-credits.patch rename to patches/server/0030-Configurable-end-credits.patch index 201a2e7284..b39189f118 100644 --- a/patches/server-remapped/0033-Configurable-end-credits.patch +++ b/patches/server/0030-Configurable-end-credits.patch @@ -20,23 +20,14 @@ index 4bba6977a0287837b8927718c040ac61463f0469..e6e18f309dc09ea9416ea37dcc697ddc + } } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ca647b3afbe8da5847dc8fa890ae9ca5c18e03d9..f3797bd761c2c6782cce3fca25bc9ef37e5c4978 100644 +index ae04883b57d44fdfb748f1aad0b7a2e24120ebeb..b25f9a2d2d7f0af0fef60c4f1817cf165fed9cd6 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -188,7 +188,7 @@ public class ServerPlayer extends Player implements ContainerListener { - private long lastActionTime = Util.getMillis(); - private Entity camera; - public boolean isChangingDimension; -- private boolean seenCredits; -+ private boolean seenCredits; private void setHasSeenCredits(boolean has) { this.seenCredits = has; } // Paper - OBFHELPER - private final ServerRecipeBook recipeBook = new ServerRecipeBook(); - private Vec3 levitationStartPos; - private int levitationStartTime; -@@ -893,6 +893,7 @@ public class ServerPlayer extends Player implements ContainerListener { +@@ -938,6 +938,7 @@ public class ServerPlayer extends Player { this.unRide(); - this.getLevel().removePlayerImmediately(this); + this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.wonGame) { -+ if (level.paperConfig.disableEndCredits) this.setHasSeenCredits(true); // Paper - Toggle to always disable end credits ++ if (level.paperConfig.disableEndCredits) this.seenCredits = true; // Paper - Toggle to always disable end credits this.wonGame = true; this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, this.seenCredits ? 0.0F : 1.0F)); this.seenCredits = true; diff --git a/patches/server-remapped/0034-Fix-lag-from-explosions-processing-dead-entities.patch b/patches/server/0031-Fix-lag-from-explosions-processing-dead-entities.patch similarity index 89% rename from patches/server-remapped/0034-Fix-lag-from-explosions-processing-dead-entities.patch rename to patches/server/0031-Fix-lag-from-explosions-processing-dead-entities.patch index a9fb2be3bd..aad2c0790d 100644 --- a/patches/server-remapped/0034-Fix-lag-from-explosions-processing-dead-entities.patch +++ b/patches/server/0031-Fix-lag-from-explosions-processing-dead-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix lag from explosions processing dead entities diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 54c3bfead8497f64c183f5612676803d91fc557b..8d6cd2a5b16d99cb8e754ce04b2d12fee7ffb4d0 100644 +index d8cd0bb88a5e4de0f7c7731684f5c9829f853f33..a723b60bdb4b90b30b0b26c9488ede2b1177208f 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java -@@ -180,7 +180,7 @@ public class Explosion { +@@ -208,7 +208,7 @@ public class Explosion { int i1 = Mth.floor(this.y + (double) f2 + 1.0D); int j1 = Mth.floor(this.z - (double) f2 - 1.0D); int k1 = Mth.floor(this.z + (double) f2 + 1.0D); diff --git a/patches/server-remapped/0035-Optimize-explosions.patch b/patches/server/0032-Optimize-explosions.patch similarity index 91% rename from patches/server-remapped/0035-Optimize-explosions.patch rename to patches/server/0032-Optimize-explosions.patch index ec1e34fc38..d6ac9e859f 100644 --- a/patches/server-remapped/0035-Optimize-explosions.patch +++ b/patches/server/0032-Optimize-explosions.patch @@ -25,10 +25,10 @@ index e6e18f309dc09ea9416ea37dcc697ddc2b571a96..4881b03d470646843bad1bc343eb6a6a + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 526d6c0fa45bfba92a3f964f72e4965fd5c841c1..901d5497667706c049718dc4fca37a1bc489c465 100644 +index 400aac6a37c63f34bf0038780e2137d82bc3416d..c6a59fa4b30d54baa638c931f045b2d546da021a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1324,6 +1324,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop