From cf306c3a893f79b9be662dc312b53fe6322e1022 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 11 Jun 2021 15:37:16 -0700 Subject: [PATCH] more patches --- .../Add-getTPS-method.patch | 0 patches/api/Adventure.patch | 16 + .../Entity-Origin-API.patch | 0 .../Player-affects-spawning-API.patch | 0 .../Version-Command-2.0.patch | 0 .../Optimize-TileEntity-Ticking.patch | 279 ------------------ ...-despawn-distances-for-living-entiti.patch | 4 +- ...d-version-history-to-version-command.patch | 0 patches/server/Adventure.patch | 30 +- .../Allow-for-toggling-of-spawn-chunks.patch | 0 ...d-mobs-to-jump-and-take-water-damage.patch | 17 +- .../Always-tick-falling-blocks.patch | 2 +- ...e-before-converting-and-renaming-pla.patch | 4 +- ...figurable-baby-zombie-movement-speed.patch | 0 ...actus-bamboo-and-reed-growth-heights.patch | 2 +- .../Configurable-end-credits.patch | 15 +- .../Configurable-fishing-time-ranges.patch | 4 +- ...nfigurable-top-of-nether-void-damage.patch | 62 +--- ...ck-and-tnt-entities-at-the-specified.patch | 18 +- .../Entity-Origin-API.patch | 60 ++-- ...-explosions-processing-dead-entities.patch | 0 .../Further-improve-server-tick-loop.patch | 33 ++- .../Implement-Paper-VersionChecker.patch | 0 .../Only-refresh-abilities-if-needed.patch | 10 +- .../Optimize-explosions.patch | 2 +- .../Player-affects-spawning-API.patch | 41 ++- ...event-tile-entity-and-entity-crashes.patch | 51 ++-- ...ve-invalid-mob-spawner-tile-entities.patch | 13 +- ...ient-crashes-server-lists-and-Mojang.patch | 20 +- patches/server/Timings-v2.patch | 4 +- 30 files changed, 178 insertions(+), 509 deletions(-) rename patches/{api-unmapped => api}/Add-getTPS-method.patch (100%) rename patches/{api-unmapped => api}/Entity-Origin-API.patch (100%) rename patches/{api-unmapped => api}/Player-affects-spawning-API.patch (100%) rename patches/{api-unmapped => api}/Version-Command-2.0.patch (100%) delete mode 100644 patches/server-remapped/Optimize-TileEntity-Ticking.patch rename patches/{server-remapped => server}/Add-configurable-despawn-distances-for-living-entiti.patch (97%) rename patches/{server-remapped => server}/Add-version-history-to-version-command.patch (100%) rename patches/{server-remapped => server}/Allow-for-toggling-of-spawn-chunks.patch (100%) rename patches/{server-remapped => server}/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch (90%) rename patches/{server-remapped => server}/Always-tick-falling-blocks.patch (87%) rename patches/{server-remapped => server}/Check-online-mode-before-converting-and-renaming-pla.patch (83%) rename patches/{server-remapped => server}/Configurable-baby-zombie-movement-speed.patch (100%) rename patches/{server-remapped => server}/Configurable-cactus-bamboo-and-reed-growth-heights.patch (98%) rename patches/{server-remapped => server}/Configurable-end-credits.patch (68%) rename patches/{server-remapped => server}/Configurable-fishing-time-ranges.patch (92%) rename patches/{server-remapped => server}/Configurable-top-of-nether-void-damage.patch (50%) rename patches/{server-remapped => server}/Drop-falling-block-and-tnt-entities-at-the-specified.patch (83%) rename patches/{server-remapped => server}/Entity-Origin-API.patch (76%) rename patches/{server-remapped => server}/Fix-lag-from-explosions-processing-dead-entities.patch (100%) rename patches/{server-remapped => server}/Further-improve-server-tick-loop.patch (88%) rename patches/{server-remapped => server}/Implement-Paper-VersionChecker.patch (100%) rename patches/{server-remapped => server}/Only-refresh-abilities-if-needed.patch (69%) rename patches/{server-remapped => server}/Optimize-explosions.patch (98%) rename patches/{server-remapped => server}/Player-affects-spawning-API.patch (86%) rename patches/{server-remapped => server}/Prevent-tile-entity-and-entity-crashes.patch (68%) rename patches/{server-remapped => server}/Remove-invalid-mob-spawner-tile-entities.patch (73%) rename patches/{server-remapped => server}/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch (92%) diff --git a/patches/api-unmapped/Add-getTPS-method.patch b/patches/api/Add-getTPS-method.patch similarity index 100% rename from patches/api-unmapped/Add-getTPS-method.patch rename to patches/api/Add-getTPS-method.patch diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 0686342eed..82ea453668 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/pom.xml diff --git a/patches/api-unmapped/Entity-Origin-API.patch b/patches/api/Entity-Origin-API.patch similarity index 100% rename from patches/api-unmapped/Entity-Origin-API.patch rename to patches/api/Entity-Origin-API.patch diff --git a/patches/api-unmapped/Player-affects-spawning-API.patch b/patches/api/Player-affects-spawning-API.patch similarity index 100% rename from patches/api-unmapped/Player-affects-spawning-API.patch rename to patches/api/Player-affects-spawning-API.patch diff --git a/patches/api-unmapped/Version-Command-2.0.patch b/patches/api/Version-Command-2.0.patch similarity index 100% rename from patches/api-unmapped/Version-Command-2.0.patch rename to patches/api/Version-Command-2.0.patch diff --git a/patches/server-remapped/Optimize-TileEntity-Ticking.patch b/patches/server-remapped/Optimize-TileEntity-Ticking.patch deleted file mode 100644 index cba324fca0..0000000000 --- a/patches/server-remapped/Optimize-TileEntity-Ticking.patch +++ /dev/null @@ -1,279 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 8 Mar 2015 22:55:25 -0600 -Subject: [PATCH] Optimize TileEntity Ticking - - -diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/co/aikar/timings/TimingsExport.java -+++ b/src/main/java/co/aikar/timings/TimingsExport.java -@@ -0,0 +0,0 @@ public class TimingsExport extends Thread { - pair("end", System.currentTimeMillis() / 1000), - pair("online-mode", Bukkit.getServer().getOnlineMode()), - pair("sampletime", (System.currentTimeMillis() - TimingsManager.timingStart) / 1000), -- pair("datapacks", toArrayMapper(MinecraftServer.getServer().getPackRepository().getSelectedIds(), pack -> { -+ pair("datapacks", toArrayMapper(MinecraftServer.getServer().getPackRepository().getSelectedPacks(), pack -> { - // Don't feel like obf helper'ing these, non fatal if its temp missed. - return ChatColor.stripColor(CraftChatMessage.fromComponent(pack.a(true))); - })) -@@ -0,0 +0,0 @@ public class TimingsExport extends Thread { - ); - - parent.put("worlds", toObjectMapper(MinecraftServer.getServer().getAllLevels(), world -> { -- if (world.getWorldData().getName().equals("worldeditregentempworld")) return null; -- return pair(world.getWorldData().getName(), 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/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java -@@ -0,0 +0,0 @@ import net.minecraft.world.phys.shapes.VoxelShape; - public class ChestBlock extends AbstractChestBlock implements SimpleWaterloggedBlock { - - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; -- public static final EnumProperty TYPE = BlockStateProperties.CHEST_TYPE; -- public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; -+ public static final EnumProperty TYPE = BlockStateProperties.CHEST_TYPE; public static final EnumProperty CHEST_TYPE_PROPERTY = TYPE; // Paper - OBFHELPER -+ public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public static final BooleanProperty waterlogged() { return WATERLOGGED; } // Paper OBFHELPER - protected static final VoxelShape NORTH_AABB = Block.box(1.0D, 0.0D, 0.0D, 15.0D, 14.0D, 15.0D); - protected static final VoxelShape SOUTH_AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 16.0D); - protected static final VoxelShape WEST_AABB = Block.box(0.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D); -diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java -@@ -0,0 +0,0 @@ import net.minecraft.core.NonNullList; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.network.chat.Component; - import net.minecraft.network.chat.TranslatableComponent; -+import net.minecraft.server.MCUtil; - import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; -@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; - import org.bukkit.entity.HumanEntity; - // CraftBukkit end - --public class ChestBlockEntity extends RandomizableContainerBlockEntity implements TickableBlockEntity { -+public class ChestBlockEntity extends RandomizableContainerBlockEntity { // Paper - Remove ITickable - - private NonNullList items; - protected float openness; -@@ -0,0 +0,0 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement - return tag; - } - -- @Override - public void tick() { - int i = this.worldPosition.getX(); - int j = this.worldPosition.getY(); - int k = this.worldPosition.getZ(); - - ++this.tickInterval; -- this.openCount = getOpenCount(this.level, this, this.tickInterval, i, j, k, this.openCount); -+ } -+ -+ public void doOpenLogic() { -+ int i = this.worldPosition.getX(); -+ int j = this.worldPosition.getY(); -+ int k = this.worldPosition.getZ(); -+ -+ //this.viewingCount = a(this.world, this, this.j, i, j, k, this.viewingCount); // Paper - check is faulty given our logic is called before active container set - this.oOpenness = this.openness; - float f = 0.1F; - -@@ -0,0 +0,0 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement - if (this.openCount > 0 && this.openness == 0.0F) { - this.playSound(SoundEvents.CHEST_OPEN); - } -+ } - -- if (this.openCount == 0 && this.openness > 0.0F || this.openCount > 0 && this.openness < 1.0F) { -- float f1 = this.openness; -+ public void doCloseLogic() { -+ if (this.openCount == 0 /* && this.a > 0.0F || this.viewingCount > 0 && this.a < 1.0F */) { // Paper - disable all but player count check -+ /* // Paper - disable animation stuff -+ float f1 = this.a; - -- if (this.openCount > 0) { -- this.openness += 0.1F; -+ if (this.viewingCount > 0) { -+ this.a += 0.1F; - } else { -- this.openness -= 0.1F; -+ this.a -= 0.1F; - } - -- if (this.openness > 1.0F) { -- this.openness = 1.0F; -+ if (this.a > 1.0F) { -+ this.a = 1.0F; - } - - float f2 = 0.5F; - -- if (this.openness < 0.5F && f1 >= 0.5F) { -+ if (this.a < 0.5F && f1 >= 0.5F) { -+ */ -+ MCUtil.scheduleTask(10, () -> { - this.playSound(SoundEvents.CHEST_CLOSE); -- } -+ }, "Chest Sounds"); -+ //} // Paper end - - if (this.openness < 0.0F) { - this.openness = 0.0F; -@@ -0,0 +0,0 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement - } - - public void playSound(SoundEvent soundeffect) { -+ if (!this.getBlockState().contains(ChestBlock.CHEST_TYPE_PROPERTY)) { return; } // Paper - this can be delayed, double check exists - Fixes GH-2074 - ChestType blockpropertychesttype = (ChestType) this.getBlockState().getValue(ChestBlock.TYPE); - - if (blockpropertychesttype != ChestType.LEFT) { -@@ -0,0 +0,0 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement - - ++this.openCount; - if (this.level == null) return; // CraftBukkit -+ doOpenLogic(); // Paper - - // CraftBukkit start - Call redstone event - if (this.getBlockState().getBlock() == Blocks.TRAPPED_CHEST) { -@@ -0,0 +0,0 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement - --this.openCount; - - // CraftBukkit start - Call redstone event -+ doCloseLogic(); // Paper - if (this.getBlockState().getBlock() == Blocks.TRAPPED_CHEST) { - int newPower = Math.max(0, Math.min(15, this.openCount)); - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnderChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnderChestBlockEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/EnderChestBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/EnderChestBlockEntity.java -@@ -0,0 +0,0 @@ - package net.minecraft.world.level.block.entity; - -+import net.minecraft.server.MCUtil; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.world.entity.player.Player; - import net.minecraft.world.level.block.Blocks; - --public class EnderChestBlockEntity extends BlockEntity implements TickableBlockEntity { -+public class EnderChestBlockEntity extends BlockEntity { // Paper - Remove ITickable - - public float openness; - public float oOpenness; -@@ -0,0 +0,0 @@ public class EnderChestBlockEntity extends BlockEntity implements TickableBlockE - super(BlockEntityType.ENDER_CHEST); - } - -- @Override - public void tick() { - if (++this.tickInterval % 20 * 4 == 0) { - this.level.blockEvent(this.worldPosition, Blocks.ENDER_CHEST, 1, this.openCount); - } - - this.oOpenness = this.openness; -+ /* // Paper -+ int i = this.position.getX(); -+ int j = this.position.getY(); -+ int k = this.position.getZ(); -+ float f = 0.1F; -+ double d0; -+ // Paper start -+ */ -+ } -+ -+ private void doOpenLogic() { - int i = this.worldPosition.getX(); - int j = this.worldPosition.getY(); - int k = this.worldPosition.getZ(); -- float f = 0.1F; - double d0; -+ // Paper end - - if (this.openCount > 0 && this.openness == 0.0F) { - double d1 = (double) i + 0.5D; -@@ -0,0 +0,0 @@ public class EnderChestBlockEntity extends BlockEntity implements TickableBlockE - d0 = (double) k + 0.5D; - this.level.playSound((Player) null, d1, (double) j + 0.5D, d0, SoundEvents.ENDER_CHEST_OPEN, SoundSource.BLOCKS, 0.5F, this.level.random.nextFloat() * 0.1F + 0.9F); - } -+ // Paper start -+ } - -- if (this.openCount == 0 && this.openness > 0.0F || this.openCount > 0 && this.openness < 1.0F) { -- float f1 = this.openness; -+ private void doCloseLogic() { -+ int i = this.worldPosition.getX(); -+ int j = this.worldPosition.getY(); -+ int k = this.worldPosition.getZ(); -+ double d0; -+ -+ if (this.openCount == 0) { /* && this.a > 0.0F || this.c > 0 && this.a < 1.0F) { -+ // Paper end -+ float f1 = this.a; - -- if (this.openCount > 0) { -- this.openness += 0.1F; -+ if (this.c > 0) { -+ this.a += 0.1F; - } else { -- this.openness -= 0.1F; -+ this.a -= 0.1F; - } - -- if (this.openness > 1.0F) { -- this.openness = 1.0F; -+ if (this.a > 1.0F) { -+ this.a = 1.0F; - } - - float f2 = 0.5F; - -- if (this.openness < 0.5F && f1 >= 0.5F) { -+ if (this.a < 0.5F && f1 >= 0.5F) { -+ // Paper start -+ */ - d0 = (double) i + 0.5D; - double d2 = (double) k + 0.5D; - -+ MCUtil.scheduleTask(10, () -> { - this.level.playSound((Player) null, d0, (double) j + 0.5D, d2, SoundEvents.ENDER_CHEST_CLOSE, SoundSource.BLOCKS, 0.5F, this.level.random.nextFloat() * 0.1F + 0.9F); -- } -+ }, "Chest Sounds"); - - if (this.openness < 0.0F) { - this.openness = 0.0F; -@@ -0,0 +0,0 @@ public class EnderChestBlockEntity extends BlockEntity implements TickableBlockE - public void startOpen() { - ++this.openCount; - this.level.blockEvent(this.worldPosition, Blocks.ENDER_CHEST, 1, this.openCount); -+ doOpenLogic(); // Paper - } - - public void stopOpen() { - --this.openCount; - this.level.blockEvent(this.worldPosition, Blocks.ENDER_CHEST, 1, this.openCount); -+ doCloseLogic(); // Paper - } - - public boolean stillValid(Player entityhuman) { -diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -+++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -@@ -0,0 +0,0 @@ public abstract class StateHolder { - return Collections.unmodifiableCollection(this.values.keySet()); - } - -+ public > boolean contains(Property iblockstate) { return this.hasProperty(iblockstate); } // Paper - OBFHELPER - public > boolean hasProperty(Property property) { - return this.values.containsKey(property); - } diff --git a/patches/server-remapped/Add-configurable-despawn-distances-for-living-entiti.patch b/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch similarity index 97% rename from patches/server-remapped/Add-configurable-despawn-distances-for-living-entiti.patch rename to patches/server/Add-configurable-despawn-distances-for-living-entiti.patch index 6de2dfc054..6548ecac98 100644 --- a/patches/server-remapped/Add-configurable-despawn-distances-for-living-entiti.patch +++ b/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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/Add-version-history-to-version-command.patch b/patches/server/Add-version-history-to-version-command.patch similarity index 100% rename from patches/server-remapped/Add-version-history-to-version-command.patch rename to patches/server/Add-version-history-to-version-command.patch diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 9a9873e827..79ab74caed 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -37,12 +37,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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) { @@ -829,41 +835,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +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 @@ -2433,7 +2442,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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(); @@ -2562,7 +2571,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // 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; diff --git a/patches/server-remapped/Allow-for-toggling-of-spawn-chunks.patch b/patches/server/Allow-for-toggling-of-spawn-chunks.patch similarity index 100% rename from patches/server-remapped/Allow-for-toggling-of-spawn-chunks.patch rename to patches/server/Allow-for-toggling-of-spawn-chunks.patch diff --git a/patches/server-remapped/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch similarity index 90% rename from patches/server-remapped/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch rename to patches/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index 8168926e2f..08ac598f9b 100644 --- a/patches/server-remapped/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/patches/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return this.isInWater() || this.isInRain(); } @@ -34,18 +34,11 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -0,0 +0,0 @@ - package net.minecraft.world.entity; - -+import PathfinderGoalFloat; - import com.google.common.collect.Maps; - import java.util.Arrays; - import java.util.Iterator; @@ -0,0 +0,0 @@ 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; @@ -59,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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; @@ -72,7 +65,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/ai/control/JumpControl.jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ public class JumpControl { +@@ -0,0 +0,0 @@ public class JumpControl implements Control { this.jump = true; } @@ -96,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/Always-tick-falling-blocks.patch b/patches/server/Always-tick-falling-blocks.patch similarity index 87% rename from patches/server-remapped/Always-tick-falling-blocks.patch rename to patches/server/Always-tick-falling-blocks.patch index 0529597ac3..f34fbb3d88 100644 --- a/patches/server-remapped/Always-tick-falling-blocks.patch +++ b/patches/server/Always-tick-falling-blocks.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 || 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/Check-online-mode-before-converting-and-renaming-pla.patch b/patches/server/Check-online-mode-before-converting-and-renaming-pla.patch similarity index 83% rename from patches/server-remapped/Check-online-mode-before-converting-and-renaming-pla.patch rename to patches/server/Check-online-mode-before-converting-and-renaming-pla.patch index cf424400eb..1e04614ee5 100644 --- a/patches/server-remapped/Check-online-mode-before-converting-and-renaming-pla.patch +++ b/patches/server/Check-online-mode-before-converting-and-renaming-pla.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java @@ -0,0 +0,0 @@ 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/Configurable-baby-zombie-movement-speed.patch b/patches/server/Configurable-baby-zombie-movement-speed.patch similarity index 100% rename from patches/server-remapped/Configurable-baby-zombie-movement-speed.patch rename to patches/server/Configurable-baby-zombie-movement-speed.patch diff --git a/patches/server-remapped/Configurable-cactus-bamboo-and-reed-growth-heights.patch b/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch similarity index 98% rename from patches/server-remapped/Configurable-cactus-bamboo-and-reed-growth-heights.patch rename to patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch index 78e1c15253..846a0408e7 100644 --- a/patches/server-remapped/Configurable-cactus-bamboo-and-reed-growth-heights.patch +++ b/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/BambooBlock.java @@ -0,0 +0,0 @@ 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 diff --git a/patches/server-remapped/Configurable-end-credits.patch b/patches/server/Configurable-end-credits.patch similarity index 68% rename from patches/server-remapped/Configurable-end-credits.patch rename to patches/server/Configurable-end-credits.patch index 4dba02270d..5e1a6bda53 100644 --- a/patches/server-remapped/Configurable-end-credits.patch +++ b/patches/server/Configurable-end-credits.patch @@ -23,20 +23,11 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener { +@@ -0,0 +0,0 @@ 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/Configurable-fishing-time-ranges.patch b/patches/server/Configurable-fishing-time-ranges.patch similarity index 92% rename from patches/server-remapped/Configurable-fishing-time-ranges.patch rename to patches/server/Configurable-fishing-time-ranges.patch index bbbdf2b425..bbf1a9c7ed 100644 --- a/patches/server-remapped/Configurable-fishing-time-ranges.patch +++ b/patches/server/Configurable-fishing-time-ranges.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java @@ -0,0 +0,0 @@ public class FishingHook extends Projectile { - owner.fishing = this; + this.noCulling = true; this.luck = Math.max(0, lureLevel); this.lureSpeed = Math.max(0, luckOfTheSeaLevel); + // Paper start @@ -35,4 +35,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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/Configurable-top-of-nether-void-damage.patch b/patches/server/Configurable-top-of-nether-void-damage.patch similarity index 50% rename from patches/server-remapped/Configurable-top-of-nether-void-damage.patch rename to patches/server/Configurable-top-of-nether-void-damage.patch index 07159579c2..dc61a73a04 100644 --- a/patches/server-remapped/Configurable-top-of-nether-void-damage.patch +++ b/patches/server/Configurable-top-of-nether-void-damage.patch @@ -32,62 +32,16 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - this.setRemainingFireTicks(0); +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } -+ // Paper start -+ protected void performVoidDamage() { -+ if (this.getY() < -64.0D || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER + 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() >= 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -@@ -0,0 +0,0 @@ public abstract class AbstractMinecart extends Entity { - this.setDamage(this.getDamage() - 1.0F); ++ && this.getY() >= this.level.paperConfig.netherVoidTopDamageHeight)) { ++ // Paper end + this.outOfWorld(); } -- 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-remapped/Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch similarity index 83% rename from patches/server-remapped/Drop-falling-block-and-tnt-entities-at-the-specified.patch rename to patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch index 0e9a420288..927d2f5c6c 100644 --- a/patches/server-remapped/Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -24,18 +24,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -51,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.spawnAtLocation(block); + } + -+ this.remove(); ++ this.discard(); + return; + } + // Paper end @@ -68,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 @@ -85,7 +73,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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/Entity-Origin-API.patch b/patches/server/Entity-Origin-API.patch similarity index 76% rename from patches/server-remapped/Entity-Origin-API.patch rename to patches/server/Entity-Origin-API.patch index 38b54bf387..fa708c4b72 100644 --- a/patches/server-remapped/Entity-Origin-API.patch +++ b/patches/server/Entity-Origin-API.patch @@ -9,21 +9,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/nbt/ListTag.java +++ b/src/main/java/net/minecraft/nbt/ListTag.java @@ -0,0 +0,0 @@ public class ListTag extends CollectionTag { - return new int[0]; + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - this.navigations.add(((Mob) entity).getNavigation()); + 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(); @@ -36,7 +36,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - this.bukkitEntity.storeBukkitValues(tag); +@@ -0,0 +0,0 @@ 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"); -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ 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,14 +75,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded"); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -92,29 +84,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java @@ -0,0 +0,0 @@ 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 @@ -126,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - return spigot; + return this.spigot; } // Spigot end + diff --git a/patches/server-remapped/Fix-lag-from-explosions-processing-dead-entities.patch b/patches/server/Fix-lag-from-explosions-processing-dead-entities.patch similarity index 100% rename from patches/server-remapped/Fix-lag-from-explosions-processing-dead-entities.patch rename to patches/server/Fix-lag-from-explosions-processing-dead-entities.patch diff --git a/patches/server-remapped/Further-improve-server-tick-loop.patch b/patches/server/Further-improve-server-tick-loop.patch similarity index 88% rename from patches/server-remapped/Further-improve-server-tick-loop.patch rename to patches/server/Further-improve-server-tick-loop.patch index 8e5e131204..587a39567c 100644 --- a/patches/server-remapped/Further-improve-server-tick-loop.patch +++ b/patches/server/Further-improve-server-tick-loop.patch @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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 +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) { diff --git a/patches/server-remapped/Implement-Paper-VersionChecker.patch b/patches/server/Implement-Paper-VersionChecker.patch similarity index 100% rename from patches/server-remapped/Implement-Paper-VersionChecker.patch rename to patches/server/Implement-Paper-VersionChecker.patch diff --git a/patches/server-remapped/Only-refresh-abilities-if-needed.patch b/patches/server/Only-refresh-abilities-if-needed.patch similarity index 69% rename from patches/server-remapped/Only-refresh-abilities-if-needed.patch rename to patches/server/Only-refresh-abilities-if-needed.patch index cfb2bd5bda..e991d4f899 100644 --- a/patches/server-remapped/Only-refresh-abilities-if-needed.patch +++ b/patches/server/Only-refresh-abilities-if-needed.patch @@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @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/Optimize-explosions.patch b/patches/server/Optimize-explosions.patch similarity index 98% rename from patches/server-remapped/Optimize-explosions.patch rename to patches/server/Optimize-explosions.patch index 64223324d5..395ba7eb16 100644 --- a/patches/server-remapped/Optimize-explosions.patch +++ b/patches/server/Optimize-explosions.patch @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 d8 /= d11; d9 /= d11; d10 /= d11; -- double d12 = (double) getSeenPercent(vec3d, entity); +- double d12 = (double) Explosion.getSeenPercent(vec3d, entity); + double d12 = this.getBlockDensity(vec3d, entity); // Paper - Optimize explosions double d13 = (1.0D - d7) * d12; diff --git a/patches/server-remapped/Player-affects-spawning-API.patch b/patches/server/Player-affects-spawning-API.patch similarity index 86% rename from patches/server-remapped/Player-affects-spawning-API.patch rename to patches/server/Player-affects-spawning-API.patch index 505c9d7f37..d54b66956f 100644 --- a/patches/server-remapped/Player-affects-spawning-API.patch +++ b/patches/server/Player-affects-spawning-API.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return Mth.sqrt(f * f + f1 * f1 + f2 * f2); } @@ -21,25 +21,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java +++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java @@ -0,0 +0,0 @@ public final class EntitySelector { - return !entity.isSpectator(); }; + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -0,0 +0,0 @@ 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 @@ -78,14 +77,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -0,0 +0,0 @@ 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 } - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java @@ -99,16 +98,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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(); + double d = -1.0D; + Player player = null; + @@ -0,0 +0,0 @@ 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,8 +127,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -137,7 +136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { - return getHandle().locale; + return this.getHandle().locale; + + } + @@ -154,4 +153,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override public void updateCommands() { - if (getHandle().connection == null) return; + if (this.getHandle().connection == null) return; diff --git a/patches/server-remapped/Prevent-tile-entity-and-entity-crashes.patch b/patches/server/Prevent-tile-entity-and-entity-crashes.patch similarity index 68% rename from patches/server-remapped/Prevent-tile-entity-and-entity-crashes.patch rename to patches/server/Prevent-tile-entity-and-entity-crashes.patch index 4814785999..4529083987 100644 --- a/patches/server-remapped/Prevent-tile-entity-and-entity-crashes.patch +++ b/patches/server/Prevent-tile-entity-and-entity-crashes.patch @@ -8,25 +8,6 @@ diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -0,0 +0,0 @@ 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(); @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { try { tickConsumer.accept(entity); @@ -39,8 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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 } } @@ -50,16 +30,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -0,0 +0,0 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { - return Registry.BLOCK_ENTITY_TYPE.getKey(this.getType()) + " // " + this.getClass().getCanonicalName(); + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -0,0 +0,0 @@ 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-remapped/Remove-invalid-mob-spawner-tile-entities.patch b/patches/server/Remove-invalid-mob-spawner-tile-entities.patch similarity index 73% rename from patches/server-remapped/Remove-invalid-mob-spawner-tile-entities.patch rename to patches/server/Remove-invalid-mob-spawner-tile-entities.patch index a7415308fe..e41771c39b 100644 --- a/patches/server-remapped/Remove-invalid-mob-spawner-tile-entities.patch +++ b/patches/server/Remove-invalid-mob-spawner-tile-entities.patch @@ -14,18 +14,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; + import net.minecraft.world.level.gameevent.EuclideanGameEventDispatcher; + import net.minecraft.world.level.gameevent.GameEventDispatcher; @@ -0,0 +0,0 @@ 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/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch similarity index 92% rename from patches/server-remapped/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch rename to patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 48b1140b22..c78c5133d1 100644 --- a/patches/server-remapped/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -10,27 +10,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Eula.java +++ b/src/main/java/net/minecraft/server/Eula.java @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { - deadline.add(Calendar.DAY_OF_YEAR, -28); + 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 ***"); @@ -112,6 +112,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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/Timings-v2.patch b/patches/server/Timings-v2.patch index 3eafb07096..f527e1c8a8 100644 --- a/patches/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -316,8 +316,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ); + + 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)); + })),