diff --git a/removed/1.16/0311-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch similarity index 64% rename from removed/1.16/0311-Limit-lightning-strike-effect-distance.patch rename to Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch index 417f5f643..01281d012 100644 --- a/removed/1.16/0311-Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/0521-Limit-lightning-strike-effect-distance.patch @@ -5,13 +5,14 @@ Subject: [PATCH] Limit lightning strike effect distance diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 487b0d5cd608e84a793eba5fdbd50a9f3d95c79b..b8789c8ecc5a6e4117bb7ce0d5487a6e5774b67f 100644 +index 0f4fca90fd6c3788a5762c96c344899cb1665466..4a59d42b778e681e93f1243ecd16c5cf46160b97 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -242,6 +242,28 @@ public class PaperWorldConfig { +@@ -648,4 +648,26 @@ public class PaperWorldConfig { + delayChunkUnloadsBy *= 20; } } - ++ + public double sqrMaxThunderDistance; + public double sqrMaxLightningImpactSoundDistance; + public double maxLightningFlashDistance; @@ -33,22 +34,19 @@ index 487b0d5cd608e84a793eba5fdbd50a9f3d95c79b..b8789c8ecc5a6e4117bb7ce0d5487a6e + maxLightningFlashDistance = 512; // Vanilla value + } + } -+ - public int fixedInhabitedTime; - private void fixedInhabitedTime() { - if (PaperConfig.version < 16) { + } diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java -index 7c518983a9c21a9b221e1fa1b0baa3d5c9ccadbf..bdb534deb47a945d5cbfad688eeab5e3388a4df5 100644 +index 6f979e5f1f1567b140e9689298aff85de34f7413..ebcb9f48f47d1ab1e972bed1bc7cb0ee305a29f2 100644 --- a/src/main/java/net/minecraft/server/EntityLightning.java +++ b/src/main/java/net/minecraft/server/EntityLightning.java -@@ -64,6 +64,17 @@ public class EntityLightning extends Entity { +@@ -56,6 +56,17 @@ public class EntityLightning extends Entity { double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; + // Paper start - Limit lightning strike effect distance + if (distanceSquared <= this.world.paperConfig.sqrMaxLightningImpactSoundDistance) { + player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, -+ SoundCategory.WEATHER, this.locX(), this.locY(), this.locZ(), 2.0f, 0.5F + this.random.nextFloat() * 0.2F)); ++ SoundCategory.WEATHER, this.locX(), this.locY(), this.locZ(), 2.0f, 0.5F + this.random.nextFloat() * 0.2F)); + } + + if (world.paperConfig.sqrMaxThunderDistance != -1 && distanceSquared >= world.paperConfig.sqrMaxThunderDistance) { @@ -59,25 +57,12 @@ index 7c518983a9c21a9b221e1fa1b0baa3d5c9ccadbf..bdb534deb47a945d5cbfad688eeab5e3 if (distanceSquared > viewDistance * viewDistance) { double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance; -@@ -74,7 +85,7 @@ public class EntityLightning extends Entity { +@@ -66,7 +77,7 @@ public class EntityLightning extends Entity { } } // CraftBukkit end - 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); -+ //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.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.lifeTicks; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 6e878c9b9dee511812df5ea2491d953f677c3f58..271a1ef3d0aae7c1d0b373963504e70f2843cd24 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1276,7 +1276,7 @@ public class WorldServer extends World { - } - // CraftBukkit end - this.globalEntityList.add(entitylightning); -- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension -+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), paperConfig.maxLightningFlashDistance, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension, limit lightning strike effect distance - } - - @Override diff --git a/removed/1.16/0524-Add-permission-for-command-blocks.patch b/Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch similarity index 85% rename from removed/1.16/0524-Add-permission-for-command-blocks.patch rename to Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch index 0a39da8a7..62c5a9bc1 100644 --- a/removed/1.16/0524-Add-permission-for-command-blocks.patch +++ b/Spigot-Server-Patches/0522-Add-permission-for-command-blocks.patch @@ -5,58 +5,58 @@ Subject: [PATCH] Add permission for command blocks diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java -index d0f75c8f93d3ceb1ee358baeb51f64e7e575bbc0..48cc48bd999c02268fa3270401c0df77a327ab13 100644 +index dd7066d1a72f5c6f54c1f40a7b694deb827410dc..6b353a99c04e0312f520f8559c05ddaf51c26aaf 100644 --- a/src/main/java/net/minecraft/server/BlockCommand.java +++ b/src/main/java/net/minecraft/server/BlockCommand.java -@@ -110,7 +110,7 @@ public class BlockCommand extends BlockTileEntity { +@@ -105,7 +105,7 @@ public class BlockCommand extends BlockTileEntity { public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) { TileEntity tileentity = world.getTileEntity(blockposition); - if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) { + if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission entityhuman.a((TileEntityCommand) tileentity); - return EnumInteractionResult.SUCCESS; + return EnumInteractionResult.a(world.isClientSide); } else { diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -index ef2a496eda45ae5ee8fe52ef09e77c2906069d2e..6a0d70033b4eec384795b5cccd76bce2265ffbfc 100644 +index 7e13b1cf6d92c3e0f2dab1ba1d42bd4f250e256c..3820acd65f3cd488dba964e6d9c458852570f4a0 100644 --- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java +++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -178,7 +178,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { +@@ -179,7 +179,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { } - public boolean a(EntityHuman entityhuman) { + public EnumInteractionResult a(EntityHuman entityhuman) { - if (!entityhuman.isCreativeAndOp()) { + if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - return false; + return EnumInteractionResult.PASS; } else { if (entityhuman.getWorld().isClientSide) { diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 1f9d231fb93e30286205f7a0a4c898a0e153bd95..d52fbda79fe1c52d3ddb53c0f1c1f521d7620702 100644 +index eeb870107031b38e25b5fb85ea731a7db1d6c2d1..103bda41422f0db700b150116c1417736823e763 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -612,7 +612,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -613,7 +613,7 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandblock, this, this.player.getWorldServer()); if (!this.minecraftServer.getEnableCommandBlock()) { - this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0])); + this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); - } else if (!this.player.isCreativeAndOp()) { + } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0])); + this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); } else { CommandBlockListenerAbstract commandblocklistenerabstract = null; -@@ -675,7 +675,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -676,7 +676,7 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandminecart, this, this.player.getWorldServer()); if (!this.minecraftServer.getEnableCommandBlock()) { - this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0])); + this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); - } else if (!this.player.isCreativeAndOp()) { + } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0])); + this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); } else { CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world); diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index f11ef84df85c1e7ada9c62247b7882f19ae32089..6df8434612d4afe411b2c435f4c847b9183570f8 100644 +index 734855c1db3215d90b2743988f64af68aacb388e..6d192b27440ddfd34555005dafefbce6bbb67236 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -350,7 +350,7 @@ public class PlayerInteractManager { +@@ -353,7 +353,7 @@ public class PlayerInteractManager { TileEntity tileentity = this.world.getTileEntity(blockposition); Block block = iblockdata.getBlock(); diff --git a/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch b/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch new file mode 100644 index 000000000..ddd688175 --- /dev/null +++ b/Spigot-Server-Patches/0523-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -0,0 +1,129 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 10 May 2020 22:12:46 -0400 +Subject: [PATCH] Ensure Entity AABB's are never invalid + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index b11383b35662b1e59b89e916e55340cee2726944..2aa40f2a41e21526eb86acd903de024665109ab6 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -1,53 +1,54 @@ + package net.minecraft.server; + ++import co.aikar.timings.MinecraftTimings; ++import co.aikar.timings.Timing; + import com.google.common.collect.Iterables; + import com.google.common.collect.Lists; + import com.google.common.collect.Sets; + import it.unimi.dsi.fastutil.objects.Object2DoubleArrayMap; + import it.unimi.dsi.fastutil.objects.Object2DoubleMap; +-import java.util.Arrays; +-import java.util.Collection; +-import java.util.Collections; +-import java.util.Iterator; +-import java.util.List; +-import java.util.Locale; +-import java.util.Optional; +-import java.util.Random; +-import java.util.Set; +-import java.util.UUID; +-import java.util.concurrent.atomic.AtomicInteger; +-import java.util.stream.Stream; +-import javax.annotation.Nullable; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +- +-// CraftBukkit start + import org.bukkit.Bukkit; + import org.bukkit.Server; + import org.bukkit.block.BlockFace; + import org.bukkit.command.CommandSender; +-import org.bukkit.entity.Hanging; +-import org.bukkit.entity.LivingEntity; +-import org.bukkit.entity.Vehicle; +-import co.aikar.timings.MinecraftTimings; // Paper +-import co.aikar.timings.Timing; // Paper +-import org.bukkit.event.entity.EntityCombustByEntityEvent; +-import org.bukkit.event.hanging.HangingBreakByEntityEvent; +-import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; +-import org.bukkit.event.vehicle.VehicleEnterEvent; +-import org.bukkit.event.vehicle.VehicleExitEvent; + import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.entity.CraftEntity; + import org.bukkit.craftbukkit.entity.CraftPlayer; + import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.entity.Hanging; ++import org.bukkit.entity.LivingEntity; + import org.bukkit.entity.Pose; ++import org.bukkit.entity.Vehicle; + import org.bukkit.event.entity.EntityAirChangeEvent; ++import org.bukkit.event.entity.EntityCombustByEntityEvent; + import org.bukkit.event.entity.EntityCombustEvent; + import org.bukkit.event.entity.EntityDropItemEvent; + import org.bukkit.event.entity.EntityPortalEvent; + import org.bukkit.event.entity.EntityPoseChangeEvent; ++import org.bukkit.event.hanging.HangingBreakByEntityEvent; + import org.bukkit.event.player.PlayerTeleportEvent; ++import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; ++import org.bukkit.event.vehicle.VehicleEnterEvent; ++import org.bukkit.event.vehicle.VehicleExitEvent; + import org.bukkit.plugin.PluginManager; ++ ++import javax.annotation.Nullable; ++import java.util.Arrays; ++import java.util.Collection; ++import java.util.Collections; ++import java.util.Iterator; ++import java.util.List; ++import java.util.Locale; ++import java.util.Optional; ++import java.util.Random; ++import java.util.Set; ++import java.util.UUID; ++import java.util.concurrent.atomic.AtomicInteger; ++import java.util.stream.Stream; ++ ++// CraftBukkit start + // CraftBukkit end + + public abstract class Entity implements INamableTileEntity, ICommandListener, KeyedObject { // Paper +@@ -425,10 +426,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + + public void setPosition(double d0, double d1, double d2) { + this.setPositionRaw(d0, d1, d2); +- float f = this.size.width / 2.0F; +- float f1 = this.size.height; ++ // Paper start - move into setPositionRaw ++ //float f = this.size.width / 2.0F; ++ //float f1 = this.size.height; + +- this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ //this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ // Paper end + if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit + } + +@@ -2901,6 +2904,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + return new AxisAlignedBB(vec3d, vec3d1); + } + ++ public final void setBoundingBox(AxisAlignedBB axisalignedbb) { a(axisalignedbb); } // Paper - OBFHELPER + public void a(AxisAlignedBB axisalignedbb) { + // CraftBukkit start - block invalid bounding boxes + double minX = axisalignedbb.minX, +@@ -3339,6 +3343,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + } + + public void setPositionRaw(double d0, double d1, double d2) { ++ // Paper start - never allow AABB to become desynced from position ++ // hanging has its own special logic ++ if (!(this instanceof EntityHanging) && (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2)) { ++ float f = this.size.width / 2.0F; ++ float f1 = this.size.height; ++ this.setBoundingBox(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ } ++ // Paper end + if (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2) { + this.loc = new Vec3D(d0, d1, d2); + int i = MathHelper.floor(d0); diff --git a/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch b/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch new file mode 100644 index 000000000..7aa9002a7 --- /dev/null +++ b/Spigot-Server-Patches/0524-Optimize-WorldBorder-collision-checks-and-air.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sun, 10 May 2020 22:49:05 -0400 +Subject: [PATCH] Optimize WorldBorder collision checks and air + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 2aa40f2a41e21526eb86acd903de024665109ab6..38887c1b7849926fab0a3b2db0e7b81388364172 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -854,7 +854,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + AxisAlignedBB axisalignedbb = this.getBoundingBox(); + VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); + VoxelShape voxelshape = this.world.getWorldBorder().c(); +- Stream stream = VoxelShapes.c(voxelshape, VoxelShapes.a(axisalignedbb.shrink(1.0E-7D)), OperatorBoolean.AND) ? Stream.empty() : Stream.of(voxelshape); ++ Stream stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(voxelshape); // Paper + Stream stream1 = this.world.c(this, axisalignedbb.b(vec3d), (entity) -> { + return true; + }); +diff --git a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +index ed0f3ddbcb7d6ce8a59ae3829f4cb11ae75046cb..e841611bb7c36dffec44bb9e74a0a9657a113263 100644 +--- a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java ++++ b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +@@ -128,10 +128,10 @@ public class VoxelShapeSpliterator extends AbstractSpliterator { + AxisAlignedBB axisalignedbb = this.a.getBoundingBox(); + + if (!a(worldborder, axisalignedbb)) { +- VoxelShape voxelshape = worldborder.c(); +- +- if (!b(voxelshape, axisalignedbb) && a(voxelshape, axisalignedbb)) { +- consumer.accept(voxelshape); ++ // Paper start ++ if (worldborder.isInBounds(axisalignedbb.shrink(1.0E-7D)) && !worldborder.isInBounds(axisalignedbb.grow(1.0E-7D))) { ++ consumer.accept(worldborder.asVoxelShape()); ++ // Paper end + return true; + } + } +diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java +index aeee4f11828e54ff9e873e452e19299822b1ec86..1fa7061f7adb539b6786fa11a0090f2c188ba9f2 100644 +--- a/src/main/java/net/minecraft/server/VoxelShapes.java ++++ b/src/main/java/net/minecraft/server/VoxelShapes.java +@@ -242,7 +242,7 @@ public final class VoxelShapes { + IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition_mutableblockposition); // Paper + if (iblockdata == null) return 0.0D; // Paper + +- if ((k2 != 1 || iblockdata.d()) && (k2 != 2 || iblockdata.a(Blocks.MOVING_PISTON))) { ++ if (!iblockdata.isAir() && (k2 != 1 || iblockdata.d()) && (k2 != 2 || iblockdata.a(Blocks.MOVING_PISTON))) { // Paper + d0 = iblockdata.b((IBlockAccess) iworldreader, blockposition_mutableblockposition, voxelshapecollision).a(enumdirection_enumaxis2, axisalignedbb.d((double) (-blockposition_mutableblockposition.getX()), (double) (-blockposition_mutableblockposition.getY()), (double) (-blockposition_mutableblockposition.getZ())), d0); + if (Math.abs(d0) < 1.0E-7D) { + return 0.0D; +diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java +index 0ef92a320d132b443e76276b2c34a4626cf187db..b651eb87bb23deeb2a3f4a1c626ddde9b11a7b9e 100644 +--- a/src/main/java/net/minecraft/server/WorldBorder.java ++++ b/src/main/java/net/minecraft/server/WorldBorder.java +@@ -42,6 +42,7 @@ public class WorldBorder { + return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); + } + ++ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER + public boolean a(AxisAlignedBB axisalignedbb) { + return axisalignedbb.maxX > this.e() && axisalignedbb.minX < this.g() && axisalignedbb.maxZ > this.f() && axisalignedbb.minZ < this.h(); + } diff --git a/removed/1.16/0274-Allow-disabling-armour-stand-ticking.patch b/removed/1.16/0274-Allow-disabling-armour-stand-ticking.patch deleted file mode 100644 index dca49d795..000000000 --- a/removed/1.16/0274-Allow-disabling-armour-stand-ticking.patch +++ /dev/null @@ -1,278 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kashike -Date: Wed, 15 Aug 2018 01:26:09 -0700 -Subject: [PATCH] Allow disabling armour stand ticking - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index eaaa51e4bf761f41fd516402ce1ad0f903c6ab71..bc3df01aab3e79be9c2836820e0eacc69ea6c1f4 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -393,4 +393,10 @@ public class PaperWorldConfig { - private void armorStandEntityLookups() { - armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); - } -+ -+ public boolean armorStandTick = true; -+ private void armorStandTick() { -+ this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); -+ log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); -+ } - } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 61d7d507aaac3e7e5a885387ae89c67dfb1c9844..42b9a339e9c35db596ec78881c32c801c2d739f4 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -44,6 +44,12 @@ public class EntityArmorStand extends EntityLiving { - public Vector3f leftLegPose; - public Vector3f rightLegPose; - public boolean canMove = true; // Paper -+ // Paper start - Allow ArmorStands not to tick -+ public boolean canTick = true; -+ public boolean canTickSetByAPI = false; -+ private boolean noTickPoseDirty = false; -+ private boolean noTickEquipmentDirty = false; -+ // Paper end - - public EntityArmorStand(EntityTypes entitytypes, World world) { - super(entitytypes, world); -@@ -55,6 +61,7 @@ public class EntityArmorStand extends EntityLiving { - this.rightArmPose = EntityArmorStand.bu; - this.leftLegPose = EntityArmorStand.bv; - this.rightLegPose = EntityArmorStand.bw; -+ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking - this.H = 0.0F; - } - -@@ -135,6 +142,7 @@ public class EntityArmorStand extends EntityLiving { - this.armorItems.set(enumitemslot.b(), itemstack); - } - -+ this.noTickEquipmentDirty = true; // Paper - Allow equipment to be updated even when tick disabled - } - - @Override -@@ -215,6 +223,7 @@ public class EntityArmorStand extends EntityLiving { - } - - nbttagcompound.set("Pose", this.B()); -+ if (this.canTickSetByAPI) nbttagcompound.setBoolean("Paper.CanTickOverride", this.canTick); // Paper - persist no tick setting - } - - @Override -@@ -246,6 +255,12 @@ public class EntityArmorStand extends EntityLiving { - this.setBasePlate(nbttagcompound.getBoolean("NoBasePlate")); - this.setMarker(nbttagcompound.getBoolean("Marker")); - this.noclip = !this.A(); -+ // Paper start - persist no tick -+ if (nbttagcompound.hasKey("Paper.CanTickOverride")) { -+ this.canTick = nbttagcompound.getBoolean("Paper.CanTickOverride"); -+ this.canTickSetByAPI = true; -+ } -+ // Paper end - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Pose"); - - this.g(nbttagcompound1); -@@ -600,7 +615,29 @@ public class EntityArmorStand extends EntityLiving { - - @Override - public void tick() { -+ // Paper start -+ if (!this.canTick) { -+ if (this.noTickPoseDirty) { -+ this.noTickPoseDirty = false; -+ this.updatePose(); -+ } -+ -+ if (this.noTickEquipmentDirty) { -+ this.noTickEquipmentDirty = false; -+ this.updateEntityEquipment(); -+ } -+ -+ return; -+ } -+ // Paper end -+ - super.tick(); -+ // Paper start - Split into separate method -+ updatePose(); -+ } -+ -+ public void updatePose() { -+ // Paper end - Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.c); - - if (!this.headPose.equals(vector3f)) { -@@ -723,31 +760,37 @@ public class EntityArmorStand extends EntityLiving { - public void setHeadPose(Vector3f vector3f) { - this.headPose = vector3f; - this.datawatcher.set(EntityArmorStand.c, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setBodyPose(Vector3f vector3f) { - this.bodyPose = vector3f; - this.datawatcher.set(EntityArmorStand.d, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setLeftArmPose(Vector3f vector3f) { - this.leftArmPose = vector3f; - this.datawatcher.set(EntityArmorStand.e, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setRightArmPose(Vector3f vector3f) { - this.rightArmPose = vector3f; - this.datawatcher.set(EntityArmorStand.f, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setLeftLegPose(Vector3f vector3f) { - this.leftLegPose = vector3f; - this.datawatcher.set(EntityArmorStand.g, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public void setRightLegPose(Vector3f vector3f) { - this.rightLegPose = vector3f; - this.datawatcher.set(EntityArmorStand.bp, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - } - - public Vector3f r() { -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index a4051c1f0cdcf179e7afe60d301982412da7ed64..990aea604d02db723193722ed692c3a3725f987d 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2329,52 +2329,7 @@ public abstract class EntityLiving extends Entity { - } - } - -- EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); -- int k = aenumitemslot.length; -- -- for (int l = 0; l < k; ++l) { -- EnumItemSlot enumitemslot = aenumitemslot[l]; -- ItemStack itemstack; -- -- switch (enumitemslot.a()) { -- case HAND: -- itemstack = (ItemStack) this.bu.get(enumitemslot.b()); -- break; -- case ARMOR: -- itemstack = (ItemStack) this.bv.get(enumitemslot.b()); -- break; -- default: -- continue; -- } -- -- ItemStack itemstack1 = this.getEquipment(enumitemslot); -- -- if (!ItemStack.matches(itemstack1, itemstack)) { -- // Paper start - PlayerArmorChangeEvent -- if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { -- final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -- final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); -- new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); -- } -- // Paper end -- ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); -- if (!itemstack.isEmpty()) { -- this.getAttributeMap().a(itemstack.a(enumitemslot)); -- } -- -- if (!itemstack1.isEmpty()) { -- this.getAttributeMap().b(itemstack1.a(enumitemslot)); -- } -- -- switch (enumitemslot.a()) { -- case HAND: -- this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack()); -- break; -- case ARMOR: -- this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack()); -- } -- } -- } -+ updateEntityEquipment(); // Paper - split into own method - - if (this.ticksLived % 20 == 0) { - this.getCombatTracker().g(); -@@ -2475,6 +2430,55 @@ public abstract class EntityLiving extends Entity { - } - } - -+ // Paper start - split into own method from above -+ public void updateEntityEquipment() { -+ EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); -+ int k = aenumitemslot.length; -+ for (int l = 0; l < k; ++l) { -+ EnumItemSlot enumitemslot = aenumitemslot[l]; -+ ItemStack itemstack; -+ -+ switch (enumitemslot.a()) { -+ case HAND: -+ itemstack = (ItemStack) this.bu.get(enumitemslot.b()); -+ break; -+ case ARMOR: -+ itemstack = (ItemStack) this.bv.get(enumitemslot.b()); -+ break; -+ default: -+ continue; -+ } -+ -+ ItemStack itemstack1 = this.getEquipment(enumitemslot); -+ -+ if (!ItemStack.matches(itemstack1, itemstack)) { -+ // Paper start - PlayerArmorChangeEvent -+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { -+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); -+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); -+ } -+ // Paper end -+ ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); -+ if (!itemstack.isEmpty()) { -+ this.getAttributeMap().a(itemstack.a(enumitemslot)); -+ } -+ -+ if (!itemstack1.isEmpty()) { -+ this.getAttributeMap().b(itemstack1.a(enumitemslot)); -+ } -+ -+ switch (enumitemslot.a()) { -+ case HAND: -+ this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack()); -+ break; -+ case ARMOR: -+ this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack()); -+ } -+ } -+ } -+ } -+ - protected float f(float f, float f1) { - float f2 = MathHelper.g(f - this.aI); - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index d1d689e5d78c569313c4059c4652724605dc07d2..ac105270d5c7e2070f52782fc7dbdcd381db33a5 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -@@ -297,5 +297,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { - public boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot) { - return getHandle().isSlotDisabled(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot)); - } -+ -+ @Override -+ public boolean canTick() { -+ return this.getHandle().canTick; -+ } -+ -+ @Override -+ public void setCanTick(final boolean tick) { -+ this.getHandle().canTick = tick; -+ this.getHandle().canTickSetByAPI = true; -+ } - // Paper end - } diff --git a/removed/1.16/0513-Ensure-Entity-AABB-s-are-never-invalid.patch b/removed/1.16/0513-Ensure-Entity-AABB-s-are-never-invalid.patch deleted file mode 100644 index ed3bac400..000000000 --- a/removed/1.16/0513-Ensure-Entity-AABB-s-are-never-invalid.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 10 May 2020 22:12:46 -0400 -Subject: [PATCH] Ensure Entity AABB's are never invalid - -If anything used setPositionRaw, it left potential for an AABB -to be left stale at their old location, which could cause massive -AABB boxes if movement ever then got called on the new position. - -This guarantees any time we set the entities position, we also -update their AABB. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b176dc26d15065aebc91c75e8a96745f589c0b87..c81b9d814d50a026872d2711f76649c00d65888b 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -416,10 +416,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - - public void setPosition(double d0, double d1, double d2) { - this.setPositionRaw(d0, d1, d2); -- float f = this.size.width / 2.0F; -- float f1 = this.size.height; -- -- this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ // Paper start - move into setPositionRaw -+ //float f = this.size.width / 2.0F; -+ //float f1 = this.size.height; -+ //this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ // Paper end - if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit - } - -@@ -2981,6 +2982,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - return new AxisAlignedBB(vec3d, vec3d1); - } - -+ public final void setBoundingBox(AxisAlignedBB axisalignedbb) { a(axisalignedbb); } // Paper - OBFHELPER - public void a(AxisAlignedBB axisalignedbb) { - // CraftBukkit start - block invalid bounding boxes - double minX = axisalignedbb.minX, -@@ -3439,6 +3441,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - public void setPositionRaw(double d0, double d1, double d2) { -+ // Paper start - never allow AABB to become desynced from position -+ // hanging has its own special logic -+ if (!(this instanceof EntityHanging) && (locX != d0 || locY != d1 || locZ != d2)) { -+ float f = this.size.width / 2.0F; -+ float f1 = this.size.height; -+ this.setBoundingBox(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ } -+ // Paper end - this.locX = d0; - this.locY = d1; - this.locZ = d2; diff --git a/removed/1.16/0516-Optimize-WorldBorder-collision-checks-and-air.patch b/removed/1.16/0516-Optimize-WorldBorder-collision-checks-and-air.patch deleted file mode 100644 index 25658a705..000000000 --- a/removed/1.16/0516-Optimize-WorldBorder-collision-checks-and-air.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sun, 10 May 2020 22:49:05 -0400 -Subject: [PATCH] Optimize WorldBorder collision checks and air - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index c81b9d814d50a026872d2711f76649c00d65888b..e0ab058bf947ea10b37eadf6122292e708bd3809 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -845,7 +845,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - AxisAlignedBB axisalignedbb = this.getBoundingBox(); - VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); - VoxelShape voxelshape = this.world.getWorldBorder().a(); -- Stream stream = VoxelShapes.c(voxelshape, VoxelShapes.a(axisalignedbb.shrink(1.0E-7D)), OperatorBoolean.AND) ? Stream.empty() : Stream.of(voxelshape); -+ Stream stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(this.world.getWorldBorder().a()); // Paper - Stream stream1 = this.world.b(this, axisalignedbb.a(vec3d), (Set) ImmutableSet.of()); - StreamAccumulator streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream)); - Vec3D vec3d1 = vec3d.g() == 0.0D ? vec3d : a(this, vec3d, axisalignedbb, this.world, voxelshapecollision, streamaccumulator); -diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index 5a21205a49606b294de4cd27b60438c6a5b3c526..63dd5e98b6af1d9a9fa9d01621ce5bc33c0d7502 100644 ---- a/src/main/java/net/minecraft/server/ICollisionAccess.java -+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -95,12 +95,12 @@ public interface ICollisionAccess extends IBlockAccess { - if (true) { //public boolean tryAdvance(Consumer consumer) {*/ // Paper - if (entity != null) { - // Paper end -- VoxelShape voxelshape1 = ICollisionAccess.this.getWorldBorder().a(); -- boolean flag = VoxelShapes.c(voxelshape1, VoxelShapes.a(entity.getBoundingBox().shrink(1.0E-7D)), OperatorBoolean.AND); -- boolean flag1 = VoxelShapes.c(voxelshape1, VoxelShapes.a(entity.getBoundingBox().g(1.0E-7D)), OperatorBoolean.AND); -+ //VoxelShape voxelshape1 = ICollisionAccess.this.getWorldBorder().a(); // Paper - only make if collides -+ boolean flag = !ICollisionAccess.this.getWorldBorder().isInBounds(entity.getBoundingBox().shrink(1.0E-7D)); // Paper -+ boolean flag1 = !ICollisionAccess.this.getWorldBorder().isInBounds(entity.getBoundingBox().g(1.0E-7D)); // Paper - - if (!flag && flag1) { -- collisions.add(voxelshape1);// Paper -+ collisions.add(ICollisionAccess.this.getWorldBorder().a());// Paper - if (returnFast) return collisions; - } - } -@@ -133,7 +133,7 @@ public interface ICollisionAccess extends IBlockAccess { - //IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition); // moved up - // Paper end - -- if ((j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { -+ if (!iblockdata.isAir() && (j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { // Paper - fast track air - VoxelShape voxelshape2 = iblockdata.b((IBlockAccess) ICollisionAccess.this, blockposition_mutableblockposition, voxelshapecollision); - - // Paper start - Lithium Collision Optimizations -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 4c20db5a3f9e159997a9851691aca421241d6d95..535d08ffb1d20570b19307c8619cfd39b4541356 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -40,6 +40,7 @@ public class WorldBorder { - return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f(); - } - -+ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER - public boolean a(AxisAlignedBB axisalignedbb) { - return axisalignedbb.maxX > this.c() && axisalignedbb.minX < this.e() && axisalignedbb.maxZ > this.d() && axisalignedbb.minZ < this.f(); - } diff --git a/removed/1.16/0276-Send-nearby-packets-from-world-player-list-not-serve.patch b/removed/1.16/No longer Needed/0276-Send-nearby-packets-from-world-player-list-not-serve.patch similarity index 100% rename from removed/1.16/0276-Send-nearby-packets-from-world-player-list-not-serve.patch rename to removed/1.16/No longer Needed/0276-Send-nearby-packets-from-world-player-list-not-serve.patch diff --git a/removed/1.16/0401-Fix-zero-tick-instant-grow-farms-MC-113809.patch b/removed/1.16/No longer Needed/0401-Fix-zero-tick-instant-grow-farms-MC-113809.patch similarity index 100% rename from removed/1.16/0401-Fix-zero-tick-instant-grow-farms-MC-113809.patch rename to removed/1.16/No longer Needed/0401-Fix-zero-tick-instant-grow-farms-MC-113809.patch diff --git a/removed/1.16/0412-Fix-spawn-radius-being-treated-as-0.patch b/removed/1.16/No longer Needed/0412-Fix-spawn-radius-being-treated-as-0.patch similarity index 100% rename from removed/1.16/0412-Fix-spawn-radius-being-treated-as-0.patch rename to removed/1.16/No longer Needed/0412-Fix-spawn-radius-being-treated-as-0.patch diff --git a/removed/1.16/0429-Seed-based-feature-search.patch b/removed/1.16/No longer Needed/0429-Seed-based-feature-search.patch similarity index 100% rename from removed/1.16/0429-Seed-based-feature-search.patch rename to removed/1.16/No longer Needed/0429-Seed-based-feature-search.patch diff --git a/removed/1.16/0468-Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch b/removed/1.16/No longer Needed/0468-Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch similarity index 100% rename from removed/1.16/0468-Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch rename to removed/1.16/No longer Needed/0468-Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 06ad7ab9b..269f68bcd 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -94,7 +94,6 @@ done # import FileName -import VoxelShapeSpliterator ######################################################## ########################################################