diff options
Diffstat (limited to 'patches/removed/1.17/No longer needed')
37 files changed, 0 insertions, 2219 deletions
diff --git a/patches/removed/1.17/No longer needed/0025-Optimize-TileEntity-Ticking.patch b/patches/removed/1.17/No longer needed/0025-Optimize-TileEntity-Ticking.patch deleted file mode 100644 index 79f438b892..0000000000 --- a/patches/removed/1.17/No longer needed/0025-Optimize-TileEntity-Ticking.patch +++ /dev/null @@ -1,281 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -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 ---- a/src/main/java/co/aikar/timings/TimingsExport.java -+++ b/src/main/java/co/aikar/timings/TimingsExport.java -@@ -112,7 +112,7 @@ 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))); - })) -@@ -151,8 +151,8 @@ 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 56656bf34db07bc717ace8ae9c1b60f9bfd7ff05..1bda9a158eb4372b9ab7cf3097732e64810aefc6 100644 ---- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java -@@ -54,8 +54,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; - public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements SimpleWaterloggedBlock { - - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; -- public static final EnumProperty<ChestType> TYPE = BlockStateProperties.CHEST_TYPE; -- public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; -+ public static final EnumProperty<ChestType> TYPE = BlockStateProperties.CHEST_TYPE; public static final EnumProperty<ChestType> 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 7b08ee35d2d8dc3fe783d773bf6686a5197006b8..17289d28b6d0023279a573715ee3d182988dd651 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 -@@ -8,6 +8,7 @@ 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; -@@ -32,7 +33,7 @@ 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<ItemStack> items; - protected float openness; -@@ -110,14 +111,20 @@ 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; - -@@ -131,25 +138,31 @@ 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; -@@ -188,6 +201,7 @@ 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) { -@@ -226,6 +240,7 @@ 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) { -@@ -248,6 +263,7 @@ 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 b26337770e13c20f57a4e74282710ce697ac0d41..8f0477d9620ef71e10855bbca07f9b6984d5d794 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 -@@ -1,11 +1,12 @@ - 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; -@@ -16,18 +17,28 @@ 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; -@@ -35,28 +46,40 @@ 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; -@@ -84,11 +107,13 @@ 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 60ce75c7f94c995d3753c40bc8d1ec09b4d37b1a..ac10fb9cd4701f0f6477a86bec73cb5ac6496725 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 -@@ -84,6 +84,7 @@ public abstract class StateHolder<O, S> { - return Collections.unmodifiableCollection(this.values.keySet()); - } - -+ public <T extends Comparable<T>> boolean contains(Property<T> iblockstate) { return this.hasProperty(iblockstate); } // Paper - OBFHELPER - public <T extends Comparable<T>> boolean hasProperty(Property<T> property) { - return this.values.containsKey(property); - } diff --git a/patches/removed/1.17/No longer needed/0040-Send-absolute-position-the-first-time-an-entity-is-s.patch b/patches/removed/1.17/No longer needed/0040-Send-absolute-position-the-first-time-an-entity-is-s.patch deleted file mode 100644 index d8dbfa7a24..0000000000 --- a/patches/removed/1.17/No longer needed/0040-Send-absolute-position-the-first-time-an-entity-is-s.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jedediah Smith <[email protected]> -Date: Wed, 2 Mar 2016 23:13:07 -0600 -Subject: [PATCH] Send absolute position the first time an entity is seen - -Not needed anymore, packet spawn sends full position - - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 59a5f82c9f57d760ba4959a040ce8cbf0f49e4aa..d1bc927c8b429f43de2cdad98f8b329ff4c8b4db 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1301,10 +1301,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - private final Entity entity; - private final int range; - private SectionPos lastSectionPos; -- public final Set<ServerPlayer> seenBy = Sets.newHashSet(); -+ // Paper start -+ // Replace trackedPlayers Set with a Map. The value is true until the player receives -+ // their first update (which is forced to have absolute coordinates), false afterward. -+ public java.util.Map<ServerPlayer, Boolean> trackedPlayerMap = new java.util.HashMap<>(); -+ public Set<ServerPlayer> seenBy = trackedPlayerMap.keySet(); - - public TrackedEntity(Entity entity, int i, int j, boolean flag) { -- this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, seenBy); // CraftBukkit -+ this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, trackedPlayerMap); // CraftBukkit // Paper - this.entity = entity; - this.range = i; - this.lastSectionPos = SectionPos.of(entity); -@@ -1386,7 +1390,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - player.entitiesToRemove.remove(Integer.valueOf(this.entity.getId())); - // CraftBukkit end - -- if (flag1 && this.seenBy.add(player)) { -+ if (flag1 && this.trackedPlayerMap.putIfAbsent(player, true) == null) { // Paper - this.serverEntity.addPairing(player); - } - } else if (this.seenBy.remove(player)) { -diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 3d386627b6d3d33da76372e4a14d0c5000eb8ffc..fa6893055fa5617742bfb4b7eff60c8139395cb6 100644 ---- a/src/main/java/net/minecraft/server/level/ServerEntity.java -+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -4,6 +4,7 @@ import com.google.common.collect.Lists; - import com.mojang.datafixers.util.Pair; - import java.util.Collection; - import java.util.Collections; -+import java.util.HashSet; - import java.util.Iterator; - import java.util.List; - import java.util.Set; -@@ -51,7 +52,7 @@ public class ServerEntity { - private final Entity entity; - private final int updateInterval; - private final boolean trackDelta; -- private final Consumer<Packet<?>> broadcast; -+ private final Consumer<Packet<?>> broadcast; private Consumer<Packet<?>> getPacketConsumer() { return broadcast; } // Paper - OBFHELPER - private long xp; - private long yp; - private long zp; -@@ -66,8 +67,23 @@ public class ServerEntity { - private boolean wasOnGround; - // CraftBukkit start - private final Set<ServerPlayer> trackedPlayers; -+ // Paper start -+ private java.util.Map<ServerPlayer, Boolean> trackedPlayerMap = null; -+ -+ /** -+ * Requested in https://github.com/PaperMC/Paper/issues/1537 to allow intercepting packets -+ */ -+ public void sendPlayerPacket(ServerPlayer player, Packet packet) { -+ player.connection.send(packet); -+ } -+ -+ public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, java.util.Map<ServerPlayer, Boolean> trackedPlayers) { -+ this(worldserver, entity, i, flag, consumer, trackedPlayers.keySet()); -+ trackedPlayerMap = trackedPlayers; -+ } - - public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayer> trackedPlayers) { -+ // Paper end - this.trackedPlayers = trackedPlayers; - // CraftBukkit end - this.ap = Vec3.ZERO; -@@ -188,7 +204,25 @@ public class ServerEntity { - } - - if (packet1 != null) { -- this.broadcast.accept(packet1); -+ // paper start -+ if (trackedPlayerMap == null || packet1 instanceof ClientboundTeleportEntityPacket) { -+ this.broadcast.accept((packet1)); -+ } else { -+ ClientboundTeleportEntityPacket teleportPacket = null; -+ -+ for (java.util.Map.Entry<ServerPlayer, Boolean> viewer : trackedPlayerMap.entrySet()) { -+ if (viewer.getValue()) { -+ viewer.setValue(false); -+ if (teleportPacket == null) { -+ teleportPacket = new ClientboundTeleportEntityPacket(this.entity); -+ } -+ sendPlayerPacket(viewer.getKey(), teleportPacket); -+ } else { -+ sendPlayerPacket(viewer.getKey(), packet1); -+ } -+ } -+ } -+ // Paper end - } - - this.sendDirtyEntityData(); diff --git a/patches/removed/1.17/No longer needed/0053-Change-implementation-of-tile-entity-removal-list.patch b/patches/removed/1.17/No longer needed/0053-Change-implementation-of-tile-entity-removal-list.patch deleted file mode 100644 index 51d0728329..0000000000 --- a/patches/removed/1.17/No longer needed/0053-Change-implementation-of-tile-entity-removal-list.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Joseph Hirschfeld <[email protected]> -Date: Thu, 3 Mar 2016 02:39:54 -0600 -Subject: [PATCH] Change implementation of (tile)entity removal list - -use sets for faster removal - -1.17: no more unload lists - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6c6098731752d61b5241710b075d4ffe3826daac..89472b6e8f38921db50440d0213e40ac893892f1 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1122,7 +1122,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - } - } - // Spigot End -- this.blockEntitiesToUnload.addAll(chunk.getBlockEntities().values()); -+ this.tileEntityListUnload.addAll(chunk.getBlockEntities().values()); - List[] aentityslice = chunk.getEntitySlices(); // Spigot - int i = aentityslice.length; - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e25666328dbf433b8358f2637d93b4128034bbaa..7b4475807cca0e92ea9ae6ea49a82a8634cc0ff5 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -89,7 +89,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - public final List<BlockEntity> blockEntityList = Lists.newArrayList(); - public final List<BlockEntity> tickableBlockEntities = Lists.newArrayList(); - protected final List<BlockEntity> pendingBlockEntities = Lists.newArrayList(); -- protected final List<BlockEntity> blockEntitiesToUnload = Lists.newArrayList(); -+ protected final java.util.Set<BlockEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); - public final Thread thread; - private final boolean isDebug; - private int skyDarken; -@@ -697,10 +697,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - - gameprofilerfiller.push("blockEntities"); - timings.tileEntityTick.startTiming(); // Spigot -- if (!this.blockEntitiesToUnload.isEmpty()) { -- this.tickableBlockEntities.removeAll(this.blockEntitiesToUnload); -- this.blockEntityList.removeAll(this.blockEntitiesToUnload); -- this.blockEntitiesToUnload.clear(); -+ if (!this.tileEntityListUnload.isEmpty()) { -+ this.tickableBlockEntities.removeAll(this.tileEntityListUnload); -+ this.blockEntityList.removeAll(this.tileEntityListUnload); -+ this.tileEntityListUnload.clear(); - } - - this.updatingBlockEntities = true; diff --git a/patches/removed/1.17/No longer needed/0087-Remove-unused-World-Tile-Entity-List.patch b/patches/removed/1.17/No longer needed/0087-Remove-unused-World-Tile-Entity-List.patch deleted file mode 100644 index 69e6d9076a..0000000000 --- a/patches/removed/1.17/No longer needed/0087-Remove-unused-World-Tile-Entity-List.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Wed, 13 Apr 2016 00:25:28 -0400 -Subject: [PATCH] Remove unused World Tile Entity List - -Massive hit to performance and it is completely unnecessary. - -Removed during 1.17 update - no longer logically applies -not true? blockEntityTickers and pendingBlockEntityTickers have similar logic applied to them - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index f7eddb39985072afeb79ec0cbfc084d7e84638e6..bb99d9fe5e274318d8480a6de2c45b0a57351f77 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1715,7 +1715,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - } - - bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size())); -- bufferedwriter.write(String.format("block_entities: %d\n", this.blockEntityList.size())); -+ bufferedwriter.write(String.format("block_entities: %d\n", this.tickableBlockEntities.size())); // Paper - remove unused list - bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTicks().size())); - bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getLiquidTicks().size())); - bufferedwriter.write("distance_manager: " + playerchunkmap.getDistanceManager().getDebugStatus() + "\n"); -@@ -1854,7 +1854,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - - private void dumpBlockEntities(Writer writer) throws IOException { - CsvOutput csvwriter = CsvOutput.builder().addColumn("x").addColumn("y").addColumn("z").addColumn("type").build(writer); -- Iterator iterator = this.blockEntityList.iterator(); -+ Iterator iterator = this.tickableBlockEntities.iterator(); // Paper - remove unused list - - while (iterator.hasNext()) { - BlockEntity tileentity = (BlockEntity) iterator.next(); -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 89a6a0b4235cfcc1d3ad68ff59a21fa60df4508f..8f0fec38b482465285057d3fd27d456cf036f2fd 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -91,7 +91,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - public static final ResourceKey<Level> NETHER = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("the_nether")); - public static final ResourceKey<Level> END = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("the_end")); - private static final Direction[] DIRECTIONS = Direction.values(); -- public final List<BlockEntity> blockEntityList = Lists.newArrayList(); -+ //public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list - public final List<BlockEntity> tickableBlockEntities = Lists.newArrayList(); - protected final List<BlockEntity> pendingBlockEntities = Lists.newArrayList(); - protected final java.util.Set<BlockEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); -@@ -683,9 +683,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - }, blockEntity::getBlockPos}); - } - -- boolean flag = this.blockEntityList.add(blockEntity); -+ boolean flag = true; // Paper - remove unused list - -- if (flag && blockEntity instanceof TickableBlockEntity) { -+ if (flag && blockEntity instanceof TickableBlockEntity && !this.tickableBlockEntities.contains(blockEntity)) { // Paper - this.tickableBlockEntities.add(blockEntity); - } - -@@ -721,7 +721,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - timings.tileEntityTick.startTiming(); // Spigot - if (!this.tileEntityListUnload.isEmpty()) { - this.tickableBlockEntities.removeAll(this.tileEntityListUnload); -- this.blockEntityList.removeAll(this.tileEntityListUnload); -+ //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list - this.tileEntityListUnload.clear(); - } - -@@ -781,7 +781,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - tilesThisCycle--; - this.tickableBlockEntities.remove(tileTickPosition--); - // Spigot end -- this.blockEntityList.remove(tileentity); -+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list - if (this.hasChunkAt(tileentity.getBlockPos())) { - this.getChunkAt(tileentity.getBlockPos()).removeBlockEntity(tileentity.getBlockPos()); - } -@@ -811,7 +811,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - this.sendBlockUpdated(tileentity1.getBlockPos(), iblockdata, iblockdata, 3); - // CraftBukkit start - // From above, don't screw this up - SPIGOT-1746 -- if (!this.blockEntityList.contains(tileentity1)) { -+ if (true) { // Paper - remove unused list - this.addBlockEntity(tileentity1); - } - // CraftBukkit end -@@ -957,7 +957,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - } else { - if (tileentity != null) { - this.pendingBlockEntities.remove(tileentity); -- this.blockEntityList.remove(tileentity); -+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list - this.tickableBlockEntities.remove(tileentity); - } - diff --git a/patches/removed/1.17/No longer needed/0088-Don-t-tick-Skulls-unused-code.patch b/patches/removed/1.17/No longer needed/0088-Don-t-tick-Skulls-unused-code.patch deleted file mode 100644 index a3fc8b95d3..0000000000 --- a/patches/removed/1.17/No longer needed/0088-Don-t-tick-Skulls-unused-code.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Wed, 13 Apr 2016 00:30:10 -0400 -Subject: [PATCH] Don't tick Skulls - unused code - -No longer needed in 1.17 - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -index 6a46517e4026971d8c050c685c710883b5976fa3..eebaeaccc3ba1a9ec089d84b8de6c9d36034868f 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -@@ -31,7 +31,7 @@ import net.minecraft.server.MinecraftServer; - import net.minecraft.server.players.GameProfileCache; - import net.minecraft.util.StringUtil; - --public class SkullBlockEntity extends BlockEntity implements TickableBlockEntity { -+public class SkullBlockEntity extends BlockEntity /*implements ITickable*/ { // Paper - remove tickable - - @Nullable - private static GameProfileCache profileCache; -@@ -134,7 +134,7 @@ public class SkullBlockEntity extends BlockEntity implements TickableBlockEntity - - } - -- @Override -+ // Paper - remove override - public void tick() { - BlockState iblockdata = this.getBlockState(); - diff --git a/patches/removed/1.17/No longer needed/0092-Prevent-Fire-from-loading-chunks-wrongly-spread.patch b/patches/removed/1.17/No longer needed/0092-Prevent-Fire-from-loading-chunks-wrongly-spread.patch deleted file mode 100644 index 6301e162a3..0000000000 --- a/patches/removed/1.17/No longer needed/0092-Prevent-Fire-from-loading-chunks-wrongly-spread.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Sun, 17 Apr 2016 17:27:09 -0400 -Subject: [PATCH] Prevent Fire from loading chunks & wrongly spread - -This causes the nether to spam unload/reload chunks, plus overall -bad behavior. - -This also stops fire from spreading to illegal locations. - - - -This shouldn't need to be included in post 1.14 versions, as blocks no longer tick without at least 1 radius -chunk loaded. - -diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java -index 700078c2fd536cc22351eadf51503efb9acd9df9..85170008de6e77cfb8e4f55ae440a8428d868af4 100644 ---- a/src/main/java/net/minecraft/world/level/block/FireBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java -@@ -134,7 +134,7 @@ public class FireBlock extends BaseFireBlock { - BooleanProperty blockstateboolean = (BooleanProperty) FireBlock.PROPERTY_BY_DIRECTION.get(enumdirection); - - if (blockstateboolean != null) { -- iblockdata1 = (BlockState) iblockdata1.setValue(blockstateboolean, this.canBurn(world.getBlockState(pos.relative(enumdirection)))); -+ iblockdata1 = (BlockState) iblockdata1.setValue(blockstateboolean, this.canBurn(world.getTypeIfLoaded(pos.relative(enumdirection)))); // Paper - prevent chunk loads - } - } - -@@ -214,6 +214,7 @@ public class FireBlock extends BaseFireBlock { - } - - blockposition_mutableblockposition.setWithOffset((Vec3i) pos, l, j1, i1); -+ if (blockposition_mutableblockposition.isInvalidYLocation() || !world.hasChunkAt(blockposition_mutableblockposition)) continue; // Paper - int l1 = this.getFireOdds((LevelReader) world, (BlockPos) blockposition_mutableblockposition); - - if (l1 > 0) { -@@ -259,10 +260,16 @@ public class FireBlock extends BaseFireBlock { - } - - private void trySpread(Level world, BlockPos blockposition, int i, Random random, int j, BlockPos sourceposition) { // CraftBukkit add sourceposition -- int k = this.getBurnOdd(world.getBlockState(blockposition)); -+ // Paper start -+ final BlockState iblockdata = world.getTypeIfLoaded(blockposition); -+ if (iblockdata == null) { -+ return; -+ } -+ int k = this.getBurnOdd(iblockdata); -+ // Paper end - - if (random.nextInt(i) < k) { -- BlockState iblockdata = world.getBlockState(blockposition); -+ //IBlockData iblockdata = world.getType(blockposition); // Paper - - // CraftBukkit start - org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -@@ -308,7 +315,7 @@ public class FireBlock extends BaseFireBlock { - for (int j = 0; j < i; ++j) { - Direction enumdirection = aenumdirection[j]; - -- if (this.canBurn(world.getBlockState(pos.relative(enumdirection)))) { -+ if (this.canBurn(world.getTypeIfLoaded(pos.relative(enumdirection)))) { // Paper - prevent chunk loads - return true; - } - } -@@ -326,7 +333,12 @@ public class FireBlock extends BaseFireBlock { - - for (int k = 0; k < j; ++k) { - Direction enumdirection = aenumdirection[k]; -- BlockState iblockdata = iworldreader.getBlockState(pos.relative(enumdirection)); -+ // Paper start -+ BlockState iblockdata = iworldreader.getTypeIfLoaded(pos.relative(enumdirection)); -+ if (iblockdata == null) { -+ continue; -+ } -+ // Paper end - - i = Math.max(this.getFlameOdds(iblockdata), i); - } -@@ -337,7 +349,7 @@ public class FireBlock extends BaseFireBlock { - - @Override - protected boolean canBurn(BlockState state) { -- return this.getFlameOdds(state) > 0; -+ return state != null && this.getFlameOdds(state) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now - } - - @Override diff --git a/patches/removed/1.17/No longer needed/0107-Fix-Double-World-Add-issues.patch b/patches/removed/1.17/No longer needed/0107-Fix-Double-World-Add-issues.patch deleted file mode 100644 index aa8370e2b0..0000000000 --- a/patches/removed/1.17/No longer needed/0107-Fix-Double-World-Add-issues.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Tue, 21 Jun 2016 22:54:34 -0400 -Subject: [PATCH] Fix Double World Add issues - -Vanilla will double add Spider Jockeys to the world, so ignore already added. - -Also add debug if something else tries to, and abort before world gets bad state - -In 1.17 the entire entity state manager was rewritten. no longer applies, needs -further information on new state manager - -similar check added by mojang - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0a613f94d1c796267636e1a343aeee65a49ffed5..335928d60dbfc07644ffeab366900c5e77e99d56 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1032,6 +1032,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - // CraftBukkit start - private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { - org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot -+ if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper - if (entity.removed) { - // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit - return false; diff --git a/patches/removed/1.17/No longer needed/0114-Chunk-registration-fixes.patch b/patches/removed/1.17/No longer needed/0114-Chunk-registration-fixes.patch deleted file mode 100644 index 295d9a4664..0000000000 --- a/patches/removed/1.17/No longer needed/0114-Chunk-registration-fixes.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Wed, 21 Sep 2016 22:54:28 -0400 -Subject: [PATCH] Chunk registration fixes - -World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated - -Keep them consistent - -No longer relevant in 1.17 - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 335928d60dbfc07644ffeab366900c5e77e99d56..20650bfd10abfa010e71cfeede06c461d50d19a3 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -841,7 +841,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - if (entity.checkAndResetUpdateChunkPos()) { - this.getProfiler().push("chunkCheck"); - int i = Mth.floor(entity.getX() / 16.0D); -- int j = Mth.floor(entity.getY() / 16.0D); -+ int j = Math.min(15, Math.max(0, Mth.floor(entity.getY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior - int k = Mth.floor(entity.getZ() / 16.0D); - - if (!entity.inChunk || entity.xChunk != i || entity.yChunk != j || entity.zChunk != k) { diff --git a/patches/removed/1.17/No longer needed/0120-Cache-user-authenticator-threads.patch b/patches/removed/1.17/No longer needed/0120-Cache-user-authenticator-threads.patch deleted file mode 100644 index 8b7ea21b92..0000000000 --- a/patches/removed/1.17/No longer needed/0120-Cache-user-authenticator-threads.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: vemacs <[email protected]> -Date: Wed, 23 Nov 2016 08:31:45 -0500 -Subject: [PATCH] Cache user authenticator threads - - -TODO it looks like someone royally messed this one up, patch name doesn't remotely -describe contents. Good thing this patch is no longer relevant at all - -no remove queue anymore - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 0597c0c3e881dd43cf91bd3088ed30dfecfe8098..175bf535066afc42de8a3f0d11c46af66f3e3e52 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1388,7 +1388,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - } - } - -- player.entitiesToRemove.remove(Integer.valueOf(this.entity.getId())); -+ player.removeQueue.remove(Integer.valueOf(this.entity.getId())); - // CraftBukkit end - - if (flag1 && this.trackedPlayerMap.putIfAbsent(player, true) == null) { // Paper -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3a2356b3e00098d100a179a05316f402390d4e9b..3cde25c2479adcc4ce3014e5ac2ec0710bffeea9 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -4,7 +4,9 @@ import com.google.common.collect.Lists; - import com.mojang.authlib.GameProfile; - import com.mojang.datafixers.util.Either; - import com.mojang.serialization.DataResult; -+import java.util.ArrayDeque; // Paper - import java.util.Collection; -+import java.util.Deque; // Paper - import java.util.Iterator; - import java.util.List; - import java.util.Optional; -@@ -169,7 +171,7 @@ public class ServerPlayer extends Player implements ContainerListener { - public ServerGamePacketListenerImpl connection; - public final MinecraftServer server; - public final ServerPlayerGameMode gameMode; -- public final List<Integer> entitiesToRemove = Lists.newLinkedList(); -+ public final Deque<Integer> removeQueue = new ArrayDeque<>(); // Paper - private final PlayerAdvancements advancements; - private final ServerStatsCounter stats; - private float lastRecordedHealthAndAbsorption = Float.MIN_VALUE; -@@ -544,16 +546,23 @@ public class ServerPlayer extends Player implements ContainerListener { - this.containerMenu = this.inventoryMenu; - } - -- while (!this.entitiesToRemove.isEmpty()) { -- int i = Math.min(this.entitiesToRemove.size(), Integer.MAX_VALUE); -+ while (!this.removeQueue.isEmpty()) { -+ int i = Math.min(this.removeQueue.size(), Integer.MAX_VALUE); - int[] aint = new int[i]; -- Iterator<Integer> iterator = this.entitiesToRemove.iterator(); -+ //Iterator<Integer> iterator = this.removeQueue.iterator(); // Paper - int j = 0; - -- while (iterator.hasNext() && j < i) { -+ // Paper start -+ /* while (iterator.hasNext() && j < i) { - aint[j++] = (Integer) iterator.next(); - iterator.remove(); -+ } */ -+ -+ Integer integer; -+ while (j < i && (integer = this.removeQueue.poll()) != null) { -+ aint[j++] = integer.intValue(); - } -+ // Paper end - - this.connection.send(new ClientboundRemoveEntitiesPacket(aint)); - } -@@ -1558,7 +1567,14 @@ public class ServerPlayer extends Player implements ContainerListener { - this.lastSentHealth = -1.0F; - this.lastSentFood = -1; - // this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit -- this.entitiesToRemove.addAll(oldPlayer.entitiesToRemove); -+ // Paper start - Optimize remove queue - vanilla copies player objects, but CB doesn't. This method currently only -+ // Applies to the same player, so we need to not duplicate our removal queue. The rest of this method does "resetting" -+ // type logic so it does need to be called, maybe? This is silly. -+ // this.removeQueue.addAll(entityplayer.removeQueue); -+ if (this.removeQueue != oldPlayer.removeQueue) { -+ this.removeQueue.addAll(oldPlayer.removeQueue); -+ } -+ // Paper end - this.seenCredits = oldPlayer.seenCredits; - this.enteredNetherPosition = oldPlayer.enteredNetherPosition; - this.setShoulderEntityLeft(oldPlayer.getShoulderEntityLeft()); -@@ -1748,13 +1764,13 @@ public class ServerPlayer extends Player implements ContainerListener { - if (entity instanceof Player) { - this.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{entity.getId()})); - } else { -- this.entitiesToRemove.add((Integer) entity.getId()); // CraftBukkit - decompile error -+ this.removeQueue.add((Integer) entity.getId()); // CraftBukkit - decompile error - } - - } - - public void cancelRemoveEntity(Entity entity) { -- this.entitiesToRemove.remove((Integer) entity.getId()); // CraftBukkit - decompile error -+ this.removeQueue.remove((Integer) entity.getId()); // CraftBukkit - decompile error - } - - @Override diff --git a/patches/removed/1.17/No longer needed/0135-Add-system-property-to-disable-book-size-limits.patch b/patches/removed/1.17/No longer needed/0135-Add-system-property-to-disable-book-size-limits.patch deleted file mode 100644 index e3adba196c..0000000000 --- a/patches/removed/1.17/No longer needed/0135-Add-system-property-to-disable-book-size-limits.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <[email protected]> -Date: Sat, 13 May 2017 20:11:21 -0500 -Subject: [PATCH] Add system property to disable book size limits - -If anyone comes in with a watchdog crash related to books after this patch -you will not only be publicly shamed but also made an example of. - -Disables the security limits on books entirely, allowing plugins AND players -to make books with as much data as they want. Do not use this without -limiting incoming data from packets in some other way. - -Removed in 1.17: It was from a different time before books were as jank as they are now. As time has gone on they've only proven to be worse and worse. - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -index a33dd184ea51df7e59ed08e5e2b0ea4ed9dadff5..1d94d285951faa98ff1f70c3c5330dfaa77cb691 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -@@ -42,6 +42,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { - static final int MAX_PAGES = 100; - static final int MAX_PAGE_LENGTH = 320; // 256 limit + 64 characters to allow for psuedo colour codes - static final int MAX_TITLE_LENGTH = 32; -+ private static final boolean OVERRIDE_CHECKS = Boolean.getBoolean("disable.book-limits"); // Paper - Add override - - protected String title; - protected String author; -@@ -244,7 +245,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { - if (title == null) { - this.title = null; - return true; -- } else if (title.length() > CraftMetaBook.MAX_TITLE_LENGTH) { -+ } else if (title.length() > CraftMetaBook.MAX_TITLE_LENGTH && !CraftMetaBook.OVERRIDE_CHECKS) { // Paper - Add override - return false; - } - -@@ -441,7 +442,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { - String validatePage(String page) { - if (page == null) { - page = ""; -- } else if (page.length() > CraftMetaBook.MAX_PAGE_LENGTH) { -+ } else if (page.length() > CraftMetaBook.MAX_PAGE_LENGTH && !CraftMetaBook.OVERRIDE_CHECKS) { // Paper - Add override - page = page.substring(0, MAX_PAGE_LENGTH); - } - return page; -@@ -451,7 +452,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { - // asserted: page != null - if (this.pages == null) { - this.pages = new ArrayList<String>(); -- } else if (this.pages.size() >= CraftMetaBook.MAX_PAGES) { -+ } else if (this.pages.size() >= CraftMetaBook.MAX_PAGES && !CraftMetaBook.OVERRIDE_CHECKS) { // Paper - Add override - return; - } - this.pages.add(page); diff --git a/patches/removed/1.17/No longer needed/0182-Avoid-NPE-in-PathfinderGoalTempt.patch b/patches/removed/1.17/No longer needed/0182-Avoid-NPE-in-PathfinderGoalTempt.patch deleted file mode 100644 index 54268b11fc..0000000000 --- a/patches/removed/1.17/No longer needed/0182-Avoid-NPE-in-PathfinderGoalTempt.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Wed, 29 Nov 2017 22:18:54 -0500 -Subject: [PATCH] Avoid NPE in PathfinderGoalTempt -Not needed anymore -similar check added by Mojang - -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java -index 186025458e923d153e9e47c2be147a9bb53db517..11ca6a752bac4ba4bc683bef844d204b739fab63 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java -@@ -63,7 +63,7 @@ public class TemptGoal extends Goal { - } - this.target = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle(); - } -- return tempt; -+ return tempt && this.target != null; // Paper - must have target - plugin might of cancelled - // CraftBukkit end - } - } diff --git a/patches/removed/1.17/No longer needed/0185-Fix-Dragon-Server-Crashes.patch b/patches/removed/1.17/No longer needed/0185-Fix-Dragon-Server-Crashes.patch deleted file mode 100644 index 270cd5951a..0000000000 --- a/patches/removed/1.17/No longer needed/0185-Fix-Dragon-Server-Crashes.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Wed, 21 Mar 2018 20:52:07 -0400 -Subject: [PATCH] Fix Dragon Server Crashes - -If the dragon tries to find "ground" and hits a hole, or off edge, -it will infinitely keep looking for non air and eventually crash. - -Fixed in 1.15 - -diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java -index df44bfce8cc492cd901dfa86331b9be7f1e13837..9eca797b4db96c5f2bb93d260f8e84077d92854a 100644 ---- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java -+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java -@@ -64,7 +64,7 @@ public class DragonSittingFlamingPhase extends AbstractDragonSittingPhase { - double h = g; - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(d, g, e); - -- while(this.dragon.level.isEmptyBlock(mutableBlockPos)) { -+ while(this.dragon.level.isEmptyBlock(mutableBlockPos) && g > 0) { // Paper - --h; - if (h < 0.0D) { - h = g; diff --git a/patches/removed/1.17/No longer needed/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch b/patches/removed/1.17/No longer needed/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch deleted file mode 100644 index 56015aa8db..0000000000 --- a/patches/removed/1.17/No longer needed/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Thu, 19 Jul 2018 01:05:00 -0400 -Subject: [PATCH] Don't change the Entity Random seed for squids - - -Rebased into the patch to add the shared entity random -diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java -index 5a7582fd4f8e883d2f08a0227932c17d7576b957..2e5a35565b6b7c4d3f7fdab45095f789c33f8937 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Squid.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java -@@ -48,7 +48,7 @@ public class Squid extends WaterAnimal { - - public Squid(EntityType<? extends Squid> type, Level world) { - super(type, world); -- this.random.setSeed((long) this.getId()); -+ //this.random.setSeed((long) this.getId()); // Paper - this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; - } - diff --git a/patches/removed/1.17/No longer needed/0239-Re-add-vanilla-entity-warnings-for-duplicates.patch b/patches/removed/1.17/No longer needed/0239-Re-add-vanilla-entity-warnings-for-duplicates.patch deleted file mode 100644 index 93a070fe0e..0000000000 --- a/patches/removed/1.17/No longer needed/0239-Re-add-vanilla-entity-warnings-for-duplicates.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Thu, 19 Jul 2018 01:08:05 -0400 -Subject: [PATCH] Re-add vanilla entity warnings for duplicates - -These are a critical sign that somethin went wrong, and you've lost some data.... - -We should kind of know about these things you know. - -Spigot did not remove the warning in 1.17 - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ea1b15495481157912140bf5de9bf4a949c16910..914241a57c304fde220bc546261d6e959445772a 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1071,7 +1071,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - if (entity1 == null) { - return false; - } else { -- // WorldServer.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityTypes.getName(entity1.getEntityType()), entity1.getId(), EntityTypes.getName(entity.getEntityType()), entity.getId()); // CraftBukkit -+ ServerLevel.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityType.getKey(entity1.getType()), entity1.getId(), EntityType.getKey(entity.getType()), entity.getId()); // CraftBukkit // Paper - return true; - } - } diff --git a/patches/removed/1.17/No longer needed/0250-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch b/patches/removed/1.17/No longer needed/0250-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch deleted file mode 100644 index 802c1e0e25..0000000000 --- a/patches/removed/1.17/No longer needed/0250-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Mon, 23 Jul 2018 22:18:31 -0400 -Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it - saves - -Useless in 1.17 - leaf - -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 d69ccb1f31f31ebeee477df20ce1410f9e485eb7..bd9b19d988ecf72e099efeff6ec3483a352174ec 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -559,6 +559,7 @@ public class LevelChunk implements ChunkAccess { - entity.zChunk = this.chunkPos.z; - this.entities.add(entity); // Paper - per chunk entity list - this.entitySlices[k].add(entity); -+ this.markUnsaved(); // Paper - } - - @Override -@@ -587,6 +588,7 @@ public class LevelChunk implements ChunkAccess { - return; - } - entityCounts.decrement(entity.getMinecraftKeyString()); -+ this.markUnsaved(); // Paper - // Paper end - this.entities.remove(entity); // Paper - } diff --git a/patches/removed/1.17/No longer needed/0251-Add-some-Debug-to-Chunk-Entity-slices.patch b/patches/removed/1.17/No longer needed/0251-Add-some-Debug-to-Chunk-Entity-slices.patch deleted file mode 100644 index 562e663109..0000000000 --- a/patches/removed/1.17/No longer needed/0251-Add-some-Debug-to-Chunk-Entity-slices.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Mon, 23 Jul 2018 22:44:23 -0400 -Subject: [PATCH] Add some Debug to Chunk Entity slices - -If we detect unexpected state, log and try to recover - -This should hopefully avoid duplicate entities ever being created -if the entity was to end up in 2 different chunk slices - -Useless in 1.17 - -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a2cc3e58d59ed3d9f443b77c44d8200cc09b4da9..7847078c54154e28ab066ea8a329f929df1e1a37 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -156,6 +156,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - } - } - }; -+ public List<Entity> entitySlice = null; - // Paper end - - public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -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 bd9b19d988ecf72e099efeff6ec3483a352174ec..09aa608bd303b618ae2c0ebd237bcbdba60a37a8 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -26,7 +26,9 @@ import net.minecraft.ReportedException; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Registry; - import net.minecraft.nbt.CompoundTag; -+import net.minecraft.server.MinecraftServer; - import net.minecraft.server.level.ChunkHolder; -+import net.minecraft.server.level.ServerChunkCache; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.util.Mth; - import net.minecraft.world.entity.Entity; -@@ -550,6 +552,25 @@ public class LevelChunk implements ChunkAccess { - if (k >= this.entitySlices.length) { - k = this.entitySlices.length - 1; - } -+ // Paper - remove from any old list if its in one -+ List<Entity> nextSlice = this.entitySlices[k]; // the next list to be added to -+ List<Entity> currentSlice = entity.entitySlice; -+ if (nextSlice == currentSlice) { -+ if (Level.DEBUG_ENTITIES) MinecraftServer.LOGGER.warn("Entity was already in this chunk!" + entity, new Throwable()); -+ return; // ??? silly plugins -+ } -+ if (currentSlice != null && currentSlice.contains(entity)) { -+ // Still in an old chunk... -+ if (Level.DEBUG_ENTITIES) MinecraftServer.LOGGER.warn("Entity is still in another chunk!" + entity, new Throwable()); -+ LevelChunk chunk = entity.getCurrentChunk(); -+ if (chunk != null) { -+ chunk.removeEntity(entity); -+ } else { -+ removeEntity(entity); -+ } -+ currentSlice.remove(entity); // Just incase the above did not remove from the previous slice -+ } -+ // Paper end - - if (!entity.inChunk || entity.getCurrentChunk() != this) entityCounts.increment(entity.getMinecraftKeyString()); // Paper - entity.inChunk = true; -@@ -559,6 +580,7 @@ public class LevelChunk implements ChunkAccess { - entity.zChunk = this.chunkPos.z; - this.entities.add(entity); // Paper - per chunk entity list - this.entitySlices[k].add(entity); -+ entity.entitySlice = this.entitySlices[k]; // Paper - this.markUnsaved(); // Paper - } - -@@ -584,6 +606,10 @@ public class LevelChunk implements ChunkAccess { - - // Paper start - if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null); -+ if (entitySlices[section] == entity.entitySlice) { -+ entity.entitySlice = null; -+ entity.inChunk = false; -+ } - if (!this.entitySlices[section].remove(entity)) { - return; - } -@@ -742,7 +768,7 @@ public class LevelChunk implements ChunkAccess { - // Paper start - neighbour cache - int chunkX = this.chunkPos.x; - int chunkZ = this.chunkPos.z; -- ChunkProviderServer chunkProvider = ((ServerLevel)this.world).getChunkSource(); -+ ServerChunkCache chunkProvider = ((ServerLevel)this.world).getChunkSource(); - for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { - for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { - LevelChunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); -@@ -802,7 +828,7 @@ public class LevelChunk implements ChunkAccess { - // Paper start - neighbour cache - int chunkX = this.chunkPos.x; - int chunkZ = this.chunkPos.z; -- ChunkProviderServer chunkProvider = ((ServerLevel)this.world).getChunkSource(); -+ ServerChunkCache chunkProvider = ((ServerLevel)this.world).getChunkSource(); - for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { - for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { - LevelChunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); diff --git a/patches/removed/1.17/No longer needed/0253-Prevent-Saving-Bad-entities-to-chunks.patch b/patches/removed/1.17/No longer needed/0253-Prevent-Saving-Bad-entities-to-chunks.patch deleted file mode 100644 index bf9a9d15a4..0000000000 --- a/patches/removed/1.17/No longer needed/0253-Prevent-Saving-Bad-entities-to-chunks.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Thu, 26 Jul 2018 00:11:12 -0400 -Subject: [PATCH] Prevent Saving Bad entities to chunks - -See https://github.com/PaperMC/Paper/issues/1223 - -Minecraft is saving invalid entities to the chunk files. - -Avoid saving bad data, and also make improvements to handle -loading these chunks. Any invalid entity will be instant killed, -so lets avoid adding it to the world... - -This lets us be safer about the dupe UUID resolver too, as now -we can ignore instant killed entities and avoid risk of duplicating -an invalid entity. - -This should reduce log occurrences of dupe uuid messages. - -1.17, not a concern anymore - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a5d7781b13a6d61238d026f064512f7162e1e868..8e8e5f30c512ed7d8ee987550c22d3e9df845043 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1151,6 +1151,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - List[] aentityslice = chunk.getEntitySlices(); // Spigot - int i = aentityslice.length; - -+ java.util.List<Entity> toMoveChunks = new java.util.ArrayList<>(); // Paper - for (int j = 0; j < i; ++j) { - List<Entity> entityslice = aentityslice[j]; // Spigot - Iterator iterator = entityslice.iterator(); -@@ -1163,11 +1164,25 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - throw (IllegalStateException) Util.pauseInIde((Throwable) (new IllegalStateException("Removing entity while ticking!"))); - } - -+ // Paper start - move out entities that shouldn't be in this chunk before it unloads -+ if (!entity.removed && (int) Math.floor(entity.getX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.getZ()) >> 4 != chunk.getPos().z) { -+ toMoveChunks.add(entity); -+ continue; -+ } -+ // Paper end -+ - this.entitiesById.remove(entity.getId()); - this.onEntityRemoved(entity); -+ -+ if (entity.removed) iterator.remove(); // Paper - don't save dead entities during unload - } - } - } -+ // Paper start - move out entities that shouldn't be in this chunk before it unloads -+ for (Entity entity : toMoveChunks) { -+ this.updateChunkPos(entity); -+ } -+ // Paper end - - } - -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 0efaf4d0f58bcf38b427e76bf09b96e354294159..542d6f322df5f44ad9f504c8e14c88e3fa540657 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -27,6 +27,7 @@ import net.minecraft.nbt.LongArrayTag; - import net.minecraft.nbt.ShortTag; - import net.minecraft.server.level.ServerChunkCache; - import net.minecraft.server.level.ServerLevel; -+import net.minecraft.server.level.ServerPlayer; - import net.minecraft.server.level.ThreadedLevelLightEngine; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntityType; -@@ -349,6 +350,7 @@ public class ChunkSerializer { - nbttagcompound1.put("TileEntities", nbttaglist1); - ListTag nbttaglist2 = new ListTag(); - -+ java.util.List<Entity> toUpdate = new java.util.ArrayList<>(); // Paper - if (chunk.getStatus().getChunkType() == ChunkStatus.ChunkType.LEVELCHUNK) { - LevelChunk chunk1 = (LevelChunk) chunk; - -@@ -366,13 +368,28 @@ public class ChunkSerializer { - while (iterator1.hasNext()) { - Entity entity = (Entity) iterator1.next(); - CompoundTag nbttagcompound4 = new CompoundTag(); -- -+ // Paper start -+ if ((int) Math.floor(entity.getX()) >> 4 != chunk1.getPos().x || (int) Math.floor(entity.getZ()) >> 4 != chunk1.getPos().z) { -+ toUpdate.add(entity); -+ continue; -+ } -+ if (entity.removed || hasPlayerPassenger(entity)) { -+ continue; -+ } -+ // Paper end - if (entity.save(nbttagcompound4)) { - chunk1.setLastSaveHadEntities(true); - nbttaglist2.add(nbttagcompound4); - } - } - } -+ -+ // Paper start - move entities to the correct chunk -+ for (Entity entity : toUpdate) { -+ world.updateChunkPos(entity); -+ } -+ // Paper end -+ - } else { - ProtoChunk protochunk = (ProtoChunk) chunk; - -@@ -431,6 +448,19 @@ public class ChunkSerializer { - nbttagcompound1.put("Structures", packStructureData(chunkcoordintpair, chunk.getAllStarts(), chunk.getAllReferences())); - return nbttagcompound; - } -+ // Paper start - this is saved with the player -+ private static boolean hasPlayerPassenger(Entity entity) { -+ for (Entity passenger : entity.passengers) { -+ if (passenger instanceof ServerPlayer) { -+ return true; -+ } -+ if (hasPlayerPassenger(passenger)) { -+ return true; -+ } -+ } -+ return false; -+ } -+ // Paper end - - public static ChunkStatus.ChunkType getChunkTypeFromTag(@Nullable CompoundTag tag) { - if (tag != null) { diff --git a/patches/removed/1.17/No longer needed/0255-Ignore-Dead-Entities-in-entityList-iteration.patch b/patches/removed/1.17/No longer needed/0255-Ignore-Dead-Entities-in-entityList-iteration.patch deleted file mode 100644 index b80a13b2b7..0000000000 --- a/patches/removed/1.17/No longer needed/0255-Ignore-Dead-Entities-in-entityList-iteration.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Sat, 28 Jul 2018 12:18:27 -0400 -Subject: [PATCH] Ignore Dead Entities in entityList iteration - -A spigot change delays removal of entities from the entity list. -This causes a change in behavior from Vanilla where getEntities type -methods will return dead entities that they shouldn't otherwise be doing. - -This will ensure that dead entities are skipped from iteration since -they shouldn't of been in the list in the first place. - -Not relevant in 1.17 - -diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index e95b91cefb0374bd5bb57cc090f5ecd566d7a618..8fd716bf2e1402694798b8be03fd85821153be44 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperCommand.java -+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -209,6 +209,7 @@ public class PaperCommand extends Command { - Collection<Entity> entities = world.entitiesById.values(); - entities.forEach(e -> { - ResourceLocation key = e.getMinecraftKey(); -+ if (e.shouldBeRemoved) return; // Paper - - MutablePair<Integer, Map<ChunkPos, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); - ChunkPos chunk = new ChunkPos(e.xChunk, e.zChunk); -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 8e8e5f30c512ed7d8ee987550c22d3e9df845043..84b2cd661697545186677ab7966556d9288c650b 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1303,6 +1303,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - entity.origin = entity.getBukkitEntity().getLocation(); - } - // Paper end -+ entity.shouldBeRemoved = false; // Paper - shouldn't be removed after being re-added - new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid - } - -@@ -1315,6 +1316,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - this.removeFromChunk(entity); - this.entitiesById.remove(entity.getId()); - this.onEntityRemoved(entity); -+ entity.shouldBeRemoved = true; // Paper - } - } - -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7847078c54154e28ab066ea8a329f929df1e1a37..5bf6bc6a01ccde8a4d67b49293bb326cb09248d8 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -275,6 +275,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - protected int numCollisions = 0; // Paper - public void inactiveTick() { } - // Spigot end -+ public boolean shouldBeRemoved; // Paper - - public float getBukkitYaw() { - return this.yRot; -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 09aa608bd303b618ae2c0ebd237bcbdba60a37a8..db28bfe95c885cdefa855c7aaa3bcf92bc52df26 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -862,6 +862,7 @@ public class LevelChunk implements ChunkAccess { - - for (int i1 = 0; i1 < l; ++i1) { - Entity entity1 = (Entity) list1.get(i1); -+ if (entity1.shouldBeRemoved) continue; // Paper - - if (entity1.getBoundingBox().intersects(box) && entity1 != except) { - if (predicate == null || predicate.test(entity1)) { -@@ -899,6 +900,7 @@ public class LevelChunk implements ChunkAccess { - - while (iterator.hasNext()) { - T entity = (T) iterator.next(); // CraftBukkit - decompile error -+ if (entity.shouldBeRemoved) continue; // Paper - - if ((type == null || entity.getType() == type) && entity.getBoundingBox().intersects(box) && predicate.test(entity)) { - result.add(entity); -@@ -921,6 +923,7 @@ public class LevelChunk implements ChunkAccess { - - while (iterator.hasNext()) { - T t0 = (T) iterator.next(); // CraftBukkit - decompile error -+ if (t0.shouldBeRemoved) continue; // Paper - - if (entityClass.isInstance(t0) && t0.getBoundingBox().intersects(box) && (predicate == null || predicate.test(t0))) { // Spigot - instance check - result.add(t0); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 3a3466cd9bbd34dbc0b79567f5579e84a81d6009..9807612aed6c4393cbe1f4b6078e45bf1ba3deb2 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1022,6 +1022,7 @@ public class CraftWorld implements World { - for (Object o : world.entitiesById.values()) { - if (o instanceof net.minecraft.world.entity.Entity) { - net.minecraft.world.entity.Entity mcEnt = (net.minecraft.world.entity.Entity) o; -+ if (mcEnt.shouldBeRemoved) continue; // Paper - Entity bukkitEntity = mcEnt.getBukkitEntity(); - - // Assuming that bukkitEntity isn't null -@@ -1041,6 +1042,7 @@ public class CraftWorld implements World { - for (Object o : world.entitiesById.values()) { - if (o instanceof net.minecraft.world.entity.Entity) { - net.minecraft.world.entity.Entity mcEnt = (net.minecraft.world.entity.Entity) o; -+ if (mcEnt.shouldBeRemoved) continue; // Paper - Entity bukkitEntity = mcEnt.getBukkitEntity(); - - // Assuming that bukkitEntity isn't null -@@ -1067,6 +1069,7 @@ public class CraftWorld implements World { - - for (Object entity: world.entitiesById.values()) { - if (entity instanceof net.minecraft.world.entity.Entity) { -+ if (((net.minecraft.world.entity.Entity) entity).shouldBeRemoved) continue; // Paper - Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity(); - - if (bukkitEntity == null) { -@@ -1090,6 +1093,7 @@ public class CraftWorld implements World { - - for (Object entity: world.entitiesById.values()) { - if (entity instanceof net.minecraft.world.entity.Entity) { -+ if (((net.minecraft.world.entity.Entity) entity).shouldBeRemoved) continue; // Paper - Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity(); - - if (bukkitEntity == null) { diff --git a/patches/removed/1.17/No longer needed/0327-Fix-sign-edit-memory-leak.patch b/patches/removed/1.17/No longer needed/0327-Fix-sign-edit-memory-leak.patch deleted file mode 100644 index 1c8d3052c4..0000000000 --- a/patches/removed/1.17/No longer needed/0327-Fix-sign-edit-memory-leak.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Thu, 28 Feb 2019 00:15:28 -0500 -Subject: [PATCH] Fix sign edit memory leak - -when a player edits a sign, a reference to their Entity is never cleand up. - -removed 1.17 - mojang uses a UUID instead of a player field now - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b1c505d3fdcc2fb3496f80bee85e4895b9069dcb..276773e17149f57038cd21485fd9d9061670ff2d 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2850,7 +2850,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - - SignBlockEntity tileentitysign = (SignBlockEntity) tileentity; - -- if (!tileentitysign.isEditable() || tileentitysign.getPlayerWhoMayEdit() != this.player) { -+ if (!tileentitysign.isEditable() || tileentitysign.signEditor == null || !tileentitysign.signEditor.equals(this.player.getUUID())) { - ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString()); - this.send(tileentity.getUpdatePacket()); // CraftBukkit - return; -diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index e4eab82855649fec654c60b2e94ba7b71c2ac5a2..0b26d3ab2db66d6baaa95d1d5f6c756595d31495 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -30,6 +30,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C - private Player playerWhoMayEdit; - private final FormattedCharSequence[] renderMessages; - private DyeColor color; -+ public java.util.UUID signEditor; // Paper - - public SignBlockEntity() { - super(BlockEntityType.SIGN); -@@ -131,7 +132,10 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C - } - - public void setAllowedPlayerEditor(Player player) { -- this.playerWhoMayEdit = player; -+ // Paper start -+ //this.c = entityhuman; -+ signEditor = player != null ? player.getUUID() : null; -+ // Paper end - } - - public Player getPlayerWhoMayEdit() { diff --git a/patches/removed/1.17/No longer needed/0327-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch b/patches/removed/1.17/No longer needed/0327-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch deleted file mode 100644 index 3781130845..0000000000 --- a/patches/removed/1.17/No longer needed/0327-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath <[email protected]> -Date: Mon, 27 May 2019 17:35:39 -0500 -Subject: [PATCH] MC-114618 - Fix EntityAreaEffectCloud from going negative - size - -1.17 update note: Likely fixed in 1.17 - -fixed https://bugs.mojang.com/browse/MC-114618 - -diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -index 4733f74ff028c03a60b73280caf9e4d1e2f0ca30..882c216b508a8623c2393b668cff6d702fe738b9 100644 ---- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -@@ -197,6 +197,12 @@ public class AreaEffectCloud extends Entity { - super.tick(); - boolean flag = this.isWaiting(); - float f = this.getRadius(); -+ // Paper start - fix MC-114618 -+ if (f < 0.0F) { -+ this.remove(); -+ return; -+ } -+ // Paper end - - if (this.level.isClientSide) { - if (flag && this.random.nextBoolean()) { diff --git a/patches/removed/1.17/No longer needed/0359-Catch-exceptions-from-dispenser-entity-spawns.patch b/patches/removed/1.17/No longer needed/0359-Catch-exceptions-from-dispenser-entity-spawns.patch deleted file mode 100644 index a560a1fd92..0000000000 --- a/patches/removed/1.17/No longer needed/0359-Catch-exceptions-from-dispenser-entity-spawns.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder <[email protected]> -Date: Mon, 10 Jun 2019 09:36:40 +0100 -Subject: [PATCH] Catch exceptions from dispenser entity spawns -mojang(?) added similar warning - -diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index dccf689d17bb5a77abf97779663413d01e840c23..67a894a185a3d4a53b3c7f90174b2604dff18257 100644 ---- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -8,6 +8,7 @@ import net.minecraft.core.BlockPos; - import net.minecraft.core.BlockSource; - import net.minecraft.core.Direction; - import net.minecraft.core.Position; -+import net.minecraft.server.MinecraftServer; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.server.level.ServerPlayer; - import net.minecraft.sounds.SoundEvents; -@@ -235,7 +236,14 @@ public interface DispenseItemBehavior { - } - } - -+ try { // Paper - entitytypes.spawn(pointer.getLevel(), stack, (Player) null, pointer.getPos().relative(enumdirection), MobSpawnType.DISPENSER, enumdirection != Direction.UP, false); -+ // Paper start -+ } catch (Exception ex){ -+ MinecraftServer.LOGGER.warn("An exception occurred dispensing entity at {}[{}]", worldserver.getWorld().getName(), pointer.getPos(), ex); -+ } -+ // Paper end -+ - // itemstack.subtract(1); // Handled during event processing - // CraftBukkit end - return stack; diff --git a/patches/removed/1.17/No longer needed/0367-Mark-entities-as-being-ticked-when-notifying-navigat.patch b/patches/removed/1.17/No longer needed/0367-Mark-entities-as-being-ticked-when-notifying-navigat.patch deleted file mode 100644 index a5be725dd8..0000000000 --- a/patches/removed/1.17/No longer needed/0367-Mark-entities-as-being-ticked-when-notifying-navigat.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder <[email protected]> -Date: Sun, 28 Jul 2019 00:51:11 +0100 -Subject: [PATCH] Mark entities as being ticked when notifying navigation -1.17: Check how this is done after rework - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 7a09bc921827958f58290bd3d6f19984bb34a8f6..a811ced17721b70bb51837f47e466c2261db2466 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1469,6 +1469,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); - - if (Shapes.joinIsNotEmpty(voxelshape, voxelshape1, BooleanOp.NOT_SAME)) { -+ boolean wasTicking = this.tickingEntities; this.tickingEntities = true; // Paper - Iterator iterator = this.navigations.iterator(); - - while (iterator.hasNext()) { -@@ -1490,6 +1491,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - } - } - -+ this.tickingEntities = wasTicking; // Paper - } - } - diff --git a/patches/removed/1.17/No longer needed/0380-Performance-improvement-for-Chunk.getEntities.patch b/patches/removed/1.17/No longer needed/0380-Performance-improvement-for-Chunk.getEntities.patch deleted file mode 100644 index 45306b4541..0000000000 --- a/patches/removed/1.17/No longer needed/0380-Performance-improvement-for-Chunk.getEntities.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: wea_ondara <[email protected]> -Date: Thu, 10 Oct 2019 11:29:42 +0200 -Subject: [PATCH] Performance improvement for Chunk.getEntities - -This patch aims to reduce performance cost used by collecting the -entities of a chunk. Previously the entitySlices were copied into an -extra array with List.toArray() with is a costly and unneccessary -operation. This patch will reduce the load of plugins which for example -implement custom moblimits and depend on Chunk.getEntities(). - -1.17: needs to be reworked, entities not in chunk anymore - -no longer needed as no toArray is called during getEntities due to rewrite of entity system - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 74bad15034d9d55fb70931f38868f812160c6305..0f45f4b2486e910d11fd94b260bcd68e49eae31e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -116,14 +116,14 @@ public class CraftChunk implements Chunk { - Entity[] entities = new Entity[count]; - - for (int i = 0; i < 16; i++) { -- -- for (Object obj : chunk.entitySlices[i].toArray()) { -- if (!(obj instanceof net.minecraft.world.entity.Entity)) { -+ // Paper start - speed up (was with chunk.entitySlices[i].toArray() and cast checks which costs a lot of performance if called often) -+ for (net.minecraft.world.entity.Entity entity : chunk.entitySlices[i]) { -+ if (entity == null) { - continue; - } -- -- entities[index++] = ((net.minecraft.world.entity.Entity) obj).getBukkitEntity(); -+ entities[index++] = entity.getBukkitEntity(); - } -+ // Paper end - } - - return entities; diff --git a/patches/removed/1.17/No longer needed/0421-Fix-unregistering-entities-from-unloading-chunks.patch b/patches/removed/1.17/No longer needed/0421-Fix-unregistering-entities-from-unloading-chunks.patch deleted file mode 100644 index 0f7af54c0b..0000000000 --- a/patches/removed/1.17/No longer needed/0421-Fix-unregistering-entities-from-unloading-chunks.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Tue, 31 Mar 2020 03:01:45 -0400 -Subject: [PATCH] Fix unregistering entities from unloading chunks - -CraftBukkit caused a regression here by making unloading chunks not -have a ticket added and returning unloaded future. - -This caused entities who were killed in same tick their chunk is unloading -to not be able to be removed from the chunk. - -This then results in dead entities lingering in the Chunk. - -Combine that with a buggy detail of the previous implementation of -the Dupe UUID patch, then this was the likely source of the "Ghost entities" - -1.17: Probably not needed? - -no longer applies as entities not stored in chunks - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9898d5c8fab63c576831bd416ccf1854ed077b0d..c5dc41a3cf499038bd33451a189913cd3978b230 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1559,9 +1559,9 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - } - - private void removeFromChunk(Entity entity) { -- ChunkAccess ichunkaccess = chunkSource.getChunkUnchecked(entity.xChunk, entity.zChunk); // CraftBukkit - SPIGOT-5228: getChunkAt won't find the entity's chunk if it has already been unloaded (i.e. if it switched to state INACCESSIBLE). -+ LevelChunk ichunkaccess = entity.getCurrentChunk(); // Paper - getChunkAt(x,z,full,false) is broken by CraftBukkit as it won't return an unloading chunk. Use our current chunk reference as this points to what chunk they need to be removed from anyways - -- if (ichunkaccess instanceof LevelChunk) { -+ if (ichunkaccess != null) { // Paper - ((LevelChunk) ichunkaccess).removeEntity(entity); - } - diff --git a/patches/removed/1.17/No longer needed/0490-Don-t-mark-null-chunk-sections-for-block-updates.patch b/patches/removed/1.17/No longer needed/0490-Don-t-mark-null-chunk-sections-for-block-updates.patch deleted file mode 100644 index 167b17c93f..0000000000 --- a/patches/removed/1.17/No longer needed/0490-Don-t-mark-null-chunk-sections-for-block-updates.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm <[email protected]> -Date: Fri, 14 Aug 2020 23:41:19 +0200 -Subject: [PATCH] Don't mark null chunk sections for block updates - -no longer needed as the accessor to get chunksection handles null chunk sections - -diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 1f67c9c5f7161ea687983e7ae0ec7d259da9acd3..32bcc55ce15d832e2182d89acecd715947b1667d 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkHolder.java -+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -315,6 +315,7 @@ public class ChunkHolder { - this.a(world, blockposition, iblockdata); - } else { - LevelChunkSection chunksection = chunk.getSections()[j]; -+ if (chunksection == null) chunksection = new LevelChunkSection(sectionposition.getY(), chunk, world, true); // Paper - make a new chunk section if none was found - ClientboundSectionBlocksUpdatePacket packetplayoutmultiblockchange = new ClientboundSectionBlocksUpdatePacket(sectionposition, shortset, chunksection, this.resendLight); - - this.broadcast(packetplayoutmultiblockchange, false); diff --git a/patches/removed/1.17/No longer needed/0501-Fix-enderdragon-exp-dupe.patch b/patches/removed/1.17/No longer needed/0501-Fix-enderdragon-exp-dupe.patch deleted file mode 100644 index 33515365ec..0000000000 --- a/patches/removed/1.17/No longer needed/0501-Fix-enderdragon-exp-dupe.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf <[email protected]> -Date: Fri, 12 Jun 2020 22:25:11 -0700 -Subject: [PATCH] Fix enderdragon exp dupe - -Properly track death stage when unloading/loading in the -dragon - -1.17: Mojang fixed in 1.17(maybe before, idk) - -resolved by Mojang https://bugs.mojang.com/browse/MCPE-64818 - -diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index ec9436005a3a6fdfb4783d1092bb361224eb6414..b224a630f8adb1fa357c838e6b32c784aed0b15b 100644 ---- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -879,6 +879,7 @@ public class EnderDragon extends Mob implements Enemy { - public void addAdditionalSaveData(CompoundTag tag) { - super.addAdditionalSaveData(tag); - tag.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId()); -+ tag.putInt("Paper.DeathTick", this.dragonDeathTime); // Paper - } - - @Override -@@ -887,6 +888,7 @@ public class EnderDragon extends Mob implements Enemy { - if (tag.contains("DragonPhase")) { - this.phaseManager.setPhase(EnderDragonPhase.getById(tag.getInt("DragonPhase"))); - } -+ this.dragonDeathTime = tag.getInt("Paper.DeathTick"); // Paper - - } - diff --git a/patches/removed/1.17/No longer needed/0506-Limit-lightning-strike-effect-distance.patch b/patches/removed/1.17/No longer needed/0506-Limit-lightning-strike-effect-distance.patch deleted file mode 100644 index f29d1e4440..0000000000 --- a/patches/removed/1.17/No longer needed/0506-Limit-lightning-strike-effect-distance.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Trigary <[email protected]> -Date: Fri, 14 Sep 2018 17:42:08 +0200 -Subject: [PATCH] Limit lightning strike effect distance - -Doesnt seem to apply anymore as spigot isn't using relative distance for lightning - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 1655bca0502e7b871de4addaa163536d86547a02..978062774c1db286bfb9b0ffdef19d880b1f249b 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -646,4 +646,26 @@ public class PaperWorldConfig { - delayChunkUnloadsBy *= 20; - } - } -+ -+ public double sqrMaxThunderDistance; -+ public double sqrMaxLightningImpactSoundDistance; -+ public double maxLightningFlashDistance; -+ private void lightningStrikeDistanceLimit() { -+ sqrMaxThunderDistance = getInt("lightning-strike-distance-limit.sound", -1); -+ if (sqrMaxThunderDistance > 0) { -+ sqrMaxThunderDistance *= sqrMaxThunderDistance; -+ } -+ -+ sqrMaxLightningImpactSoundDistance = getInt("lightning-strike-distance-limit.impact-sound", -1); -+ if (sqrMaxLightningImpactSoundDistance < 0) { -+ sqrMaxLightningImpactSoundDistance = 32 * 32; //Vanilla value -+ } else { -+ sqrMaxLightningImpactSoundDistance *= sqrMaxLightningImpactSoundDistance; -+ } -+ -+ maxLightningFlashDistance = getInt("lightning-strike-distance-limit.flash", -1); -+ if (maxLightningFlashDistance < 0) { -+ maxLightningFlashDistance = 512; // Vanilla value -+ } -+ } - } -diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java -index e030e7f3d8bd9fe6578df0b560a237d494ec8a01..4b0dbeded2b8a475d32f518957909d3495a4b6fc 100644 ---- a/src/main/java/net/minecraft/world/entity/LightningBolt.java -+++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java -@@ -15,7 +15,6 @@ import net.minecraft.server.level.ServerPlayer; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.world.Difficulty; --import net.minecraft.world.entity.player.Player; - import net.minecraft.world.level.BlockGetter; - import net.minecraft.world.level.GameRules; - import net.minecraft.world.level.Level; -@@ -74,6 +73,17 @@ public class LightningBolt extends Entity { - double deltaX = this.getX() - player.getX(); - double deltaZ = this.getZ() - player.getZ(); - double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -+ // Paper start - Limit lightning strike effect distance -+ if (distanceSquared <= this.level.paperConfig.sqrMaxLightningImpactSoundDistance) { -+ player.connection.send(new ClientboundSoundPacket(SoundEvents.LIGHTNING_BOLT_IMPACT, -+ SoundSource.WEATHER, this.getX(), this.getY(), this.getZ(), 2.0f, 0.5F + this.random.nextFloat() * 0.2F)); -+ } -+ -+ if (level.paperConfig.sqrMaxThunderDistance != -1 && distanceSquared >= level.paperConfig.sqrMaxThunderDistance) { -+ continue; -+ } -+ -+ // Paper end - if (distanceSquared > viewDistance * viewDistance) { - double deltaLength = Math.sqrt(distanceSquared); - double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; -@@ -84,7 +94,7 @@ public class LightningBolt extends Entity { - } - } - // CraftBukkit end -- this.level.playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); -+// this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); // Paper - Limit lightning strike effect distance (the packet is now sent from inside the loop) - } - - --this.life; diff --git a/patches/removed/1.17/No longer needed/0541-Import-fastutil-classes.patch b/patches/removed/1.17/No longer needed/0541-Import-fastutil-classes.patch deleted file mode 100644 index 13fa459a56..0000000000 --- a/patches/removed/1.17/No longer needed/0541-Import-fastutil-classes.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm <[email protected]> -Date: Wed, 12 Aug 2020 11:33:04 +0200 -Subject: [PATCH] Import fastutil classes -1.17: YEET -we use real mappings now so a class called 'it' in nms is no longer a concern - -diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java -index 95e166aa63f42c675df645a56e313bdffc2e8663..05f7d4a3835536f26f741d54a0884bd43fc82967 100644 ---- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java -+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java -@@ -16,6 +16,7 @@ import net.minecraft.CrashReport; - import net.minecraft.ReportedException; - import net.minecraft.network.FriendlyByteBuf; - import net.minecraft.world.entity.Entity; -+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; // Paper - import org.apache.commons.lang3.ObjectUtils; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -25,7 +26,7 @@ public class SynchedEntityData { - private static final Logger LOGGER = LogManager.getLogger(); - private static final Map<Class<? extends Entity>, Integer> ENTITY_ID_POOL = Maps.newHashMap(); - private final Entity entity; -- private final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<SynchedEntityData.DataItem<?>> entries = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(); // Spigot - use better map // PAIL -+ private final Int2ObjectOpenHashMap<DataItem<?>> entries = new Int2ObjectOpenHashMap<>(); // Spigot - use better map // PAIL - // private final ReadWriteLock lock = new ReentrantReadWriteLock(); // Spigot - not required - private boolean isEmpty = true; - private boolean isDirty; diff --git a/patches/removed/1.17/No longer needed/0543-Remove-armour-stand-double-add-to-world.patch b/patches/removed/1.17/No longer needed/0543-Remove-armour-stand-double-add-to-world.patch deleted file mode 100644 index 1516cc83cb..0000000000 --- a/patches/removed/1.17/No longer needed/0543-Remove-armour-stand-double-add-to-world.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm <[email protected]> -Date: Fri, 14 Aug 2020 23:59:26 +0200 -Subject: [PATCH] Remove armour stand double add to world -1.17 Update: YEET (?) - -Applied by Mojang - -diff --git a/src/main/java/net/minecraft/world/item/ArmorStandItem.java b/src/main/java/net/minecraft/world/item/ArmorStandItem.java -index a2dfcaac8a2a4a69e703de43be76d4fe369fd647..bed063497bb593683ea384605ae1a71a68f4fc1b 100644 ---- a/src/main/java/net/minecraft/world/item/ArmorStandItem.java -+++ b/src/main/java/net/minecraft/world/item/ArmorStandItem.java -@@ -53,7 +53,7 @@ public class ArmorStandItem extends Item { - return InteractionResult.FAIL; - } - -- worldserver.addFreshEntityWithPassengers(entityarmorstand); -+ // Paper - moved down - float f = (float) Mth.floor((Mth.wrapDegrees(context.getRotation() - 180.0F) + 22.5F) / 45.0F) * 45.0F; - - entityarmorstand.moveTo(entityarmorstand.getX(), entityarmorstand.getY(), entityarmorstand.getZ(), f, 0.0F); -@@ -63,7 +63,7 @@ public class ArmorStandItem extends Item { - return InteractionResult.FAIL; - } - // CraftBukkit end -- world.addFreshEntity(entityarmorstand); -+ worldserver.addFreshEntityWithPassengers(entityarmorstand); // Paper - moved down - world.playSound((Player) null, entityarmorstand.getX(), entityarmorstand.getY(), entityarmorstand.getZ(), SoundEvents.ARMOR_STAND_PLACE, SoundSource.BLOCKS, 0.75F, 0.8F); - } - diff --git a/patches/removed/1.17/No longer needed/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch b/patches/removed/1.17/No longer needed/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch deleted file mode 100644 index 8490ec1f46..0000000000 --- a/patches/removed/1.17/No longer needed/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <[email protected]> -Date: Thu, 20 Aug 2020 19:24:13 -0700 -Subject: [PATCH] Fix MC-99259 Wither Boss Bar doesn't update until -1.17 Update: This issue is marked as fixed on 1.17 - yeet! - invulnerability period is over - -Resolved https://bugs.mojang.com/browse/MC-99259 - -diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index edd231568b75330d0cffbecb03a7e9dbc55d5f94..1f330d852eb9b3a36570542e10a88ae065798714 100644 ---- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -391,8 +391,9 @@ public class WitherBoss extends Monster implements RangedAttackMob { - this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit - } - -- this.bossEvent.setPercent(this.getHealth() / this.getMaxHealth()); -+ //this.bossBattle.setProgress(this.getHealth() / this.getMaxHealth()); // Paper - Moved down - } -+ this.bossEvent.setPercent(this.getHealth() / this.getMaxHealth()); // Paper - Fix MC-99259 (Boss bar does not update until Wither invulnerability period ends) - } - - public static boolean canDestroy(BlockState block) { diff --git a/patches/removed/1.17/No longer needed/0549-Fix-MC-197271.patch b/patches/removed/1.17/No longer needed/0549-Fix-MC-197271.patch deleted file mode 100644 index c82b3a6ca3..0000000000 --- a/patches/removed/1.17/No longer needed/0549-Fix-MC-197271.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ishland <[email protected]> -Date: Sun, 23 Aug 2020 10:57:44 +0200 -Subject: [PATCH] Fix MC-197271 -Update 1.17: Fixed in openj9-0.23.0-m2 release -This patch only fixes an issue for servers running OpenJ9. - -resolved https://bugs.mojang.com/browse/MC-197271 - -diff --git a/src/main/java/net/minecraft/data/BuiltinRegistries.java b/src/main/java/net/minecraft/data/BuiltinRegistries.java -index d64cebb4431664762a14670c7d9d782dd7894ed5..0c403ea85f7ea20f2f978e06313f8675abf204b6 100644 ---- a/src/main/java/net/minecraft/data/BuiltinRegistries.java -+++ b/src/main/java/net/minecraft/data/BuiltinRegistries.java -@@ -48,11 +48,11 @@ public class BuiltinRegistries { - public static final Registry<StructureProcessorList> PROCESSOR_LIST = registerSimple(Registry.PROCESSOR_LIST_REGISTRY, () -> { - return ProcessorLists.b; - }); -- public static final Registry<StructureTemplatePool> TEMPLATE_POOL = registerSimple(Registry.TEMPLATE_POOL_REGISTRY, Pools::bootstrap); -+ public static final Registry<StructureTemplatePool> TEMPLATE_POOL = registerSimple(Registry.TEMPLATE_POOL_REGISTRY, () -> Pools.bootstrap()); // Paper - MC-197271 - public static final Registry<Biome> BIOME = registerSimple(Registry.BIOME_REGISTRY, () -> { - return Biomes.PLAINS; - }); -- public static final Registry<NoiseGeneratorSettings> NOISE_GENERATOR_SETTINGS = registerSimple(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY, NoiseGeneratorSettings::bootstrap); -+ public static final Registry<NoiseGeneratorSettings> NOISE_GENERATOR_SETTINGS = registerSimple(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY, () -> NoiseGeneratorSettings.bootstrap()); // Paper - MC-197271 - - private static <T> Registry<T> registerSimple(ResourceKey<? extends Registry<T>> registryRef, Supplier<T> defaultValueSupplier) { - return registerSimple(registryRef, Lifecycle.stable(), defaultValueSupplier); -@@ -66,9 +66,9 @@ public class BuiltinRegistries { - ResourceLocation minecraftkey = registryRef.location(); - - BuiltinRegistries.LOADERS.put(minecraftkey, defaultValueSupplier); -- WritableRegistry<R> iregistrywritable = BuiltinRegistries.WRITABLE_REGISTRY; -+ WritableRegistry<R> iregistrywritable = (WritableRegistry<R>) BuiltinRegistries.WRITABLE_REGISTRY; // Paper - decompile fix - -- return (WritableRegistry) iregistrywritable.register(registryRef, (Object) registry, lifecycle); -+ return (R) iregistrywritable.register((ResourceKey<R>) registryRef, registry, lifecycle); // Paper - decompile fix - } - - public static <T> T register(Registry<? super T> registry, String id, T object) { -@@ -76,11 +76,11 @@ public class BuiltinRegistries { - } - - public static <V, T extends V> T register(Registry<V> registry, ResourceLocation id, T object) { -- return ((WritableRegistry) registry).register(ResourceKey.create(registry.key(), id), object, Lifecycle.stable()); -+ return (T) ((WritableRegistry) registry).register(ResourceKey.create(registry.key(), id), object, Lifecycle.stable()); // Paper - decompile fix - } - - public static <V, T extends V> T registerMapping(Registry<V> iregistry, int rawId, ResourceKey<V> resourcekey, T object) { -- return ((WritableRegistry) iregistry).registerMapping(rawId, resourcekey, object, Lifecycle.stable()); -+ return (T) ((WritableRegistry) iregistry).registerMapping(rawId, resourcekey, object, Lifecycle.stable()); // Paper - decompile fix - } - - public static void bootstrap() {} diff --git a/patches/removed/1.17/No longer needed/0550-MC-197883-Bandaid-decode-issue.patch b/patches/removed/1.17/No longer needed/0550-MC-197883-Bandaid-decode-issue.patch deleted file mode 100644 index be32d8a82f..0000000000 --- a/patches/removed/1.17/No longer needed/0550-MC-197883-Bandaid-decode-issue.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Fri, 21 Aug 2020 21:05:28 -0400 -Subject: [PATCH] MC-197883: Bandaid decode issue -1.17 Update: Marked as fixed in 1.17 on mojira, yeet -Mojang has a mix of type and name in the data sets, but you can only -use one. - -This will retry as name if type is asked for and not found. - -resolved https://bugs.mojang.com/browse/MC-197883 - -diff --git a/src/main/java/com/mojang/serialization/codecs/KeyDispatchCodec.java b/src/main/java/com/mojang/serialization/codecs/KeyDispatchCodec.java -index de7d1e5e0319c65775d932144c268c2d55bb7dc7..bd6a0e1b5454e880a4f2a16be7dc8da64b73e11d 100644 ---- a/src/main/java/com/mojang/serialization/codecs/KeyDispatchCodec.java -+++ b/src/main/java/com/mojang/serialization/codecs/KeyDispatchCodec.java -@@ -48,7 +48,12 @@ public class KeyDispatchCodec<K, V> extends MapCodec<V> { - - @Override - public <T> DataResult<V> decode(final DynamicOps<T> ops, final MapLike<T> input) { -- final T elementName = input.get(typeKey); -+ // Paper start - bandaid MC-197883 -+ T elementName = input.get(typeKey); -+ if (elementName == null && "type".equals(typeKey)) { -+ elementName = input.get("name"); -+ } -+ // Paper end - if (elementName == null) { - return DataResult.error("Input does not contain a key [" + typeKey + "]: " + input); - } diff --git a/patches/removed/1.17/No longer needed/0551-Add-warning-for-servers-not-running-on-Java-16.patch b/patches/removed/1.17/No longer needed/0551-Add-warning-for-servers-not-running-on-Java-16.patch deleted file mode 100644 index bd9e79abf5..0000000000 --- a/patches/removed/1.17/No longer needed/0551-Add-warning-for-servers-not-running-on-Java-16.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Kyle Wood <[email protected]> -Date: Wed, 2 Dec 2020 21:58:45 -0800 -Subject: [PATCH] Add warning for servers not running on Java 16 - -1.17: game requires java 16 - -diff --git a/src/main/java/io/papermc/paper/util/PaperJvmChecker.java b/src/main/java/io/papermc/paper/util/PaperJvmChecker.java -new file mode 100644 -index 0000000000000000000000000000000000000000..fdf3ff8894e5e202229d1be52fe3c92ea039ef15 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/util/PaperJvmChecker.java -@@ -0,0 +1,48 @@ -+package io.papermc.paper.util; -+ -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+import java.util.regex.Matcher; -+import java.util.regex.Pattern; -+ -+public class PaperJvmChecker { -+ -+ private static int getJvmVersion() { -+ String javaVersion = System.getProperty("java.version"); -+ final Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(javaVersion); -+ if (!matcher.find()) { -+ LogManager.getLogger().warn("Failed to determine Java version; Could not parse: {}", javaVersion); -+ return -1; -+ } -+ -+ final String version = matcher.group(1); -+ try { -+ return Integer.parseInt(version); -+ } catch (final NumberFormatException e) { -+ LogManager.getLogger().warn("Failed to determine Java version; Could not parse {} from {}", version, javaVersion, e); -+ return -1; -+ } -+ } -+ -+ public static void checkJvm() { -+ if (getJvmVersion() < 16) { -+ final Logger logger = LogManager.getLogger(); -+ logger.warn("************************************************************"); -+ logger.warn("* WARNING - YOU ARE RUNNING AN OUTDATED VERSION OF JAVA."); -+ logger.warn("* PAPER WILL STOP BEING COMPATIBLE WITH THIS VERSION OF"); -+ logger.warn("* JAVA WHEN MINECRAFT 1.17 IS RELEASED."); -+ logger.warn("*"); -+ logger.warn("* Please update the version of Java you use to run Paper"); -+ logger.warn("* to at least Java 16. When Paper for Minecraft 1.17 is"); -+ logger.warn("* released support for versions of Java before 16 will"); -+ logger.warn("* be dropped."); -+ logger.warn("*"); -+ logger.warn("* Current Java version: {}", System.getProperty("java.version")); -+ logger.warn("*"); -+ logger.warn("* Check this forum post for more information: "); -+ logger.warn("* https://papermc.io/java16"); -+ logger.warn("************************************************************"); -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9bd2255d31bcfd4574f8d1caf598f9141aa9e3c1..c7432ccffc024f171a2868b4eb0dca4860b7f8c4 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1128,6 +1128,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa - LOGGER.info("Done ({})! For help, type \"help\"", doneTime); - // Paper end - -+ io.papermc.paper.util.PaperJvmChecker.checkJvm(); // Paper jvm version nag - org.spigotmc.WatchdogThread.tick(); // Paper - org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Arrays.fill( recentTps, 20 ); diff --git a/patches/removed/1.17/No longer needed/0579-MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch b/patches/removed/1.17/No longer needed/0579-MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch deleted file mode 100644 index d54558fb30..0000000000 --- a/patches/removed/1.17/No longer needed/0579-MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: chickeneer <[email protected]> -Date: Wed, 18 Mar 2020 00:07:46 -0500 -Subject: [PATCH] MC-147729: Drop items that are extra from a crafting recipe - -1.17: Issue seems to be fixed (source: Mojira) https://bugs.mojang.com/browse/MC-147729 - -diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java -index a18aa176850bef45afcaf5742e9afbfa39281e22..c6ba6aabf94c26cccbd14689ea32373c17bbccc4 100644 ---- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java -+++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java -@@ -71,7 +71,12 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ - if (j == -1) { - j = this.inventory.getFreeSlot(); - } -- -+ // Paper start -+ if (j == -1) { -+ this.inventory.player.drop(itemstack.copy(), false); -+ break; -+ } -+ // Paper end - ItemStack itemstack1 = itemstack.copy(); - - itemstack1.setCount(1); diff --git a/patches/removed/1.17/No longer needed/0679-do-not-create-unnecessary-copies-of-passenger-list.patch b/patches/removed/1.17/No longer needed/0679-do-not-create-unnecessary-copies-of-passenger-list.patch deleted file mode 100644 index cb84c8997d..0000000000 --- a/patches/removed/1.17/No longer needed/0679-do-not-create-unnecessary-copies-of-passenger-list.patch +++ /dev/null @@ -1,240 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: lukas81298 <[email protected]> -Date: Sun, 13 Dec 2020 13:42:55 +0100 -Subject: [PATCH] do not create unnecessary copies of passenger list - -1.17: Mojang removed the copy of the passenger list from getPassengers, no longer needed - -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPassengersPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPassengersPacket.java -index a6ecb82d14ccab5d8229689a2a6cb67c579b1f71..cded79352dff0978e0d633eae9d9020b4dec1d4b 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPassengersPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPassengersPacket.java -@@ -15,7 +15,7 @@ public class ClientboundSetPassengersPacket implements Packet<ClientGamePacketLi - - public ClientboundSetPassengersPacket(Entity entity) { - this.vehicle = entity.getId(); -- List<Entity> list = entity.getPassengers(); -+ List<Entity> list = entity.passengers; // Paper - do not create a copy of the list - - this.passengers = new int[list.size()]; - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f4dd30c8b3326db72d3b3068ee2291de6f15de7c..c17e827a976f509c8294df65335f12139cd36a9f 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -2312,7 +2312,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially - list.add(entity); - } - -- if (!entity.getPassengers().isEmpty()) { -+ if (!entity.passengers.isEmpty()) { // Paper - do not copy list - list1.add(entity); - } - } -diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 75e2274578c2c28de3d786372df0b4102337a2cc..e703233db7879c73378b3a06b2e89f7fcea97979 100644 ---- a/src/main/java/net/minecraft/server/level/ServerEntity.java -+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -102,10 +102,10 @@ public class ServerEntity { - - public final void tick() { this.sendChanges(); } // Paper - OBFHELPER - public void sendChanges() { -- List<Entity> list = this.entity.getPassengers(); -+ List<Entity> list = this.entity.passengers; // Paper - do not copy list - - if (!list.equals(this.lastPassengers)) { -- this.lastPassengers = list; -+ this.lastPassengers = com.google.common.collect.ImmutableList.copyOf(list); // Paper - only copy list if something has changed - this.broadcastAndSend(new ClientboundSetPassengersPacket(this.entity)); // CraftBukkit - } - -@@ -375,7 +375,7 @@ public class ServerEntity { - } - } - -- if (!this.entity.getPassengers().isEmpty()) { -+ if (!this.entity.passengers.isEmpty()) { // Paper - do not create copy of list - consumer.accept(new ClientboundSetPassengersPacket(this.entity)); - } - -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ec30f886585d407fbd122e05107ebca44895c585..d055b362459e5b4658aa220e16118ee6174c0de4 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2233,7 +2233,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - } - - protected boolean canAddPassenger(Entity passenger) { -- return this.getPassengers().size() < 1; -+ return this.passengers.size() < 1; // Paper - do not copy list - } - - public final float getCollisionBorderSize() { return getPickRadius(); } // Paper - OBFHELPER -@@ -2329,7 +2329,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - } - - public boolean isVehicle() { -- return !this.getPassengers().isEmpty(); -+ return !this.passengers.isEmpty(); // Paper - do not copy list - } - - public boolean rideableUnderWater() { -@@ -3141,7 +3141,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - } - - public boolean hasPassenger(Entity passenger) { -- Iterator iterator = this.getPassengers().iterator(); -+ Iterator iterator = this.passengers.iterator(); // Paper - do not copy list - - Entity entity1; - -@@ -3157,7 +3157,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - } - - public boolean hasPassenger(Class<? extends Entity> clazz) { -- Iterator iterator = this.getPassengers().iterator(); -+ Iterator iterator = this.passengers.iterator(); // Paper - do not copy list - - Entity entity; - -@@ -3174,7 +3174,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - - public Collection<Entity> getIndirectPassengers() { - Set<Entity> set = Sets.newHashSet(); -- Iterator iterator = this.getPassengers().iterator(); -+ Iterator iterator = this.passengers.iterator(); // Paper - do not copy list - - while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); -@@ -3200,7 +3200,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - private void fillIndirectPassengers(boolean playersOnly, Set<Entity> output) { - Entity entity; - -- for (Iterator iterator = this.getPassengers().iterator(); iterator.hasNext(); entity.fillIndirectPassengers(playersOnly, output)) { -+ for (Iterator iterator = this.passengers.iterator(); iterator.hasNext(); entity.fillIndirectPassengers(playersOnly, output)) { // Paper - do not copy list - entity = (Entity) iterator.next(); - if (!playersOnly || ServerPlayer.class.isAssignableFrom(entity.getClass())) { - output.add(entity); -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java -index 3d919e878908e19d598d70011c44cf980676f4f8..debf53a8bf6f062a237160a7b7e0a251a9756ef6 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java -@@ -52,7 +52,7 @@ public class RunAroundLikeCrazyGoal extends Goal { - @Override - public void tick() { - if (!this.horse.isTamed() && this.horse.getRandom().nextInt(50) == 0) { -- Entity entity = (Entity) this.horse.getPassengers().get(0); -+ Entity entity = this.horse.passengers.isEmpty() ? null : this.horse.passengers.get(0); // Paper - do not copy list, fixed array out of bounds exception as well - - if (entity == null) { - return; -diff --git a/src/main/java/net/minecraft/world/entity/animal/Pig.java b/src/main/java/net/minecraft/world/entity/animal/Pig.java -index e512a38ccbba93266f0234e3b2fcf7f62693039b..7a60c0b2c301e8cb768c39ad20f273a5921428cb 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Pig.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Pig.java -@@ -85,7 +85,7 @@ public class Pig extends Animal implements ItemSteerable, Saddleable { - @Nullable - @Override - public Entity getControllingPassenger() { -- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - } - - @Override -diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java -index b298bcfb665b1036cd21445cec1518069eb08f06..5901e92a749af50166c517bda575d541554756f5 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java -+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java -@@ -971,7 +971,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, - @Nullable - @Override - public Entity getControllingPassenger() { -- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - } - - @Nullable -diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java -index e50d72c98f2ee3cd3349d2df9a0cdc47b733f7cd..ccc9d941b28ee090436a5958e1b48589d48d9d6f 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java -@@ -134,7 +134,7 @@ public class Ravager extends Raider { - @Nullable - @Override - public Entity getControllingPassenger() { -- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - } - - @Override -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 25df3ef6b96bec39847a732394af8eccdb4d5d45..23421c4964c67a963a55ce08595c8de112a2ba6e 100644 ---- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -@@ -560,7 +560,7 @@ public abstract class AbstractMinecart extends Entity { - - vec3d1 = new Vec3(d8 * d4 / d6, vec3d1.y, d8 * d5 / d6); - this.setDeltaMovement(vec3d1); -- Entity entity = this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ Entity entity = this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - - if (entity instanceof Player) { - Vec3 vec3d2 = entity.getDeltaMovement(); -diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -index e7ac3bff190c899397d6576fabbf4966878ea7e5..37f0e359ec858eebfa15d01f23a9ce0103816c8b 100644 ---- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -@@ -316,7 +316,7 @@ public class Boat extends Entity { - super.tick(); - this.tickLerp(); - if (this.isControlledByLocalInstance()) { -- if (this.getPassengers().isEmpty() || !(this.getPassengers().get(0) instanceof Player)) { -+ if (this.passengers.isEmpty() || !(this.passengers.get(0) instanceof Player)) { // Paper - do not copy list - this.setPaddleState(false, false); - } - -@@ -379,7 +379,7 @@ public class Boat extends Entity { - Entity entity = (Entity) list.get(j); - - if (!entity.hasPassenger(this)) { -- if (flag && this.getPassengers().size() < 2 && !entity.isPassenger() && entity.getBbWidth() < this.getBbWidth() && entity instanceof LivingEntity && !(entity instanceof WaterAnimal) && !(entity instanceof Player)) { -+ if (flag && this.passengers.size() < 2 && !entity.isPassenger() && entity.getBbWidth() < this.getBbWidth() && entity instanceof LivingEntity && !(entity instanceof WaterAnimal) && !(entity instanceof Player)) { // Paper - do not copy passenger list - entity.startRiding(this); - } else { - this.push(entity); -@@ -726,8 +726,8 @@ public class Boat extends Entity { - float f = 0.0F; - float f1 = (float) ((this.removed ? 0.009999999776482582D : this.getPassengersRidingOffset()) + passenger.getMyRidingOffset()); - -- if (this.getPassengers().size() > 1) { -- int i = this.getPassengers().indexOf(passenger); -+ if (this.passengers.size() > 1) { // Paper - do not copy list -+ int i = this.passengers.indexOf(passenger); // Paper - do not copy list - - if (i == 0) { - f = 0.2F; -@@ -746,7 +746,7 @@ public class Boat extends Entity { - passenger.yRot += this.deltaRotation; - passenger.setYHeadRot(passenger.getYHeadRot() + this.deltaRotation); - this.clampRotation(passenger); -- if (passenger instanceof Animal && this.getPassengers().size() > 1) { -+ if (passenger instanceof Animal && this.passengers.size() > 1) { // Paper - do not copy list - int j = passenger.getId() % 2 == 0 ? 90 : 270; - - passenger.setYBodyRot(((Animal) passenger).yBodyRot + (float) j); -@@ -906,13 +906,13 @@ public class Boat extends Entity { - - @Override - protected boolean canAddPassenger(Entity passenger) { -- return this.getPassengers().size() < 2 && !this.isEyeInFluid((Tag) FluidTags.WATER); -+ return this.passengers.size() < 2 && !this.isEyeInFluid((Tag) FluidTags.WATER); // Paper - do not copy list - } - - @Nullable - @Override - public Entity getControllingPassenger() { -- List<Entity> list = this.getPassengers(); -+ List<Entity> list = this.passengers; // Paper - do not copy list - - return list.isEmpty() ? null : (Entity) list.get(0); - } diff --git a/patches/removed/1.17/No longer needed/0706-don-t-throw-when-loading-invalid-TEs.patch b/patches/removed/1.17/No longer needed/0706-don-t-throw-when-loading-invalid-TEs.patch deleted file mode 100644 index da8d3dfaa5..0000000000 --- a/patches/removed/1.17/No longer needed/0706-don-t-throw-when-loading-invalid-TEs.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder <[email protected]> -Date: Tue, 20 Apr 2021 01:15:04 +0100 -Subject: [PATCH] don't throw when loading invalid TEs - -1.17: Mojang catches the exception - -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 05fa76c02ce61e26891ad995fe89e925ea086557..b7ebb213efd759253f0042f77e11f2a8102ea6ca 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 -@@ -2,6 +2,7 @@ package net.minecraft.world.level.block.entity; - - import javax.annotation.Nullable; - import net.minecraft.CrashReportCategory; -+import net.minecraft.ResourceLocationException; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Registry; - import net.minecraft.nbt.CompoundTag; -@@ -133,7 +134,13 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { - public static BlockEntity loadStatic(BlockState state, CompoundTag tag) { - String s = tag.getString("id"); - -- return (BlockEntity) Registry.BLOCK_ENTITY_TYPE.getOptional(new ResourceLocation(s)).map((tileentitytypes) -> { -+ // Paper -+ ResourceLocation minecraftKey = null; -+ try { -+ minecraftKey = new ResourceLocation(s); -+ } catch (ResourceLocationException ex) {} -+ // Paper end -+ return (BlockEntity) Registry.BLOCK_ENTITY_TYPE.getOptional(minecraftKey).map((tileentitytypes) -> { - try { - return tileentitytypes.create(); - } catch (Throwable throwable) { diff --git a/patches/removed/1.17/No longer needed/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch b/patches/removed/1.17/No longer needed/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch deleted file mode 100644 index 58711e1c47..0000000000 --- a/patches/removed/1.17/No longer needed/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SamB440 <[email protected]> -Date: Fri, 21 May 2021 00:22:09 +0100 -Subject: [PATCH] Fix MC-148809: Increase structure block data length to 128 - -Fixed in 1.17 - mojira issue marked as resolved - -diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetStructureBlockPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetStructureBlockPacket.java -index 4c797dd82bb1989861e350a7e628eb847b58bbd8..4792aafd8d992cd64d05f8bbef5cbf30988949ed 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetStructureBlockPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetStructureBlockPacket.java -@@ -43,7 +43,7 @@ public class ServerboundSetStructureBlockPacket implements Packet<ServerGamePack - this.size = new BlockPos(Mth.clamp(buf.readByte(), 0, 48), Mth.clamp(buf.readByte(), 0, 48), Mth.clamp(buf.readByte(), 0, 48)); - this.mirror = (Mirror) buf.readEnum(Mirror.class); - this.rotation = (Rotation) buf.readEnum(Rotation.class); -- this.data = buf.readUtf(12); -+ this.data = buf.readUtf(128); // Paper - Fix MC-148809, increase max character input to 128 - this.integrity = Mth.clamp(buf.readFloat(), 0.0F, 1.0F); - this.seed = buf.readVarLong(); - byte b0 = buf.readByte(); |