diff --git a/patches/api/0001-new-fork-who-dis-Rebrand-to-SparklyPaper.patch b/patches/api/0001-new-fork-who-dis-Rebrand-to-SparklyPaper.patch
index d69577d..7c49218 100644
--- a/patches/api/0001-new-fork-who-dis-Rebrand-to-SparklyPaper.patch
+++ b/patches/api/0001-new-fork-who-dis-Rebrand-to-SparklyPaper.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] new fork who dis - Rebrand to SparklyPaper
diff --git a/pom.xml b/pom.xml
-index 821df3413345c613eccff158f8081cf9ba848a14..e9e469ab4641f1830dff63b2090139074abaedfa 100644
+index 6c200882954adc4831307f3d6dfa3202571fb30b..9299aa2b3f41ed09113e6e20b5fbc3f57e8a748b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,8 +3,8 @@
diff --git a/patches/server/0001-new-fork-who-dis-Rebrand-to-SparklyPaper.patch b/patches/server/0001-new-fork-who-dis-Rebrand-to-SparklyPaper.patch
index ff0fbb6..bff2853 100644
--- a/patches/server/0001-new-fork-who-dis-Rebrand-to-SparklyPaper.patch
+++ b/patches/server/0001-new-fork-who-dis-Rebrand-to-SparklyPaper.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] new fork who dis - Rebrand to SparklyPaper
diff --git a/pom.xml b/pom.xml
-index e83e4241a56fe131a75fe21cc1518992c089da2c..ef6d6019a5782d42ea6cd73f76e01f4e985771de 100644
+index dad9981b1cd1ca8b27a45972188fd2b92f5146e7..9b214b9cff98eaaafc503c4709529249aead36ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,11 +1,11 @@
@@ -34,7 +34,7 @@ index e83e4241a56fe131a75fe21cc1518992c089da2c..ef6d6019a5782d42ea6cd73f76e01f4e
dev-SNAPSHOT
../pom.xml
-@@ -183,7 +183,7 @@
+@@ -163,7 +163,7 @@
@@ -43,7 +43,7 @@ index e83e4241a56fe131a75fe21cc1518992c089da2c..ef6d6019a5782d42ea6cd73f76e01f4e
install
-@@ -191,7 +191,7 @@
+@@ -171,7 +171,7 @@
gitdescribe-maven-plugin
1.3
@@ -68,10 +68,10 @@ index 7063f1da3654b382e26b0093ad5d0ff04a2b38c2..b6ee4e6e4c223f61874cc8c5817ed68d
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
-index afc22e545df03a38c801362d308d135df90361e2..9c4faea85ae4f46eb5f6dd5fc1a7dd1df2598803 100644
+index e757cb5c2d50cb3a4dbe50d4726db09ab845fcbb..b468351a10fd9a3029d4d7d6dc8548644a025b4e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
-@@ -1524,7 +1524,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant INSTRUMENT = BlockProperties.aI;
-@@ -13,12 +20,32 @@ public class BlockNote extends Block {
+@@ -35,12 +41,32 @@ public class BlockNote extends Block {
@Override
public IBlockData getPlacedState(BlockActionContext blockactioncontext) {
@@ -56,7 +56,7 @@ index 7111ba9c2119679cd915895370b2159d90396664..f8261543df1d602cd41662e15a66352a
}
@Override
-@@ -31,7 +58,18 @@ public class BlockNote extends Block {
+@@ -53,7 +79,18 @@ public class BlockNote extends Block {
iblockdata = world.getType(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
}
@@ -76,7 +76,7 @@ index 7111ba9c2119679cd915895370b2159d90396664..f8261543df1d602cd41662e15a66352a
}
}
-@@ -52,10 +90,21 @@ public class BlockNote extends Block {
+@@ -74,10 +111,21 @@ public class BlockNote extends Block {
if (world.isClientSide) {
return EnumInteractionResult.SUCCESS;
} else {
diff --git a/patches/server/0004-Remove-streams.patch b/patches/server/0004-Remove-streams.patch
deleted file mode 100644
index c6d5d82..0000000
--- a/patches/server/0004-Remove-streams.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sat, 23 Jan 2021 16:42:24 -0600
-Subject: [PATCH] Remove streams
-
-Airplane
-Copyright (C) 2020 Technove LLC
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-diff --git a/src/main/java/net/minecraft/server/BehaviorBetterJob.java b/src/main/java/net/minecraft/server/BehaviorBetterJob.java
-index 19f8cf4384ff7a1515ad33a5f573ea0061bab93d..e6507a9bef705e1496497ad6b58a546348a0779e 100644
---- a/src/main/java/net/minecraft/server/BehaviorBetterJob.java
-+++ b/src/main/java/net/minecraft/server/BehaviorBetterJob.java
-@@ -14,11 +14,31 @@ public class BehaviorBetterJob extends Behavior {
- protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
- GlobalPos globalpos = (GlobalPos) entityvillager.getBehaviorController().getMemory(MemoryModuleType.JOB_SITE).get();
-
-+ // Airplane start - remove stream
-+ /*
- worldserver.y().c(globalpos.getBlockPosition()).ifPresent((villageplacetype) -> {
- BehaviorUtil.a(entityvillager, (entityvillager1) -> {
- return this.a(globalpos, villageplacetype, entityvillager1);
- }).reduce(entityvillager, BehaviorBetterJob::a);
- });
-+ */
-+ java.util.Optional optVillagePlaceType = worldserver.y().c(globalpos.getBlockPosition());
-+ if (optVillagePlaceType.isPresent()) {
-+ VillagePlaceType villageplacetype = optVillagePlaceType.get();
-+ java.util.Optional> optList = entityvillager.getBehaviorController().getMemory(MemoryModuleType.MOBS);
-+ if (optList.isPresent()) {
-+ EntityVillager previous = entityvillager;
-+ for (EntityLiving entityliving : optList.get()) {
-+ if (entityliving instanceof EntityVillager && entityliving != entityvillager && entityliving.isAlive()) {
-+ EntityVillager entityvillager1 = (EntityVillager) entityliving;
-+ if (this.a(globalpos, villageplacetype, entityvillager1)) {
-+ previous = a(previous, entityvillager1);
-+ }
-+ }
-+ }
-+ }
-+ }
-+ // Airplane end
- }
-
- private static EntityVillager a(EntityVillager entityvillager, EntityVillager entityvillager1) {
diff --git a/patches/server/0005-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch b/patches/server/0005-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch
deleted file mode 100644
index 2ec4a6e..0000000
--- a/patches/server/0005-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sat, 31 Oct 2020 18:43:02 -0500
-Subject: [PATCH] Strip raytracing for EntityLiving#hasLineOfSight
-
-The IBlockAccess#rayTrace method is very wasteful in both allocations,
-and in logic. While EntityLiving#hasLineOfSight provides static
-parameters for collisions with blocks and fluids, the method still does
-a lot of dynamic checks for both of these, which result in extra work.
-As well, since the fluid collision option is set to NONE, the entire
-fluid collision system is completely unneeded, yet used anyways.
-
-Airplane
-Copyright (C) 2020 Technove LLC
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
-index d568db532de83a85d5c387121cec151c160f36bf..4bf86d22de3dfb5a98c0fd31f936b566a7be6d38 100644
---- a/src/main/java/net/minecraft/server/EntityLiving.java
-+++ b/src/main/java/net/minecraft/server/EntityLiving.java
-@@ -3007,7 +3007,7 @@ public abstract class EntityLiving extends Entity {
- Vec3D vec3d = new Vec3D(this.locX(), this.getHeadY(), this.locZ());
- Vec3D vec3d1 = new Vec3D(entity.locX(), entity.getHeadY(), entity.locZ());
-
-- return this.world.rayTrace(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.COLLIDER, RayTrace.FluidCollisionOption.NONE, this)).getType() == MovingObjectPosition.EnumMovingObjectType.MISS;
-+ return this.world.rayTraceDirect(vec3d, vec3d1, VoxelShapeCollision.a(this)) == MovingObjectPosition.EnumMovingObjectType.MISS; // Airplane - use direct method
- }
-
- @Override
-diff --git a/src/main/java/net/minecraft/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java
-index 5ccf6b483fe15d4ad12ce2d3d11e9440ee9e8ab7..ec82d91804eeed49a6ef67a92fd24a06ae7ee3fb 100644
---- a/src/main/java/net/minecraft/server/IBlockAccess.java
-+++ b/src/main/java/net/minecraft/server/IBlockAccess.java
-@@ -44,6 +44,15 @@ public interface IBlockAccess {
- return BlockPosition.a(axisalignedbb).map(this::getType);
- }
-
-+ // Airplane start - broken down variant of below rayTraceBlock, used by World#rayTraceDirect
-+ default MovingObjectPosition.EnumMovingObjectType rayTraceBlockDirect(Vec3D vec3d, Vec3D vec3d1, BlockPosition blockposition, IBlockData iblockdata, VoxelShapeCollision voxelshapecoll) {
-+ VoxelShape voxelshape = RayTrace.BlockCollisionOption.COLLIDER.get(iblockdata, this, blockposition, voxelshapecoll);
-+ MovingObjectPositionBlock movingobjectpositionblock = this.rayTrace(vec3d, vec3d1, blockposition, voxelshape, iblockdata);
-+
-+ return movingobjectpositionblock == null ? null : movingobjectpositionblock.getType();
-+ }
-+ // Airplane end
-+
- // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
- default MovingObjectPositionBlock rayTraceBlock(RayTrace raytrace1, BlockPosition blockposition) {
- // Paper start - Prevent raytrace from loading chunks
-diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java
-index 2e7721a650c5a351b3584665bd236f92ef577761..b3c2b461b2a654a9e37a57f2f62b3ba8b5bb1634 100644
---- a/src/main/java/net/minecraft/server/MathHelper.java
-+++ b/src/main/java/net/minecraft/server/MathHelper.java
-@@ -238,6 +238,7 @@ public class MathHelper {
- return f - (float) d(f);
- }
-
-+ public static double getDecimals(double num) { return h(num); } // Airplane
- public static double h(double d0) {
- return d0 - (double) d(d0);
- }
-@@ -416,6 +417,7 @@ public class MathHelper {
- return f1 + f * (f2 - f1);
- }
-
-+ public static double linearInterpolation(double value1, double value2, double amount) { return d(value1, value2, amount); } // Airplane - OBFHELPER
- public static double d(double d0, double d1, double d2) {
- return d1 + d0 * (d2 - d1);
- }
-@@ -432,6 +434,7 @@ public class MathHelper {
- return d0 * d0 * d0 * (d0 * (d0 * 6.0D - 15.0D) + 10.0D);
- }
-
-+ public static int sign(double num) { return k(num); } // Airplane - OBFHELPER
- public static int k(double d0) {
- return d0 == 0.0D ? 0 : (d0 > 0.0D ? 1 : -1);
- }
-diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
-index bf06ef09cfd4d7618365249d1332d264d8ff1377..fbe9a9d9721daf78e77736080f0c319c80bd950f 100644
---- a/src/main/java/net/minecraft/server/World.java
-+++ b/src/main/java/net/minecraft/server/World.java
-@@ -318,6 +318,91 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
- return null;
- }
-
-+ // Airplane start - broken down method of raytracing for EntityLiving#hasLineOfSight, replaces IBlockAccess#rayTrace(RayTrace)
-+ protected MovingObjectPosition.EnumMovingObjectType rayTraceDirect(Vec3D vec3d, Vec3D vec3d1, VoxelShapeCollision voxelshapecoll) {
-+ // most of this code comes from IBlockAccess#a(RayTrace, BiFunction, Function), but removes the needless functions
-+ if (vec3d.equals(vec3d1)) {
-+ return MovingObjectPosition.EnumMovingObjectType.MISS;
-+ }
-+
-+ double endX = MathHelper.linearInterpolation(-1.0E-7D, vec3d1.x, vec3d.x);
-+ double endY = MathHelper.linearInterpolation(-1.0E-7D, vec3d1.y, vec3d.y);
-+ double endZ = MathHelper.linearInterpolation(-1.0E-7D, vec3d1.z, vec3d.z);
-+
-+ double startX = MathHelper.linearInterpolation(-1.0E-7D, vec3d.x, vec3d1.x);
-+ double startY = MathHelper.linearInterpolation(-1.0E-7D, vec3d.y, vec3d1.y);
-+ double startZ = MathHelper.linearInterpolation(-1.0E-7D, vec3d.z, vec3d1.z);
-+
-+ int currentX = MathHelper.floor(startX);
-+ int currentY = MathHelper.floor(startY);
-+ int currentZ = MathHelper.floor(startZ);
-+
-+ BlockPosition.MutableBlockPosition currentBlock = new BlockPosition.MutableBlockPosition(currentX, currentY, currentZ);
-+
-+ Chunk chunk = this.getChunkIfLoaded(currentBlock);
-+ if (chunk == null) {
-+ return MovingObjectPosition.EnumMovingObjectType.MISS;
-+ }
-+
-+ MovingObjectPosition.EnumMovingObjectType initialCheck = this.rayTraceBlockDirect(vec3d, vec3d1, currentBlock, chunk.getType(currentBlock), voxelshapecoll);
-+
-+ if (initialCheck != null) {
-+ return initialCheck;
-+ }
-+
-+ double diffX = endX - startX;
-+ double diffY = endY - startY;
-+ double diffZ = endZ - startZ;
-+
-+ int xDirection = MathHelper.sign(diffX);
-+ int yDirection = MathHelper.sign(diffY);
-+ int zDirection = MathHelper.sign(diffZ);
-+
-+ double normalizedX = xDirection == 0 ? Double.MAX_VALUE : (double) xDirection / diffX;
-+ double normalizedY = yDirection == 0 ? Double.MAX_VALUE : (double) yDirection / diffY;
-+ double normalizedZ = zDirection == 0 ? Double.MAX_VALUE : (double) zDirection / diffZ;
-+
-+ double normalizedXDirection = normalizedX * (xDirection > 0 ? 1.0D - MathHelper.getDecimals(startX) : MathHelper.getDecimals(startX));
-+ double normalizedYDirection = normalizedY * (yDirection > 0 ? 1.0D - MathHelper.getDecimals(startY) : MathHelper.getDecimals(startY));
-+ double normalizedZDirection = normalizedZ * (zDirection > 0 ? 1.0D - MathHelper.getDecimals(startZ) : MathHelper.getDecimals(startZ));
-+
-+ MovingObjectPosition.EnumMovingObjectType result;
-+
-+ do {
-+ if (normalizedXDirection > 1.0D && normalizedYDirection > 1.0D && normalizedZDirection > 1.0D) {
-+ return MovingObjectPosition.EnumMovingObjectType.MISS;
-+ }
-+
-+ if (normalizedXDirection < normalizedYDirection) {
-+ if (normalizedXDirection < normalizedZDirection) {
-+ currentX += xDirection;
-+ normalizedXDirection += normalizedX;
-+ } else {
-+ currentZ += zDirection;
-+ normalizedZDirection += normalizedZ;
-+ }
-+ } else if (normalizedYDirection < normalizedZDirection) {
-+ currentY += yDirection;
-+ normalizedYDirection += normalizedY;
-+ } else {
-+ currentZ += zDirection;
-+ normalizedZDirection += normalizedZ;
-+ }
-+
-+ currentBlock.setValues(currentX, currentY, currentZ);
-+ if (chunk.getPos().x != currentBlock.getX() >> 4 || chunk.getPos().z != currentBlock.getZ() >> 4) {
-+ chunk = this.getChunkIfLoaded(currentBlock);
-+ if (chunk == null) {
-+ return MovingObjectPosition.EnumMovingObjectType.MISS;
-+ }
-+ }
-+ result = this.rayTraceBlockDirect(vec3d, vec3d1, currentBlock, chunk.getType(currentBlock), voxelshapecoll);
-+ } while (result == null);
-+
-+ return result;
-+ }
-+ // Airplane end
-+
- public static boolean isValidLocation(BlockPosition blockposition) {
- return blockposition.isValidLocation(); // Paper - use better/optimized check
- }
diff --git a/patches/server/0006-Simpler-ShapelessRecipes-comparison-for-Vanilla.patch b/patches/server/0006-Simpler-ShapelessRecipes-comparison-for-Vanilla.patch
deleted file mode 100644
index 64b5cde..0000000
--- a/patches/server/0006-Simpler-ShapelessRecipes-comparison-for-Vanilla.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sat, 31 Oct 2020 18:51:38 -0500
-Subject: [PATCH] Simpler ShapelessRecipes comparison for Vanilla
-
-Paper added a fancy sorting comparison due to Bukkit recipes breaking
-the vanilla one, however this is far more advanced than what you need
-for all the vanilla recipes.
-
-Airplane
-Copyright (C) 2020 Technove LLC
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java
-index ecd63281912ae0ed93c5eb5ccb4249833cb23ab1..97825ec914709ca037159c46ecee218a6013ff58 100644
---- a/src/main/java/net/minecraft/server/ShapelessRecipes.java
-+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java
-@@ -18,8 +18,16 @@ public class ShapelessRecipes implements RecipeCrafting {
- private final String group;
- private final ItemStack result;
- private final NonNullList ingredients;
-+ private final boolean isBukkit; // Airplane
-
-+ // Airplane start - add isBukkit constructor param
- public ShapelessRecipes(MinecraftKey minecraftkey, String s, ItemStack itemstack, NonNullList nonnulllist) {
-+ this(minecraftkey, s, itemstack, nonnulllist, false);
-+ }
-+
-+ public ShapelessRecipes(MinecraftKey minecraftkey, String s, ItemStack itemstack, NonNullList nonnulllist, boolean isBukkit) {
-+ this.isBukkit = isBukkit;
-+ // Airplane end
- this.key = minecraftkey;
- this.group = s;
- this.result = itemstack;
-@@ -61,6 +69,28 @@ public class ShapelessRecipes implements RecipeCrafting {
- }
-
- public boolean a(InventoryCrafting inventorycrafting, World world) {
-+ // Airplane start
-+ if (!this.isBukkit) {
-+ java.util.List ingredients = com.google.common.collect.Lists.newArrayList(this.ingredients.toArray(new RecipeItemStack[0]));
-+
-+ inventory: for (int index = 0; index < inventorycrafting.getSize(); index++) {
-+ ItemStack itemStack = inventorycrafting.getItem(index);
-+
-+ if (!itemStack.isEmpty()) {
-+ for (int i = 0; i < ingredients.size(); i++) {
-+ if (ingredients.get(i).test(itemStack)) {
-+ ingredients.remove(i);
-+ continue inventory;
-+ }
-+ }
-+ return false;
-+ }
-+ }
-+
-+ return ingredients.isEmpty();
-+ }
-+ // Airplane end
-+
- AutoRecipeStackManager autorecipestackmanager = new AutoRecipeStackManager();
- int i = 0;
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java
-index 4aba511fe8078164bf1467b39645dd9bf6a931e7..56b781e438f0cf1c12dd55eb37356601e47de47f 100644
---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java
-+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java
-@@ -44,6 +44,6 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe
- data.set(i, toNMS(ingred.get(i), true));
- }
-
-- MinecraftServer.getServer().getCraftingManager().addRecipe(new ShapelessRecipes(CraftNamespacedKey.toMinecraft(this.getKey()), this.getGroup(), CraftItemStack.asNMSCopy(this.getResult()), data));
-+ MinecraftServer.getServer().getCraftingManager().addRecipe(new ShapelessRecipes(CraftNamespacedKey.toMinecraft(this.getKey()), this.getGroup(), CraftItemStack.asNMSCopy(this.getResult()), data, true)); // Airplane
- }
- }
diff --git a/patches/server/0007-Swap-priority-of-checks-in-chunk-ticking.patch b/patches/server/0007-Swap-priority-of-checks-in-chunk-ticking.patch
deleted file mode 100644
index 3a94dc5..0000000
--- a/patches/server/0007-Swap-priority-of-checks-in-chunk-ticking.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sun, 1 Nov 2020 16:59:08 -0600
-Subject: [PATCH] Swap priority of checks in chunk ticking
-
-World.V showed up a lot in lag spikes for some reason, although I wonder
-if it's just Spark getting JVM safe points.
-
-Airplane
-Copyright (C) 2020 Technove LLC
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
-index a77fceac7c9e79a6bac05becc21bcb6bf2a1a7c7..784c800eda8d7a37b900a74dff169d60990c418f 100644
---- a/src/main/java/net/minecraft/server/WorldServer.java
-+++ b/src/main/java/net/minecraft/server/WorldServer.java
-@@ -1097,7 +1097,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- gameprofilerfiller.enter("thunder");
- final BlockPosition.MutableBlockPosition blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
-
-- if (!this.paperConfig.disableThunder && flag && this.W() && this.random.nextInt(100000) == 0) { // Paper - Disable thunder
-+ if (!this.paperConfig.disableThunder && flag && this.random.nextInt(100000) == 0 && this.W()) { // Paper - Disable thunder // Airplane - check this.W last
- blockposition.setValues(this.a(this.a(j, 0, k, 15))); // Paper
- if (this.isRainingAt(blockposition)) {
- DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);
diff --git a/patches/server/0008-Reduce-projectile-chunk-loading.patch b/patches/server/0008-Reduce-projectile-chunk-loading.patch
deleted file mode 100644
index 0b2d7d3..0000000
--- a/patches/server/0008-Reduce-projectile-chunk-loading.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sun, 13 Dec 2020 17:52:35 -0600
-Subject: [PATCH] Reduce projectile chunk loading
-
-Airplane
-Copyright (C) 2020 Technove LLC
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
-index d85a19905efab7189e461a61becb6ca2b8c50803..4b3d5731a18177c74f02eef91820720104145d1c 100644
---- a/src/main/java/net/minecraft/server/EntityProjectile.java
-+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
-@@ -85,6 +85,37 @@ public abstract class EntityProjectile extends IProjectile {
- this.setPosition(d0, d1, d2);
- }
-
-+ private static int loadedThisTick = 0;
-+ private static int loadedTick;
-+
-+ private int buffered = 0;
-+
-+ // Airplane start
-+ @Override
-+ public void setPosition(double d0, double d1, double d2) {
-+ if (loadedTick != MinecraftServer.currentTick) {
-+ loadedTick = MinecraftServer.currentTick;
-+ loadedThisTick = 0;
-+ }
-+ int previousX = MathHelper.floor(this.locX()) >> 4, previousZ = MathHelper.floor(this.locZ()) >> 4;
-+ int newX = MathHelper.floor(d0) >> 4, newZ = MathHelper.floor(d2) >> 4;
-+ if (previousX != newX || previousZ != newZ) {
-+ boolean isLoaded = this.world.isChunkLoaded(newX, newZ);
-+ if (!isLoaded) {
-+ if (loadedThisTick > 10) { // Airplane 10 = max chunks to load from projectiles in a tick todo config
-+ if (++buffered > 20) { // Airplane 20 = max chunks a single projectile loads overall todo config
-+ this.die();
-+ }
-+ return;
-+ }
-+ loadedThisTick++;
-+ }
-+ buffered = 0;
-+ }
-+ super.setPosition(d0, d1, d2);
-+ }
-+ // Airplane end
-+
- protected float k() {
- return 0.03F;
- }
diff --git a/patches/server/0009-Only-check-for-spooky-season-once-an-hour.patch b/patches/server/0009-Only-check-for-spooky-season-once-an-hour.patch
deleted file mode 100644
index 044d613..0000000
--- a/patches/server/0009-Only-check-for-spooky-season-once-an-hour.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sun, 13 Dec 2020 17:53:08 -0600
-Subject: [PATCH] Only check for spooky season once an hour
-
-Airplane
-Copyright (C) 2020 Technove LLC
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java
-index 451ffcfd1fc9fa3091dc2bd697e5d829dcf6443f..f06ffdca027e5477332c6bc0c381264b47633f78 100644
---- a/src/main/java/net/minecraft/server/EntityBat.java
-+++ b/src/main/java/net/minecraft/server/EntityBat.java
-@@ -222,13 +222,22 @@ public class EntityBat extends EntityAmbient {
- }
- }
-
-+ // Airplane start - only check for spooky season once an hour
-+ private static boolean isSpookySeason = false;
-+ private static final int ONE_HOUR = 20 * 60 * 60;
-+ private static int lastSpookyCheck = -ONE_HOUR;
- private static boolean eJ() {
-+ if (MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
- LocalDate localdate = LocalDate.now();
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
-+ isSpookySeason = j == 10 && i >= 20 || j == 11 && i <= 3;
-+ lastSpookyCheck = MinecraftServer.currentTick;
-+ }
-
-- return j == 10 && i >= 20 || j == 11 && i <= 3;
-+ return isSpookySeason;
- }
-+ // Airplane end
-
- @Override
- protected float b(EntityPose entitypose, EntitySize entitysize) {
diff --git a/patches/server/0010-Optimize-random-calls-in-chunk-ticking.patch b/patches/server/0010-Optimize-random-calls-in-chunk-ticking.patch
deleted file mode 100644
index c7c3b92..0000000
--- a/patches/server/0010-Optimize-random-calls-in-chunk-ticking.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Thu, 7 Jan 2021 11:49:36 -0600
-Subject: [PATCH] Optimize random calls in chunk ticking
-
-Especially at over 30,000 chunks these random calls are fairly heavy. We
-use a different method here for checking lightning, and for checking
-ice.
-
-Lighting: Each chunk now keeps an int of how many ticks until the
-lightning should strike. This int is a random number from 0 to 100000 * 2,
-the multiplication is required to keep the probability the same.
-
-Ice and snow: We just generate a single random number 0-16 and increment
-it, while checking if it's 0 for the current chunk.
-
-Depending on configuration for things that tick in a chunk, this is a
-5-10% improvement.
-
-Airplane
-Copyright (C) 2020 Technove LLC
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
-index 8e59a794f6190930cb7bb81a2fe1a1d374dacce7..045b4af6721817b3dbfb05b9aec0bf382de9fcf5 100644
---- a/src/main/java/net/minecraft/server/Chunk.java
-+++ b/src/main/java/net/minecraft/server/Chunk.java
-@@ -53,6 +53,18 @@ public class Chunk implements IChunkAccess {
- private final ChunkCoordIntPair loc; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key
- private volatile boolean x;
-
-+ // Airplane start - instead of using a random every time the chunk is ticked, define when lightning strikes preemptively
-+ private int lightningTick;
-+ // shouldDoLightning compiles down to 29 bytes, which with the default of 35 byte inlining should guarantee an inline
-+ public final boolean shouldDoLightning(java.util.Random random) {
-+ if (this.lightningTick-- <= 0) {
-+ this.lightningTick = random.nextInt(100000) << 1;
-+ return true;
-+ }
-+ return false;
-+ }
-+ // Airplane end
-+
- public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage) {
- this(world, chunkcoordintpair, biomestorage, ChunkConverter.a, TickListEmpty.b(), TickListEmpty.b(), 0L, (ChunkSection[]) null, (Consumer) null);
- }
-@@ -287,6 +299,7 @@ public class Chunk implements IChunkAccess {
- // CraftBukkit start
- this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
- this.entitySlicesManager = new com.tuinity.tuinity.world.ChunkEntitySlices(this.world, this.loc.x, this.loc.z, 0, 15); // TODO update for 1.17 // Tuinity
-+ this.lightningTick = this.world.random.nextInt(100000) << 1; // Airplane - initialize lightning tick
- }
-
- public org.bukkit.Chunk bukkitChunk;
-diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
-index b55f7dece329dbb3ff27d57a39c32c69e5baea74..5897d462d350dfbd1464feb92ecf77725651c694 100644
---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
-+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
-@@ -975,6 +975,7 @@ public class ChunkProviderServer extends IChunkProvider {
- }
- // Paper end - optimize isOutisdeRange
- this.world.getMethodProfiler().enter("pollingChunks");
-+ this.world.resetIceAndSnowTick(); // Airplane - reset ice & snow tick random
- int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED);
- boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit
-
-diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
-index 784c800eda8d7a37b900a74dff169d60990c418f..eca550800e9b0a09421ad29cb6a8b16f61806703 100644
---- a/src/main/java/net/minecraft/server/WorldServer.java
-+++ b/src/main/java/net/minecraft/server/WorldServer.java
-@@ -1087,6 +1087,8 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- private final BiomeBase[] biomeBaseCache = new BiomeBase[1];
- // Tuinity end - optimise chunk ice snow ticking
-
-+ private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.randomTickRandom.nextInt(16); } // Airplane
-+
- public void a(Chunk chunk, int i) { final int randomTickSpeed = i; // Paper
- ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
- boolean flag = this.isRaining();
-@@ -1097,7 +1099,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- gameprofilerfiller.enter("thunder");
- final BlockPosition.MutableBlockPosition blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
-
-- if (!this.paperConfig.disableThunder && flag && this.random.nextInt(100000) == 0 && this.W()) { // Paper - Disable thunder // Airplane - check this.W last
-+ if (!this.paperConfig.disableThunder && flag && chunk.shouldDoLightning(this.random) && this.W()) { // Paper - Disable thunder // Airplane - check this.W last // Airplane - replace random with shouldDoLighting
- blockposition.setValues(this.a(this.a(j, 0, k, 15))); // Paper
- if (this.isRainingAt(blockposition)) {
- DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);
-@@ -1121,7 +1123,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- }
-
- gameprofilerfiller.exitEnter("iceandsnow");
-- if (!this.paperConfig.disableIceAndSnow && this.randomTickRandom.nextInt(16) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking
-+ if (!this.paperConfig.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Airplane - optimize further random ticking
- // Paper start - optimise chunk ticking
- // Tuinity start - optimise chunk ice snow ticking
- BiomeBase[] biomeCache = this.biomeBaseCache;
diff --git a/patches/server/0011-Don-t-get-entity-equipment-if-not-needed.patch b/patches/server/0011-Don-t-get-entity-equipment-if-not-needed.patch
deleted file mode 100644
index 3fdd9e8..0000000
--- a/patches/server/0011-Don-t-get-entity-equipment-if-not-needed.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Fri, 15 Jan 2021 20:08:54 -0600
-Subject: [PATCH] Don't get entity equipment if not needed
-
-Airplane
-Copyright (C) 2020 Technove LLC
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
-index 4bf86d22de3dfb5a98c0fd31f936b566a7be6d38..58af082b95a7eff44e2c71c3609a288a31d28d01 100644
---- a/src/main/java/net/minecraft/server/EntityLiving.java
-+++ b/src/main/java/net/minecraft/server/EntityLiving.java
-@@ -815,11 +815,13 @@ public abstract class EntityLiving extends Entity {
- }
-
- if (entity != null) {
-- ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);
-- Item item = itemstack.getItem();
-+ // Airplane start - don't get equipment if not needed
-+ //ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);
-+ //Item item = itemstack.getItem();
- EntityTypes> entitytypes = entity.getEntityType();
-
-- if (entitytypes == EntityTypes.SKELETON && item == Items.SKELETON_SKULL || entitytypes == EntityTypes.ZOMBIE && item == Items.ZOMBIE_HEAD || entitytypes == EntityTypes.CREEPER && item == Items.CREEPER_HEAD) {
-+ if (entitytypes == EntityTypes.SKELETON && this.getEquipment(EnumItemSlot.HEAD).getItem() == Items.SKELETON_SKULL || entitytypes == EntityTypes.ZOMBIE && this.getEquipment(EnumItemSlot.HEAD).getItem() == Items.ZOMBIE_HEAD || entitytypes == EntityTypes.CREEPER && this.getEquipment(EnumItemSlot.HEAD).getItem() == Items.CREEPER_HEAD) {
-+ // Airplane end
- d0 *= 0.5D;
- }
- }
diff --git a/patches/server/0012-Reduce-allocs-improve-perf-of-StructureManager.patch b/patches/server/0012-Reduce-allocs-improve-perf-of-StructureManager.patch
deleted file mode 100644
index c697efd..0000000
--- a/patches/server/0012-Reduce-allocs-improve-perf-of-StructureManager.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Thu, 4 Feb 2021 23:24:20 -0600
-Subject: [PATCH] Reduce allocs & improve perf of StructureManager
-
-Focuses on two methods, getStructureStarts & getFeatureStarts. For
-getStructureStarts, it inlines getFeatureStarts so it doesn't have to
-calculate an entire list when it returns early. As well, it uses a
-LongIterator in order to not allocate longs for each position.
-
-diff --git a/src/main/java/net/minecraft/server/StructureManager.java b/src/main/java/net/minecraft/server/StructureManager.java
-index 2598ae3710d46c2cfd2be5d6be2a56e59ceef6ea..fd1f1e2d7e4be227697f534bdc6d9c52ceeeda4b 100644
---- a/src/main/java/net/minecraft/server/StructureManager.java
-+++ b/src/main/java/net/minecraft/server/StructureManager.java
-@@ -5,6 +5,11 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList; // Paper
- import java.util.stream.Stream;
- import javax.annotation.Nullable;
-
-+// Airplane start
-+import it.unimi.dsi.fastutil.longs.LongIterator;
-+import it.unimi.dsi.fastutil.longs.LongSet;
-+// Airplane end
-+
- public class StructureManager {
-
- private final GeneratorAccess a; public GeneratorAccess getLevel() { return a; } // Paper - OBFHELPER
-@@ -41,13 +46,15 @@ public class StructureManager {
- public java.util.List> getFeatureStarts(SectionPosition sectionPosition, StructureGenerator> structureGenerator, IWorldReader world) {
- // Tuinity end - add world parameter
- java.util.List> list = new ObjectArrayList<>();
-- for (Long curLong: (world == null ? getLevel() : world).getChunkAt(sectionPosition.a(), sectionPosition.c(), ChunkStatus.STRUCTURE_REFERENCES).b(structureGenerator)) { // Tuinity - fix deadlock on world gen - chunk can be unloaded while generating, so we should be using the generator's regionlimitedaccess so we always get the chunk
-- SectionPosition sectionPosition1 = SectionPosition.a(new ChunkCoordIntPair(curLong), 0);
-+ // Airplane start - skip allocating Longs
-+ (world == null ? getLevel() : world).getChunkAt(sectionPosition.a(), sectionPosition.c(), ChunkStatus.STRUCTURE_REFERENCES).b(structureGenerator).forEach((java.util.function.LongConsumer) curLong -> {
-+ SectionPosition sectionPosition1 = SectionPosition.a(ChunkCoordIntPair.getX(curLong), 0, ChunkCoordIntPair.getZ(curLong)); // don't allocate ChunkCoordIntPair
- StructureStart> structurestart = a(sectionPosition1, structureGenerator, getLevel().getChunkAt(sectionPosition1.a(), sectionPosition1.c(), ChunkStatus.STRUCTURE_STARTS));
- if (structurestart != null && structurestart.e()) {
- list.add(structurestart);
- }
-- }
-+ });
-+ // Airplane end
- return list;
- }
- // Paper end
-@@ -75,7 +82,18 @@ public class StructureManager {
- }
- public StructureStart> getStructureStarts(BlockPosition blockposition, boolean flag, StructureGenerator> structuregenerator, IWorldReader world) {
- // Paper start - remove structure streams
-- for (StructureStart> structurestart : getFeatureStarts(SectionPosition.a(blockposition), structuregenerator, world)) { // Tuinity end - add world parameter
-+ // Airplane start - inline getFeatureStarts to skip creating the list
-+ SectionPosition sectionPosition = SectionPosition.a(blockposition);
-+
-+ // use iterator here instead of forEach like in getFeatureStarts so we can return early
-+ LongSet longSet = (world == null ? getLevel() : world).getChunkAt(sectionPosition.a(), sectionPosition.c(), ChunkStatus.STRUCTURE_REFERENCES).b(structuregenerator);
-+ LongIterator iterator = longSet.iterator();
-+ while (iterator.hasNext()) {
-+ long curLong = iterator.nextLong();
-+ SectionPosition sectionPosition1 = SectionPosition.a(ChunkCoordIntPair.getX(curLong), 0, ChunkCoordIntPair.getZ(curLong)); // don't allocate ChunkCoordIntPair
-+ StructureStart> structurestart = a(sectionPosition1, structuregenerator, getLevel().getChunkAt(sectionPosition1.a(), sectionPosition1.c(), ChunkStatus.STRUCTURE_STARTS));
-+ if (structurestart != null && structurestart.e()) {
-+
- if (structurestart.c().b(blockposition)) {
- if (!flag) {
- return structurestart;
-@@ -86,7 +104,10 @@ public class StructureManager {
- }
- }
- }
-+
-+ }
- }
-+ // Airplane end
- return StructureStart.a;
- // Paper end
- }
diff --git a/patches/server/0013-Cache-palette-array.patch b/patches/server/0013-Cache-palette-array.patch
deleted file mode 100644
index 8872553..0000000
--- a/patches/server/0013-Cache-palette-array.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Thu, 4 Feb 2021 23:28:46 -0600
-Subject: [PATCH] Cache palette array
-
-The reasoning for reusing it in ChunkRegionLoader is because ThreadLocal
-lookups are fairly expensive, and if we put it in DataPaletteBlock the
-ThreadLocal lookup would happen 18 times.
-
-diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
-index 076d6c1e1cc049dd312ecb30518e7b25fc2d7371..68538ae94806d5980cd531e61fa52a01a5cc8997 100644
---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
-+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
-@@ -424,6 +424,7 @@ public class ChunkRegionLoader {
- public static NBTTagCompound saveChunk(WorldServer worldserver, IChunkAccess ichunkaccess) {
- return saveChunk(worldserver, ichunkaccess, null);
- }
-+ private static final ThreadLocal paletteArray = ThreadLocal.withInitial(() -> new int[4096]); // Airplane
- public static NBTTagCompound saveChunk(WorldServer worldserver, IChunkAccess ichunkaccess, AsyncSaveData asyncsavedata) {
- // Paper end
- // Tuinity start - rewrite light impl
-@@ -454,6 +455,7 @@ public class ChunkRegionLoader {
-
- NBTTagCompound nbttagcompound2;
-
-+ int[] aint = paletteArray.get(); // Airplane - use cached
- for (int i = -1; i < 17; ++i) { // Paper - conflict on loop parameter change
- int finalI = i; // CraftBukkit - decompile errors
- ChunkSection chunksection = (ChunkSection) Arrays.stream(achunksection).filter((chunksection1) -> {
-@@ -474,7 +476,7 @@ public class ChunkRegionLoader {
- nbttagcompound2 = new NBTTagCompound();
- nbttagcompound2.setByte("Y", (byte) (i & 255));
- if (chunksection != Chunk.a) {
-- chunksection.getBlocks().a(nbttagcompound2, "Palette", "BlockStates");
-+ chunksection.getBlocks().a(nbttagcompound2, "Palette", "BlockStates", aint); // Airplane
- }
-
- if (nibblearray != null && !nibblearray.c()) {
-diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
-index 73163b417af7e522a4509bf9c1ab56d6499be622..2855a2757c35afc5751a7ca6f3a12cc27c24bf96 100644
---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
-+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
-@@ -226,12 +226,16 @@ public class DataPaletteBlock implements DataPaletteExpandable {
- this.b();
- }
-
-+ // Airplane start - add parameter for reusing aint
- public synchronized void a(NBTTagCompound nbttagcompound, String s, String s1) { // Paper - synchronize
-+ a(nbttagcompound, s, s1, new int[4096]);
-+ }
-+ public synchronized void a(NBTTagCompound nbttagcompound, String s, String s1, int[] aint) { // Paper - synchronize // Airplane end
- this.a();
- DataPaletteHash datapalettehash = new DataPaletteHash<>(this.d, this.i, this.c, this.e, this.f);
- T t0 = this.g;
- int i = datapalettehash.a(this.g);
-- int[] aint = new int[4096];
-+ //int[] aint = new int[4096]; // Airplane - use parameter
-
- for (int j = 0; j < 4096; ++j) {
- T t1 = this.a(j);
diff --git a/patches/server/0014-Reduce-chunk-loading-lookups.patch b/patches/server/0014-Reduce-chunk-loading-lookups.patch
deleted file mode 100644
index 7c17c09..0000000
--- a/patches/server/0014-Reduce-chunk-loading-lookups.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Thu, 4 Feb 2021 23:33:52 -0600
-Subject: [PATCH] Reduce chunk loading & lookups
-
-
-diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
-index f53525eb32a6096ae24fd23756b2169d5d39e9d4..a192400f0ea4517c56c473d39e4bd04396b4eb72 100644
---- a/src/main/java/net/minecraft/server/EntityEnderman.java
-+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
-@@ -260,11 +260,18 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
- private boolean p(double d0, double d1, double d2) {
- BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(d0, d1, d2);
-
-- while (blockposition_mutableblockposition.getY() > 0 && !this.world.getType(blockposition_mutableblockposition).getMaterial().isSolid()) {
-+ // Airplane start - single chunk lookup
-+ Chunk chunk = this.world.getChunkIfLoaded(blockposition_mutableblockposition);
-+ if (chunk == null) {
-+ return false;
-+ }
-+
-+ while (blockposition_mutableblockposition.getY() > 0 && !chunk.getType(blockposition_mutableblockposition).getMaterial().isSolid()) { // use chunk lookup
- blockposition_mutableblockposition.c(EnumDirection.DOWN);
- }
-
-- IBlockData iblockdata = this.world.getType(blockposition_mutableblockposition);
-+ IBlockData iblockdata = chunk.getType(blockposition_mutableblockposition); // use chunk lookup
-+ // Airplane end
- boolean flag = iblockdata.getMaterial().isSolid();
- boolean flag1 = iblockdata.getFluid().a((Tag) TagsFluid.WATER);
-
-diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
-index 53fd0549c965b2252ad80648d61ff1f7cd2b837a..c7573e1271288bd2b9dfe9801ea8f8804089f6ce 100644
---- a/src/main/java/net/minecraft/server/SpawnerCreature.java
-+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
-@@ -381,7 +381,10 @@ public final class SpawnerCreature {
- }
-
- private static List a(WorldServer worldserver, StructureManager structuremanager, ChunkGenerator chunkgenerator, EnumCreatureType enumcreaturetype, BlockPosition blockposition, @Nullable BiomeBase biomebase) {
-- return enumcreaturetype == EnumCreatureType.MONSTER && worldserver.getType(blockposition.down()).getBlock() == Blocks.NETHER_BRICKS && structuremanager.a(blockposition, false, StructureGenerator.FORTRESS).e() ? StructureGenerator.FORTRESS.c() : chunkgenerator.getMobsFor(biomebase != null ? biomebase : worldserver.getBiome(blockposition), structuremanager, enumcreaturetype, blockposition);
-+ // Airplane start - single chunk lookup
-+ Chunk chunk;
-+ return enumcreaturetype == EnumCreatureType.MONSTER && (chunk = worldserver.getChunkIfLoaded(blockposition)) != null && chunk.getType(blockposition.down()).getBlock() == Blocks.NETHER_BRICKS && structuremanager.a(blockposition, false, StructureGenerator.FORTRESS).e() ? StructureGenerator.FORTRESS.c() : chunkgenerator.getMobsFor(biomebase != null ? biomebase : worldserver.getBiome(blockposition), structuremanager, enumcreaturetype, blockposition);
-+ // Airplane end
- }
-
- private static BlockPosition getRandomPosition(World world, Chunk chunk) {
diff --git a/patches/server/0015-Skip-POI-finding-if-stuck-in-vehicle.patch b/patches/server/0015-Skip-POI-finding-if-stuck-in-vehicle.patch
deleted file mode 100644
index daf6c0b..0000000
--- a/patches/server/0015-Skip-POI-finding-if-stuck-in-vehicle.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Thu, 18 Feb 2021 13:13:27 -0600
-Subject: [PATCH] Skip POI finding if stuck in vehicle
-
-
-diff --git a/src/main/java/net/minecraft/server/BehaviorFindPosition.java b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
-index 83702e07dff72b639af32c8ba9e831e58da92a10..3cee87677e0c331c593abb165f962e326d61c8f4 100644
---- a/src/main/java/net/minecraft/server/BehaviorFindPosition.java
-+++ b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
-@@ -45,6 +45,12 @@ public class BehaviorFindPosition extends Behavior {
- }
-
- protected boolean a(WorldServer worldserver, EntityCreature entitycreature) {
-+ // Airplane start - don't calculate POI if they're trapped in a vehicle
-+ Entity vehicle = entitycreature.getVehicle();
-+ if (vehicle instanceof EntityBoat || vehicle instanceof EntityMinecartRideable) {
-+ return false;
-+ }
-+ // Airplane end
- if (this.d && entitycreature.isBaby()) {
- return false;
- } else if (this.f == 0L) {
diff --git a/patches/server/0016-Reduce-memory-allocations.patch b/patches/server/0016-Reduce-memory-allocations.patch
deleted file mode 100644
index 7037e2e..0000000
--- a/patches/server/0016-Reduce-memory-allocations.patch
+++ /dev/null
@@ -1,224 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Tue, 9 Feb 2021 19:05:58 -0600
-Subject: [PATCH] Reduce memory allocations
-
-Airplane
-Copyright (C) 2020 Technove LLC
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-diff --git a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
-index 7b29d47dfdef7611db58068af285f76d92a9f12a..6c5d96853d47850b81ce85e56a516c554819ef25 100644
---- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
-+++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
-@@ -43,8 +43,14 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow {
- if (worldserver.getLightLevel(blockposition.up()) >= 9) {
- IBlockData iblockdata1 = this.getBlockData();
-
-+ // Airplane start - use mutable position
-+ BlockPosition.MutableBlockPosition blockposition1 = new BlockPosition.MutableBlockPosition();
- for (int i = 0; i < 4; ++i) {
-+ blockposition1.setValues(blockposition).addValues(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
-+ /*
- BlockPosition blockposition1 = blockposition.b(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
-+ */
-+ // Airplane end
-
- if (worldserver.getType(blockposition1).a(Blocks.DIRT) && c(iblockdata1, (IWorldReader) worldserver, blockposition1)) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).a(Blocks.SNOW))); // CraftBukkit
-diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
-index 2291135eaef64c403183724cb6e413cd7e472672..72ee5fe0ca25844cbcd8f1bbbbd6a7f8ced24bc4 100644
---- a/src/main/java/net/minecraft/server/BlockPosition.java
-+++ b/src/main/java/net/minecraft/server/BlockPosition.java
-@@ -432,6 +432,14 @@ public class BlockPosition extends BaseBlockPosition {
- public BlockPosition b(int i, int j, int k) {
- return super.b(i, j, k).immutableCopy();
- }
-+ // Airplane start - version of b that doesn't copy
-+ public BlockPosition addValues(int x, int y, int z) {
-+ ((BaseBlockPosition)this).a += x;
-+ ((BaseBlockPosition)this).b += y;
-+ ((BaseBlockPosition)this).e += z;
-+ return this;
-+ }
-+ // Airplane end
-
- @Override
- public BlockPosition shift(EnumDirection enumdirection, int i) {
-diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
-index 93b5a6471cde31739d2bd5f2a9fc0e0d974d0eb0..4410939423a75357cc2d16bc4a3b96a504942320 100644
---- a/src/main/java/net/minecraft/server/EntityTypes.java
-+++ b/src/main/java/net/minecraft/server/EntityTypes.java
-@@ -139,6 +139,8 @@ public class EntityTypes {
- private MinecraftKey bq;
- private final EntitySize br;
-
-+ public java.util.function.Supplier getEntityName = () -> IRegistry.ENTITY_TYPE.getKey(this).toString(); // Airplane - create lambda ones
-+
- private static EntityTypes a(String s, EntityTypes.Builder entitytypes_builder) { // CraftBukkit - decompile error
- return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_builder.a(s));
- }
-diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
-index 3e0bf6df7c4608a5b19024612db52558fd722f4b..3811ed82ef08f54af2f822a8b86a3838931dfab4 100644
---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
-+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
-@@ -651,7 +651,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
- return d2 * d2 + d3 * d3;
- }
-
-- private static int b(ChunkCoordIntPair chunkcoordintpair, EntityPlayer entityplayer, boolean flag) {
-+ // Airplane start - create copy that accepts x/z instead of allocating pair
-+ private static int b(ChunkCoordIntPair chunkcoordintpair, EntityPlayer entityplayer, boolean flag) { return someDistanceCalculation(chunkcoordintpair.x, chunkcoordintpair.z, entityplayer, flag); }
-+ private static int someDistanceCalculation(int x, int z, EntityPlayer entityplayer, boolean flag) {
- int i;
- int j;
-
-@@ -665,12 +667,16 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
- j = MathHelper.floor(entityplayer.locZ() / 16.0D);
- }
-
-- return a(chunkcoordintpair, i, j);
-+ return someOtherDistanceCalculation(x, z, i, j);
-+ // Airplane end
- }
-
-- private static int a(ChunkCoordIntPair chunkcoordintpair, int i, int j) {
-- int k = chunkcoordintpair.x - i;
-- int l = chunkcoordintpair.z - j;
-+ // Airplane start - create copy that accepts x/z instead of allocating pair
-+ private static int a(ChunkCoordIntPair chunkcoordintpair, int i, int j) { return someOtherDistanceCalculation(chunkcoordintpair.x, chunkcoordintpair.z, i, j); }
-+ private static int someOtherDistanceCalculation(int x, int z, int i, int j) {
-+ int k = x - i;
-+ int l = z - j;
-+ // Airplane end
-
- return Math.max(Math.abs(k), Math.abs(l));
- }
-@@ -2517,11 +2523,17 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
- boolean flag1 = this.tracker.attachedToPlayer;
-
- if (!flag1) {
-+ // Airplane start - use int/longs instead of ChunkCoordIntPair
-+ /*
- ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(this.tracker.chunkX, this.tracker.chunkZ);
-- PlayerChunk playerchunk = PlayerChunkMap.this.getVisibleChunk(chunkcoordintpair.pair());
-+ */
-+ int x = this.tracker.chunkX, z = this.tracker.chunkZ;
-+ long chunkcoordintpair = ChunkCoordIntPair.pair(x, z);
-+ PlayerChunk playerchunk = PlayerChunkMap.this.getVisibleChunk(chunkcoordintpair);
-
- if (playerchunk != null && playerchunk.getSendingChunk() != null && PlayerChunkMap.this.playerChunkManager.isChunkSent(entityplayer, MathHelper.floor(this.tracker.locX()) >> 4, MathHelper.floor(this.tracker.locZ()) >> 4)) { // Paper - no-tick view distance // Tuinity - don't broadcast in chunks the player hasn't received
-- flag1 = PlayerChunkMap.b(chunkcoordintpair, entityplayer, false) <= PlayerChunkMap.this.viewDistance;
-+ flag1 = PlayerChunkMap.someDistanceCalculation(x, z, entityplayer, false) <= PlayerChunkMap.this.viewDistance;
-+ // Airplane end
- }
- }
-
-@@ -2551,8 +2563,10 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
- }
-
- private int b() {
-+ // Airplane start
-+ int i = this.trackingDistance; // move out of if statement
-+ if (!this.tracker.passengers.isEmpty()) {
- Collection collection = this.tracker.getAllPassengers();
-- int i = this.trackingDistance;
- Iterator iterator = collection.iterator();
-
- while (iterator.hasNext()) {
-@@ -2564,6 +2578,8 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
- i = j;
- }
- }
-+ }
-+ // Airplane end
-
- return this.a(i);
- }
-diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
-index fbe9a9d9721daf78e77736080f0c319c80bd950f..30ff822fb0d1a973feb8fa0a34d024608cbabbcf 100644
---- a/src/main/java/net/minecraft/server/World.java
-+++ b/src/main/java/net/minecraft/server/World.java
-@@ -1041,19 +1041,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
-
- public void a(Consumer consumer, Entity entity) {
- try {
-- consumer.accept(entity);
-+ consumer.accept(entity); // Airplane - error on change
- } catch (Throwable throwable) {
- if (throwable instanceof ThreadDeath) throw throwable; // Paper
- // Paper start - Prevent tile entity and entity crashes
- String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ();
- System.err.println(msg);
- throwable.printStackTrace();
-- getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));
-+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); // Airplane - error on change
- entity.dead = true;
- return;
- // Paper end
- }
-- MinecraftServer.getServer().executeMidTickTasks(); // Tuinity - execute chunk tasks mid tick
-+ MinecraftServer.getServer().executeMidTickTasks(); // Tuinity - execute chunk tasks mid tick // Airplane - error on change
- }
- // Paper start - Prevent armor stands from doing entity lookups
- @Override
-diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
-index eca550800e9b0a09421ad29cb6a8b16f61806703..55c1aa26cbdee13ace1109215a1df087bf3503e9 100644
---- a/src/main/java/net/minecraft/server/WorldServer.java
-+++ b/src/main/java/net/minecraft/server/WorldServer.java
-@@ -992,7 +992,28 @@ public class WorldServer extends World implements GeneratorAccessSeed {
-
- gameprofilerfiller.enter("tick");
- if (!entity.dead && !(entity instanceof EntityComplexPart)) {
-+ // Airplane start - inline this.a to prevent creation of lambda
-+ /*
- this.a(this::entityJoinedWorld, entity);
-+ */
-+ boolean doMidTick = false; // usually there's a returns in the catch, so treat it like that
-+ try {
-+ this.entityJoinedWorld(entity);
-+ doMidTick = true;
-+ } catch (Throwable throwable) {
-+ if (throwable instanceof ThreadDeath) throw throwable; // Paper
-+ // Paper start - Prevent tile entity and entity crashes
-+ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ();
-+ System.err.println(msg);
-+ throwable.printStackTrace();
-+ getServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable)));
-+ entity.dead = true;
-+ // Paper end
-+ }
-+ if (doMidTick) {
-+ MinecraftServer.getServer().executeMidTickTasks(); // Tuinity - execute chunk tasks mid tick
-+ }
-+ // Airplane end
- }
-
- gameprofilerfiller.exit();
-@@ -1337,9 +1358,14 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- ++entity.ticksLived;
- GameProfilerFiller gameprofilerfiller = this.getMethodProfiler();
-
-+ // Airplane start - create debug lambda once, todo do we even WANT the method profiler?
-+ /*
- gameprofilerfiller.a(() -> {
- return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType()).toString();
- });
-+ */
-+ gameprofilerfiller.a(entity.getEntityType().getEntityName);
-+ // Airplane end
- gameprofilerfiller.c("tickNonPassenger");
- if (isActive) { // Paper - EAR 2
- TimingHistory.activatedEntityTicks++; // Paper
diff --git a/patches/server/0017-Skip-copying-unloading-tile-entities.patch b/patches/server/0017-Skip-copying-unloading-tile-entities.patch
deleted file mode 100644
index 5553461..0000000
--- a/patches/server/0017-Skip-copying-unloading-tile-entities.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sat, 13 Mar 2021 10:19:15 -0600
-Subject: [PATCH] Skip copying unloading tile entities
-
-
-diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
-index 30ff822fb0d1a973feb8fa0a34d024608cbabbcf..996fa5b4652f847f4e64d4cd191fe5a597471afe 100644
---- a/src/main/java/net/minecraft/server/World.java
-+++ b/src/main/java/net/minecraft/server/World.java
-@@ -44,7 +44,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
- //public final List tileEntityList = Lists.newArrayList(); // Paper - remove unused list
- public final List tileEntityListTick = Lists.newArrayList();
- protected final List tileEntityListPending = Lists.newArrayList();
-- protected final java.util.Set tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
-+ protected final java.util.Set tileEntityListUnload = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Airplane - use set with faster contains
- public final Thread serverThread;
- private final boolean debugWorld;
- private int d;
-@@ -924,12 +924,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
- gameprofilerfiller.enter("blockEntities");
- timings.tileEntityTick.startTiming(); // Spigot
- if (!this.tileEntityListUnload.isEmpty()) {
-+ // Airplane start - we just use the identitymap as the basis for the unload set now instead of copying
-+ /*
- // Paper start - Use alternate implementation with faster contains
- java.util.Set toRemove = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>());
- toRemove.addAll(tileEntityListUnload);
- this.tileEntityListTick.removeAll(toRemove);
- // Paper end
- //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list
-+ */
-+ this.tileEntityListTick.removeAll(this.tileEntityListUnload);
-+ // Airplane end
- this.tileEntityListUnload.clear();
- }
-
diff --git a/patches/server/0018-Reduce-entity-chunk-ticking-checks-from-3-to-1.patch b/patches/server/0018-Reduce-entity-chunk-ticking-checks-from-3-to-1.patch
deleted file mode 100644
index 0c18104..0000000
--- a/patches/server/0018-Reduce-entity-chunk-ticking-checks-from-3-to-1.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sat, 13 Mar 2021 10:40:22 -0600
-Subject: [PATCH] Reduce entity chunk ticking checks from 3 to 1
-
-
-diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
-index 55c1aa26cbdee13ace1109215a1df087bf3503e9..f4eb878f9a66fd3404ddde5a14924bb419a351db 100644
---- a/src/main/java/net/minecraft/server/WorldServer.java
-+++ b/src/main/java/net/minecraft/server/WorldServer.java
-@@ -968,11 +968,12 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- // CraftBukkit end */
-
- gameprofilerfiller.enter("checkDespawn");
-+ boolean entityTickingChunk = false; if (!entity.dead) entityTickingChunk = this.getChunkProvider().isInEntityTickingChunk(entity); // Airplane - check once, chunks won't unload ticking entities
- if (!entity.dead) {
- entity.checkDespawn();
- // Tuinity start - optimise notify()
- if (entity.inChunk && entity.valid) {
-- if (this.getChunkProvider().isInEntityTickingChunk(entity)) {
-+ if (entityTickingChunk) { // Airplane - reuse
- this.updateNavigatorsInRegion(entity);
- }
- } else {
-@@ -998,7 +999,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- */
- boolean doMidTick = false; // usually there's a returns in the catch, so treat it like that
- try {
-- this.entityJoinedWorld(entity);
-+ this.entityJoinedWorld(entity, entityTickingChunk); // Airplane - reuse
- doMidTick = true;
- } catch (Throwable throwable) {
- if (throwable instanceof ThreadDeath) throw throwable; // Paper
-@@ -1023,7 +1024,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- this.entitiesById.remove(entity.getId()); // Tuinity
- this.unregisterEntity(entity);
- } else if (entity.inChunk && entity.valid) { // Tuinity start - optimise notify()
-- if (this.getChunkProvider().isInEntityTickingChunk(entity)) {
-+ if (entityTickingChunk) { // Airplane - reuse
- this.updateNavigatorsInRegion(entity);
- }
- } else {
-@@ -1324,7 +1325,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- }
- // Tuinity end - log detailed entity tick information
-
-- public void entityJoinedWorld(Entity entity) {
-+ // Airplane start - reuse check for in entity ticking chunk
-+ public void entityJoinedWorld(Entity entity) { entityJoinedWorld(entity, this.getChunkProvider().isInEntityTickingChunk(entity)); }
-+ public void entityJoinedWorld(Entity entity, boolean entityTickingChunk) { // Airplane end
- // Tuinity start - log detailed entity tick information
- com.tuinity.tuinity.util.TickThread.ensureTickThread("Cannot tick an entity off-main");
- try {
-@@ -1332,7 +1335,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- currentlyTickingEntity.lazySet(entity);
- }
- // Tuinity end - log detailed entity tick information
-- if (!(entity instanceof EntityHuman) && !this.getChunkProvider().a(entity)) {
-+ if (!(entity instanceof EntityHuman) && !entityTickingChunk) { // Airplane - reuse
- this.chunkCheck(entity);
- } else {
- ++TimingHistory.entityTicks; // Paper - timings
diff --git a/patches/server/0019-Remove-iterators-from-inventory-contains.patch b/patches/server/0019-Remove-iterators-from-inventory-contains.patch
deleted file mode 100644
index a8bafde..0000000
--- a/patches/server/0019-Remove-iterators-from-inventory-contains.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sat, 13 Mar 2021 12:24:41 -0600
-Subject: [PATCH] Remove iterators from inventory contains
-
-
-diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java
-index 3b65711b91c51ac7b4b5b2b0144ffd279fe60eeb..478f33dbbd0b5a9b81ee420f77c97fa8c40e27d6 100644
---- a/src/main/java/net/minecraft/server/PlayerInventory.java
-+++ b/src/main/java/net/minecraft/server/PlayerInventory.java
-@@ -609,6 +609,8 @@ public class PlayerInventory implements IInventory, INamableTileEntity {
- }
-
- public boolean h(ItemStack itemstack) {
-+ // Airplane start - skip using abstract iterators and stuff, they're generic and slow and allocating them sucks
-+ /*
- Iterator iterator = this.f.iterator();
-
- while (iterator.hasNext()) {
-@@ -623,6 +625,20 @@ public class PlayerInventory implements IInventory, INamableTileEntity {
- }
- }
- }
-+ */
-+ List> components = this.getComponents();
-+ for (int i = 0; i < components.size(); i++) {
-+ List list = components.get(i);
-+
-+ for (int j = 0; j < list.size(); j++) {
-+ ItemStack itemstack1 = list.get(j);
-+
-+ if (!itemstack1.isEmpty() && itemstack1.doMaterialsMatch(itemstack)) {
-+ return true;
-+ }
-+ }
-+ }
-+ // Airplane end
-
- return false;
- }
diff --git a/patches/server/0020-Cache-entityhuman-display-name.patch b/patches/server/0020-Cache-entityhuman-display-name.patch
deleted file mode 100644
index 6758f2b..0000000
--- a/patches/server/0020-Cache-entityhuman-display-name.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sat, 13 Mar 2021 14:02:04 -0600
-Subject: [PATCH] Cache entityhuman display name
-
-
-diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
-index f034977f4666385d6e7c7288e453d058c270be01..48a820e34d45623432a3dc3b01d0bba8824c6414 100644
---- a/src/main/java/net/minecraft/server/EntityHuman.java
-+++ b/src/main/java/net/minecraft/server/EntityHuman.java
-@@ -65,7 +65,8 @@ public abstract class EntityHuman extends EntityLiving {
- protected int bG;
- protected final float bH = 0.02F;
- private int g;
-- private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; } // Paper - OBFHELPER
-+ private IChatBaseComponent displayName; // Airplane - cache displayName
-+ private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; this.displayName = null; } // Paper - OBFHELPER // Airplane - use to reset displayName
- private ItemStack bL;
- private final ItemCooldown bM;
- @Nullable
-@@ -1731,7 +1732,12 @@ public abstract class EntityHuman extends EntityLiving {
-
- @Override
- public IChatBaseComponent getDisplayName() {
-- return new ChatComponentText(this.bJ.getName());
-+ // Airplane start - cache display name
-+ if (this.displayName == null) {
-+ this.displayName = new ChatComponentText(this.getProfile().getName());
-+ }
-+ return this.displayName;
-+ // Airplane end
- }
-
- public InventoryEnderChest getEnderChest() {
diff --git a/patches/server/0021-Early-return-optimization-for-target-finding.patch b/patches/server/0021-Early-return-optimization-for-target-finding.patch
deleted file mode 100644
index 6270db1..0000000
--- a/patches/server/0021-Early-return-optimization-for-target-finding.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Paul Sauve
-Date: Sat, 13 Mar 2021 15:05:28 -0600
-Subject: [PATCH] Early return optimization for target finding
-
-
-diff --git a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java
-index 3ebe3d0dc4c2c6aee6ea349006a74cbe5aa8e78f..7b80f6f08f274fd1adff114a81919bf41bf2cd53 100644
---- a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java
-+++ b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java
-@@ -80,9 +80,17 @@ public class PathfinderTargetCondition {
- }
-
- if (this.b > 0.0D) {
-+ // Airplane start - try to return early
-+ double range = (useFollowRange ? getFollowRange(entityliving) : this.b);
-+ double d2 = entityliving.h(entityliving1.locX(), entityliving1.locY(), entityliving1.locZ()); // move up here to use early
-+
-+ if (d2 > range * range) { // if they're further than the absolute furthest allowed, they don't match
-+ return false;
-+ }
-+
- double d0 = this.g ? entityliving1.A(entityliving) : 1.0D;
-- double d1 = Math.max((useFollowRange ? getFollowRange(entityliving) : this.b) * d0, 2.0D); // Paper
-- double d2 = entityliving.h(entityliving1.locX(), entityliving1.locY(), entityliving1.locZ());
-+ double d1 = Math.max(range * d0, 2.0D); // Paper // Airplane - reuse range calculated above
-+ // Airplane end
-
- if (d2 > d1 * d1) {
- return false;