diff --git a/Paper b/Paper index 2c6b1f048..3dcbdc73b 160000 --- a/Paper +++ b/Paper @@ -1 +1 @@ -Subproject commit 2c6b1f048dd03e31678293dacf243124dacb1fea +Subproject commit 3dcbdc73bd7b5cc15806da319c0bdec2d6c968d7 diff --git a/patches/server/0001-Tuinity-Server-Changes.patch b/patches/server/0001-Tuinity-Server-Changes.patch index d3eb1fb0e..5917dff0a 100644 --- a/patches/server/0001-Tuinity-Server-Changes.patch +++ b/patches/server/0001-Tuinity-Server-Changes.patch @@ -10935,7 +10935,7 @@ index 1d72af9cace7aa8f1d20c7c1c5be621f533e2dad..b7399d17dd64ca8b1f1fab405cb0ac91 worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); worldData.addProperty("visible-chunk-count", visibleChunks.size()); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d69ddb0236c8553cf63c4a007dfa7b87e8f58299..38547858a415ac36d6c04070d27933a6552b1612 100644 +index 848219f43b2bcb2d79147107c68df52efd46d461..72d1c1202581abc284848000663ada5514cfcb15 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -268,6 +268,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; public boolean serverAutoSave = false; // Paper -@@ -878,10 +879,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { @@ -11102,7 +11102,7 @@ index d69ddb0236c8553cf63c4a007dfa7b87e8f58299..38547858a415ac36d6c04070d27933a6 return !this.canOversleep(); }); isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); -@@ -1393,6 +1453,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant dynamic = (Dynamic) typed1.get(DSL.remainderFinder()); -- boolean flag = dynamic.get("TerrainPopulated").asBoolean(false) && (!dynamic.get("LightPopulated").asNumber().result().isPresent() || dynamic.get("LightPopulated").asBoolean(false)); -- -- dynamic = dynamic.set("Status", dynamic.createString(flag ? "mobs_spawned" : "empty")); -+ // Tuinity start - fix incorrect status conversion -+ // Vanilla is setting chunks to incorrect status here, they should be using at minimum carved. -+ // for populated chunks, it should be at minimum decorated -+ // and for lit and populated, mobs_spawned is correct (technically mobs_spawned should be for populated, -+ // but if it's not lit then it can't be set above lit) -+ final boolean terrainPopulated = dynamic.get("TerrainPopulated").asBoolean(false); -+ final boolean lightPopulated = dynamic.get("LightPopulated").asBoolean(false) || dynamic.get("LightPopulated").asNumber().result().isPresent(); -+ final String newStatus = !terrainPopulated ? "carved" : (lightPopulated ? "mobs_spawned" : "decorated"); -+ -+ dynamic = dynamic.set("Status", dynamic.createString(newStatus)); - dynamic = dynamic.set("hasLegacyStructureData", dynamic.createBoolean(true)); -- Dynamic dynamic1; -+ // Tuinity end - fix incorrect status conversion -+ Dynamic dynamic1; // Tuinity - decompile fix - -- if (flag) { -+ if (true) { // Tuinity - fix incorrect status conversion - Optional optional1 = dynamic.get("Biomes").asByteBufferOpt().result(); - - if (optional1.isPresent()) { -@@ -70,7 +78,7 @@ public class DataConverterProtoChunk extends DataFix { - }).collect(Collectors.toList()); - - if (optional.isPresent()) { -- ((Stream) optional.get()).forEach((dynamic2) -> { -+ optional.get().forEach((dynamic2) -> { // Tuinity - decompile fix - int j = dynamic2.get("x").asInt(0); - int k = dynamic2.get("y").asInt(0); - int l = dynamic2.get("z").asInt(0); -@@ -78,11 +86,11 @@ public class DataConverterProtoChunk extends DataFix { - - ((ShortList) list.get(k >> 4)).add(short0); - }); -+ Dynamic finalDynamic = dynamic; // Tuinity - decompile fix - dynamic = dynamic.set("ToBeTicked", dynamic.createList(list.stream().map((shortlist) -> { -- Stream stream = shortlist.stream(); -+ Stream stream = shortlist.stream(); // Tuinity - decompile fix - -- dynamic.getClass(); -- return dynamic.createList(stream.map(dynamic::createShort)); -+ return finalDynamic.createList(stream.map(finalDynamic::createShort)); - }))); - } - diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java -index a4970654496c52fcd02c5c055ff5ac551bd19da3..6725b31a5183d5af7f8f7566ed21eb61797ef4c9 100644 +index dca2e9e45116df22d8c95d1be8f0a7e3c2d2b6b1..cb394ec310712cc97d65afe068284b277d7f0483 100644 --- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java +++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java @@ -235,7 +235,7 @@ public class WorldUpgrader { @@ -17306,7 +17251,7 @@ index 03584572fa5bf0d96fc4cecece573547f9c94cea..8bc965a3b3d0d4140c6b94636f0b33b2 } diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java -index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a65530686a539 100644 +index f7f593a9e58b537109fa6ca1c783f6614f4bfad5..276b1f0c9c9af7db31fba9be0593ae9def540caf 100644 --- a/src/main/java/net/minecraft/world/level/World.java +++ b/src/main/java/net/minecraft/world/level/World.java @@ -154,6 +154,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -17318,9 +17263,9 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPosition lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; -@@ -181,10 +183,70 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return typeKey; +@@ -190,10 +192,70 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } + // Paper end - fix and optimise world upgrading + // Tuinity start - optimise checkDespawn + public final List getNearbyPlayers(@Nullable Entity source, double sourceX, double sourceY, double sourceZ, double maxRange, @Nullable Predicate predicate) { @@ -17389,7 +17334,7 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit -@@ -346,6 +408,15 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -355,6 +417,15 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @Override public final Chunk getChunkAt(int i, int j) { // Paper - final to help inline @@ -17405,7 +17350,7 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 return (Chunk) this.getChunkAt(i, j, ChunkStatus.FULL, true); // Paper - avoid a method jump } -@@ -420,6 +491,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -429,6 +500,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @Override public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { @@ -17413,7 +17358,7 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 // CraftBukkit start - tree generation if (this.captureTreeGeneration) { // Paper start -@@ -521,6 +593,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -530,6 +602,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start - Split off from above in order to directly send client and physic updates public void notifyAndUpdatePhysics(BlockPosition blockposition, Chunk chunk, IBlockData oldBlock, IBlockData newBlock, IBlockData actualBlock, int i, int j) { @@ -17421,7 +17366,7 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 IBlockData iblockdata = newBlock; IBlockData iblockdata1 = oldBlock; IBlockData iblockdata2 = actualBlock; -@@ -533,7 +606,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -542,7 +615,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.notify(blockposition, iblockdata1, iblockdata, i); // Paper start - per player view distance - allow block updates for non-ticking chunks in player view distance // if copied from above @@ -17430,7 +17375,7 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 ((WorldServer)this).getChunkProvider().flagDirty(blockposition); // Paper end - per player view distance } -@@ -955,6 +1028,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -964,6 +1037,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return; // Paper end } @@ -17438,7 +17383,7 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 } // Paper start - Prevent armor stands from doing entity lookups @Override -@@ -1138,10 +1212,44 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1147,10 +1221,44 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return this.getChunkAt(i, j, ChunkStatus.FULL, false); } @@ -17484,7 +17429,7 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); int j = MathHelper.floor((axisalignedbb.maxX + 2.0D) / 16.0D); int k = MathHelper.floor((axisalignedbb.minZ - 2.0D) / 16.0D); -@@ -1197,7 +1305,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1206,7 +1314,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { Chunk chunk = (Chunk)this.getChunkIfLoadedImmediately(i1, j1); // Paper if (chunk != null) { @@ -17493,7 +17438,7 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 } } } -@@ -1220,7 +1328,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1229,7 +1337,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { Chunk chunk = (Chunk)this.getChunkIfLoadedImmediately(i1, j1); // Paper if (chunk != null) { @@ -17502,7 +17447,7 @@ index 6581fe0d93a5c2e7b444a44c01726e02d4a28e63..af01f5d635eada7175b9d7fdb47a6553 } } } -@@ -1228,6 +1336,106 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1237,6 +1345,106 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return list; } @@ -18997,7 +18942,7 @@ index 4eaf497d048324a85ce49fc1c6e9559991c20df7..ec2b238480413ba9c123d9ddeaa787d9 BiomeStorage biomestorage = ichunkaccess.getBiomeIndex(); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java -index 890362d28ab9cb760c73fe5014e144fb08ada6b8..8c4e87b9404cfe2fedd0c345983f64cad16f32a0 100644 +index e20b9e6c46093d48d5fa5eb3006087d4e998c205..2d03f5710bcbb059e9ce4761e00349e527e937c0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java @@ -39,13 +39,14 @@ public class IChunkLoader implements AutoCloseable { @@ -19690,10 +19635,10 @@ index c96eac4b0b519b2807153fa5a8ebf5a020a2b140..b5c8d9b17c2d5e229db5b48448709194 int j = 0; diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java -index ebb0d6988f87013ea5d523ab4a1b31cb669ccc43..68cdbe184cd2e490595900d988c64f2011e47495 100644 +index 74d826853389b8e01ffe2b076cf2b179d29da216..71db36d61a02a104449f8634b2737928874190f6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java -@@ -22,12 +22,43 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final +@@ -22,13 +22,19 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final public final Long2ObjectLinkedOpenHashMap cache = new Long2ObjectLinkedOpenHashMap(); private final File b; private final boolean c; @@ -19710,34 +19655,11 @@ index ebb0d6988f87013ea5d523ab4a1b31cb669ccc43..68cdbe184cd2e490595900d988c64f20 this.c = flag; } -+ // Tuinity start -+ public static ChunkCoordIntPair getRegionFileCoordinates(File file) { -+ String fileName = file.getName(); -+ if (!fileName.startsWith("r.") || !fileName.endsWith(".mca")) { -+ return null; -+ } -+ -+ String[] split = fileName.split("\\."); -+ -+ if (split.length != 4) { -+ return null; -+ } -+ -+ try { -+ int x = Integer.parseInt(split[1]); -+ int z = Integer.parseInt(split[2]); -+ -+ return new ChunkCoordIntPair(x << 5, z << 5); -+ } catch (NumberFormatException ex) { -+ return null; -+ } -+ } -+ // Tuinity end -+ - +- // Paper start - public synchronized RegionFile getRegionFileIfLoaded(ChunkCoordIntPair chunkcoordintpair) { // Paper - synchronize for async io -@@ -61,9 +92,9 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final + public static ChunkCoordIntPair getRegionFileCoordinates(File file) { + String fileName = file.getName(); +@@ -83,9 +89,9 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final this.b.mkdirs(); } @@ -19749,7 +19671,7 @@ index ebb0d6988f87013ea5d523ab4a1b31cb669ccc43..68cdbe184cd2e490595900d988c64f20 this.cache.putAndMoveToFirst(i, regionfile1); // Paper start -@@ -152,6 +183,13 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final +@@ -174,6 +180,13 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final return null; } // CraftBukkit end @@ -19763,7 +19685,7 @@ index ebb0d6988f87013ea5d523ab4a1b31cb669ccc43..68cdbe184cd2e490595900d988c64f20 try { // Paper DataInputStream datainputstream = regionfile.a(chunkcoordintpair); // Paper start -@@ -167,6 +205,17 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final +@@ -189,6 +202,17 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final try { if (datainputstream != null) { nbttagcompound = NBTCompressedStreamTools.a((DataInput) datainputstream); @@ -20718,7 +20640,7 @@ index e50731723d266ba65b2163df2e935afb8b013a93..a6736d15282715d920bab85eb92074cd } value.append("},"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c51e9b50323f5e33bad5fd25d74c572241377059..d02b8d4b7883f235894550514a6abae81651af82 100644 +index ff79c13bc7717eb9529e802b8e31a1f756b02f97..0e9819a7da160e7a5f28734c4dd3b673c8881792 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -230,7 +230,7 @@ import javax.annotation.Nullable; // Paper @@ -20746,7 +20668,7 @@ index c51e9b50323f5e33bad5fd25d74c572241377059..d02b8d4b7883f235894550514a6abae8 } Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper -@@ -1932,7 +1934,10 @@ public final class CraftServer implements Server { +@@ -1933,7 +1935,10 @@ public final class CraftServer implements Server { @Override public boolean isPrimaryThread() { @@ -20758,7 +20680,7 @@ index c51e9b50323f5e33bad5fd25d74c572241377059..d02b8d4b7883f235894550514a6abae8 } // Paper start -@@ -2366,6 +2371,14 @@ public final class CraftServer implements Server { +@@ -2367,6 +2372,14 @@ public final class CraftServer implements Server { return com.destroystokyo.paper.PaperConfig.config; } diff --git a/patches/server/0002-Airplane-Server-Changes.patch b/patches/server/0002-Airplane-Server-Changes.patch index 31432b87d..9b50625e2 100644 --- a/patches/server/0002-Airplane-Server-Changes.patch +++ b/patches/server/0002-Airplane-Server-Changes.patch @@ -1562,6 +1562,117 @@ index 0000000000000000000000000000000000000000..aa8467b9dda1f7707e41f50ac7b3e9d7 + this.entries[toRemovePos] = new FluidDirectionEntry(data, flag); + } +} +diff --git a/src/main/java/gg/airplane/structs/ItemListWithBitset.java b/src/main/java/gg/airplane/structs/ItemListWithBitset.java +new file mode 100644 +index 0000000000000000000000000000000000000000..bd3b58cb1a48da2f5259b0c64290b2be2ff1fdf7 +--- /dev/null ++++ b/src/main/java/gg/airplane/structs/ItemListWithBitset.java +@@ -0,0 +1,105 @@ ++package gg.airplane.structs; ++ ++import net.minecraft.core.NonNullList; ++import net.minecraft.world.item.ItemStack; ++import org.apache.commons.lang.Validate; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.Arrays; ++ ++public class ItemListWithBitset extends NonNullList { ++ public static ItemListWithBitset fromNonNullList(NonNullList list) { ++ if (list instanceof ItemListWithBitset) { ++ return (ItemListWithBitset) list; ++ } ++ return new ItemListWithBitset(list); ++ } ++ ++ private static ItemStack[] createArray(int size) { ++ ItemStack[] array = new ItemStack[size]; ++ Arrays.fill(array, ItemStack.NULL_ITEM); ++ return array; ++ } ++ ++ private final ItemStack[] items; ++ ++ private int bitSet = 0; ++ private final int allBits; ++ ++ private ItemListWithBitset(NonNullList list) { ++ this(list.size()); ++ ++ for (int i = 0; i < list.size(); i++) { ++ this.set(i, list.get(i)); ++ } ++ } ++ ++ public ItemListWithBitset(int size) { ++ super(null, ItemStack.NULL_ITEM); ++ ++ Validate.isTrue(size < Integer.BYTES * 8, "size is too large"); ++ ++ this.items = createArray(size); ++ this.allBits = ((1 << size) - 1); ++ } ++ ++ public boolean isCompletelyEmpty() { ++ return this.bitSet == 0; ++ } ++ ++ public boolean hasFullStacks() { ++ return (this.bitSet & this.allBits) == allBits; ++ } ++ ++ @Override ++ public ItemStack set(int index, ItemStack itemStack) { ++ ItemStack existing = this.items[index]; ++ ++ this.items[index] = itemStack; ++ ++ if (itemStack == ItemStack.NULL_ITEM) { ++ this.bitSet &= ~(1 << index); ++ } else { ++ this.bitSet |= 1 << index; ++ } ++ ++ return existing; ++ } ++ ++ @NotNull ++ @Override ++ public ItemStack get(int var0) { ++ return this.items[var0]; ++ } ++ ++ @Override ++ public int size() { ++ return this.items.length; ++ } ++ ++ @Override ++ public void clear() { ++ Arrays.fill(this.items, ItemStack.NULL_ITEM); ++ } ++ ++ // these are unsupported for block inventories which have a static size ++ @Override ++ public void add(int var0, ItemStack var1) { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public ItemStack remove(int var0) { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public String toString() { ++ return "ItemListWithBitset{" + ++ "items=" + Arrays.toString(items) + ++ ", bitSet=" + Long.toString(bitSet, 2) + ++ ", allBits=" + Long.toString(allBits, 2) + ++ ", size=" + this.items.length + ++ '}'; ++ } ++} diff --git a/src/main/java/gg/airplane/structs/LinkedHashSetArrayList.java b/src/main/java/gg/airplane/structs/LinkedHashSetArrayList.java new file mode 100644 index 0000000000000000000000000000000000000000..36eea0acd815e08e0be10bf55541ea0bb605b8f5 @@ -1648,10 +1759,10 @@ index 7918d830a4aef09c9f517284e83a9376299116ad..0a40df2151bd388b6633a6f50b14f1f4 return enumdirection; })); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 38547858a415ac36d6c04070d27933a6552b1612..073df4e4e21b7a57e8d4159e2c5d68bda11e3d51 100644 +index 72d1c1202581abc284848000663ada5514cfcb15..06d0592bebaefc16c1995781a9e8a3554f4a3205 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1647,7 +1647,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant iterator = this.entityTickingChunks.iterator(); ++ // Airplane start - use raw iterator ++ //com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet.Iterator iterator = this.entityTickingChunks.iterator(); ++ int iterator = this.entityTickingChunks.createRawIterator(); + try { +- while (iterator.hasNext()) { +- Chunk chunk = iterator.next(); ++ while (iterator != -1) { ++ Chunk chunk = this.entityTickingChunks.rawGet(iterator); + PlayerChunk playerchunk = chunk.playerChunk; + if (playerchunk != null) { // make sure load event has been called along with the load logic we put there + // Tuinity end - optimise chunk tick iteration +@@ -1063,10 +1066,12 @@ public class ChunkProviderServer extends IChunkProvider { + } + } + } ++ iterator = this.entityTickingChunks.advanceRawIterator(iterator); + } // Tuinity start - optimise chunk tick iteration + } finally { +- iterator.finishedIterating(); ++ this.entityTickingChunks.finishRawIterator(); + } ++ // Airplane end + // Tuinity end - optimise chunk tick iteration + this.world.getMethodProfiler().enter("customSpawners"); + if (flag1) { +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +index 67ca28463f5add7c18f7f16b918c3f36f8feeeda..6aad662d823e0a64b8e18156b5f084399bc4f228 100644 +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +@@ -186,6 +186,7 @@ public class EntityTrackerEntry { + boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; + + if (!flag4 && this.o <= 400 && !this.q && this.r == this.tracker.isOnGround() && !(com.tuinity.tuinity.config.TuinityConfig.sendFullPosForHardCollidingEntities && this.tracker.hardCollides())) { // Tuinity - send full pos for hard colliding entities to prevent collision problems due to desync ++ if (flag2 || flag3 || this.tracker instanceof EntityArrow) { // Airplane + if ((!flag2 || !flag3) && !(this.tracker instanceof EntityArrow)) { + if (flag2) { + packet1 = new PacketPlayOutEntity.PacketPlayOutRelEntityMove(this.tracker.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.tracker.isOnGround()); +@@ -195,6 +196,7 @@ public class EntityTrackerEntry { + } else { + packet1 = new PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook(this.tracker.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.tracker.isOnGround()); + } ++ } // Airplane + } else { + this.r = this.tracker.isOnGround(); + this.o = 0; diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 86f156587a0939b28c5cf6f64907255c1c4f8b35..06157bb07cce3ba24087ceaca7138b5609b37b5b 100644 --- a/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -1741,7 +1902,7 @@ index 86f156587a0939b28c5cf6f64907255c1c4f8b35..06157bb07cce3ba24087ceaca7138b56 this.u = playerchunk_c; this.players = playerchunk_d; diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java -index 33429be7da4d4c2b2469b8140e46e66d9921652c..0b48961a18da76dd25c0930f393f0ac9f709ad78 100644 +index 33429be7da4d4c2b2469b8140e46e66d9921652c..c0d2b7fe726ea92e18871e3714ca9c249492ac93 100644 --- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -705,7 +705,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -1776,7 +1937,39 @@ index 33429be7da4d4c2b2469b8140e46e66d9921652c..0b48961a18da76dd25c0930f393f0ac9 return Math.max(Math.abs(k), Math.abs(l)); } -@@ -2549,11 +2555,17 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -2170,10 +2176,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + private final void processTrackQueue() { + this.world.timings.tracker1.startTiming(); + try { +- com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet.Iterator iterator = this.world.getChunkProvider().entityTickingChunks.iterator(); ++ // Airplane start - raw iterator ++ //com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet.Iterator iterator = this.world.getChunkProvider().entityTickingChunks.iterator(); ++ com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet chunks = this.world.getChunkProvider().entityTickingChunks; ++ int iterator = chunks.createRawIterator(); + try { +- while (iterator.hasNext()) { +- Chunk chunk = iterator.next(); ++ while (iterator != -1) { ++ Chunk chunk = chunks.rawGet(iterator); + Entity[] entities = chunk.entities.getRawData(); + for (int i = 0, len = chunk.entities.size(); i < len; ++i) { + Entity entity = entities[i]; +@@ -2183,10 +2192,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + tracker.trackerEntry.tick(); + } + } ++ ++ iterator = chunks.advanceRawIterator(iterator); + } + } finally { +- iterator.finishedIterating(); ++ chunks.finishRawIterator(); + } ++ // Airplane end + } finally { + this.world.timings.tracker1.stopTiming(); + } +@@ -2549,11 +2561,17 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially boolean flag1 = this.tracker.attachedToPlayer; if (!flag1) { @@ -1796,7 +1989,7 @@ index 33429be7da4d4c2b2469b8140e46e66d9921652c..0b48961a18da76dd25c0930f393f0ac9 } } -@@ -2583,8 +2595,10 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -2583,8 +2601,10 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially } private int b() { @@ -1808,7 +2001,7 @@ index 33429be7da4d4c2b2469b8140e46e66d9921652c..0b48961a18da76dd25c0930f393f0ac9 Iterator iterator = collection.iterator(); while (iterator.hasNext()) { -@@ -2596,6 +2610,8 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -2596,6 +2616,8 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially i = j; } } @@ -1818,10 +2011,33 @@ index 33429be7da4d4c2b2469b8140e46e66d9921652c..0b48961a18da76dd25c0930f393f0ac9 return this.a(i); } diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java -index 479605b5f8660b6968027a3d7b59075a04e44521..4ed80e3bda7f984fa00320be647ac450c94fd72b 100644 +index 479605b5f8660b6968027a3d7b59075a04e44521..a7e34fc3f648ebc7b9d3f0ea5aae527680f54829 100644 --- a/src/main/java/net/minecraft/server/level/WorldServer.java +++ b/src/main/java/net/minecraft/server/level/WorldServer.java -@@ -1107,7 +1107,28 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -846,6 +846,22 @@ public class WorldServer extends World implements GeneratorAccessSeed { + return result; + } + ++ // Airplane start - skip type lookup if already completed, but still run check ++ public TileEntity getAndCheckTileEntity(IBlockData data, BlockPosition pos) { ++ TileEntity result = super.getTileEntity(pos, false); ++ Block type = data.getBlock(); ++ ++ // copied from above ++ if (result != null && type != Blocks.AIR) { ++ if (!result.getTileType().isValidBlock(type)) { ++ result = fixTileEntity(pos, type, result); ++ } ++ } ++ ++ return result; ++ } ++ // Airplane end ++ + private TileEntity fixTileEntity(BlockPosition pos, Block type, TileEntity found) { + this.getServer().getLogger().log(Level.SEVERE, "Block at {0}, {1}, {2} is {3} but has {4}" + ". " + + "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.", new Object[]{pos.getX(), pos.getY(), pos.getZ(), type, found}); +@@ -1107,7 +1123,28 @@ public class WorldServer extends World implements GeneratorAccessSeed { gameprofilerfiller.enter("tick"); if (!entity.dead && !(entity instanceof EntityComplexPart)) { @@ -1850,7 +2066,7 @@ index 479605b5f8660b6968027a3d7b59075a04e44521..4ed80e3bda7f984fa00320be647ac450 } gameprofilerfiller.exit(); -@@ -1202,6 +1223,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1202,6 +1239,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { private final BiomeBase[] biomeBaseCache = new BiomeBase[1]; // Tuinity end - optimise chunk ice snow ticking @@ -1859,7 +2075,7 @@ index 479605b5f8660b6968027a3d7b59075a04e44521..4ed80e3bda7f984fa00320be647ac450 public void a(Chunk chunk, int i) { final int randomTickSpeed = i; // Paper ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); boolean flag = this.isRaining(); -@@ -1212,7 +1235,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1212,7 +1251,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 @@ -1868,7 +2084,7 @@ index 479605b5f8660b6968027a3d7b59075a04e44521..4ed80e3bda7f984fa00320be647ac450 blockposition.setValues(this.a(this.a(j, 0, k, 15))); // Paper if (this.isRainingAt(blockposition)) { DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition); -@@ -1236,7 +1259,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1236,7 +1275,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } gameprofilerfiller.exitEnter("iceandsnow"); @@ -1877,7 +2093,7 @@ index 479605b5f8660b6968027a3d7b59075a04e44521..4ed80e3bda7f984fa00320be647ac450 // Paper start - optimise chunk ticking // Tuinity start - optimise chunk ice snow ticking BiomeBase[] biomeCache = this.biomeBaseCache; -@@ -1449,9 +1472,14 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1449,9 +1488,14 @@ public class WorldServer extends World implements GeneratorAccessSeed { ++entity.ticksLived; GameProfilerFiller gameprofilerfiller = this.getMethodProfiler(); @@ -1920,6 +2136,132 @@ index cc566784c7dd21cc2c44e0f351347f657e57ddcf..e9e7fcf2b63febe2a7d055826fabb86b public static int k(double d0) { return d0 == 0.0D ? 0 : (d0 > 0.0D ? 1 : -1); } +diff --git a/src/main/java/net/minecraft/world/IInventory.java b/src/main/java/net/minecraft/world/IInventory.java +index 774ba6a923f7e329f6af5efc17e1c46e87ed2d77..8faf3850f4c965feec42f6998563b7265a8f599e 100644 +--- a/src/main/java/net/minecraft/world/IInventory.java ++++ b/src/main/java/net/minecraft/world/IInventory.java +@@ -1,6 +1,8 @@ + package net.minecraft.world; + + import java.util.Set; ++ ++import net.minecraft.core.EnumDirection; // Airplane + import net.minecraft.world.entity.player.EntityHuman; + import net.minecraft.world.item.Item; + import net.minecraft.world.item.ItemStack; +@@ -18,6 +20,70 @@ public interface IInventory extends Clearable { + + ItemStack getItem(int i); + ++ // Airplane start - allow the inventory to override and optimize these frequent calls ++ default boolean hasEmptySlot(EnumDirection enumdirection) { // there is a slot with 0 items in it ++ if (this instanceof IWorldInventory) { ++ for (int i : ((IWorldInventory) this).getSlotsForFace(enumdirection)) { ++ if (this.getHopperItem(i).isEmpty()) { ++ return true; ++ } ++ } ++ } else { ++ int size = this.getSize(); ++ for (int i = 0; i < size; i++) { ++ if (this.getHopperItem(i).isEmpty()) { ++ return true; ++ } ++ } ++ } ++ return false; ++ } ++ ++ default boolean isCompletelyFull(EnumDirection enumdirection) { // every stack is maxed ++ if (this instanceof IWorldInventory) { ++ for (int i : ((IWorldInventory) this).getSlotsForFace(enumdirection)) { ++ ItemStack itemStack = this.getHopperItem(i); ++ if (itemStack.getCount() < itemStack.getMaxStackSize()) { ++ return false; ++ } ++ } ++ } else { ++ int size = this.getSize(); ++ for (int i = 0; i < size; i++) { ++ ItemStack itemStack = this.getHopperItem(i); ++ if (itemStack.getCount() < itemStack.getMaxStackSize()) { ++ return false; ++ } ++ } ++ } ++ return true; ++ } ++ ++ default boolean isCompletelyEmpty(EnumDirection enumdirection) { ++ if (this instanceof IWorldInventory) { ++ for (int i : ((IWorldInventory) this).getSlotsForFace(enumdirection)) { ++ if (!this.getHopperItem(i).isEmpty()) { ++ return false; ++ } ++ } ++ } else { ++ int size = this.getSize(); ++ for (int i = 0; i < size; i++) { ++ if (!this.getHopperItem(i).isEmpty()) { ++ return false; ++ } ++ } ++ } ++ return true; ++ } ++ // Airplane end ++ ++ // Airplane start - way for inventories to know it's a hopper, skipping certain steps ++ default ItemStack getHopperItem(int index) { ++ return this.getItem(index); ++ } ++ // Airplane end ++ + ItemStack splitStack(int i, int j); + + ItemStack splitWithoutUpdate(int i); +diff --git a/src/main/java/net/minecraft/world/InventoryLargeChest.java b/src/main/java/net/minecraft/world/InventoryLargeChest.java +index 92818df3689e35b921eb04678c84d2dd4b21ddbe..f6b723062a9cd0667efcc0171df71e9df93def06 100644 +--- a/src/main/java/net/minecraft/world/InventoryLargeChest.java ++++ b/src/main/java/net/minecraft/world/InventoryLargeChest.java +@@ -1,5 +1,6 @@ + package net.minecraft.world; + ++import net.minecraft.core.EnumDirection; // Airplane + import net.minecraft.world.entity.player.EntityHuman; + import net.minecraft.world.item.ItemStack; + +@@ -91,6 +92,30 @@ public class InventoryLargeChest implements IInventory { + return i >= this.left.getSize() ? this.right.getItem(i - this.left.getSize()) : this.left.getItem(i); + } + ++ // Airplane start ++ @Override ++ public boolean hasEmptySlot(EnumDirection enumdirection) { ++ return this.left.hasEmptySlot(null) || this.right.hasEmptySlot(null); ++ } ++ ++ @Override ++ public boolean isCompletelyFull(EnumDirection enumdirection) { ++ return this.left.isCompletelyFull(null) && this.right.isCompletelyFull(null); ++ } ++ ++ @Override ++ public boolean isCompletelyEmpty(EnumDirection enumdirection) { ++ return this.left.isCompletelyEmpty(null) && this.right.isCompletelyEmpty(null); ++ } ++ // Airplane end ++ ++ // Airplane start ++ @Override ++ public ItemStack getHopperItem(int i) { ++ return i >= this.left.getSize() ? this.right.getHopperItem(i - this.left.getSize()) : this.left.getHopperItem(i); ++ } ++ // Airplane end ++ + @Override + public ItemStack splitStack(int i, int j) { + return i >= this.left.getSize() ? this.right.splitStack(i - this.left.getSize(), j) : this.left.splitStack(i, j); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index feab0ae1930b5271fe0d06a40c180317dcbc9d1d..99c93d48726b4b92a341ba98721173df8b4ff30a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java @@ -2780,10 +3122,19 @@ index 43418273f00f3703c7bd86586847d469af92c18f..d11e79093f9a5121c98b7da840bc79d2 // Paper end } diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java -index af01f5d635eada7175b9d7fdb47a65530686a539..51e6cd6119465f9fd6385072997971449afb5f42 100644 +index 276b1f0c9c9af7db31fba9be0593ae9def540caf..15c4319920246d53be791cc3b4a4705c717a75c5 100644 --- a/src/main/java/net/minecraft/world/level/World.java +++ b/src/main/java/net/minecraft/world/level/World.java -@@ -69,6 +69,8 @@ import net.minecraft.world.level.saveddata.maps.WorldMap; +@@ -18,6 +18,8 @@ import java.util.function.Consumer; + import java.util.function.Predicate; + import java.util.function.Supplier; + import javax.annotation.Nullable; ++ ++import gg.airplane.AirplaneConfig; + import net.minecraft.CrashReport; + import net.minecraft.CrashReportSystemDetails; + import net.minecraft.ReportedException; +@@ -69,6 +71,8 @@ import net.minecraft.world.level.saveddata.maps.WorldMap; import net.minecraft.world.level.storage.WorldData; import net.minecraft.world.level.storage.WorldDataMutable; import net.minecraft.world.phys.AxisAlignedBB; @@ -2792,7 +3143,7 @@ index af01f5d635eada7175b9d7fdb47a65530686a539..51e6cd6119465f9fd638507299797144 import net.minecraft.world.phys.shapes.OperatorBoolean; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShapeCollision; -@@ -104,7 +106,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -104,7 +108,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(); @@ -2801,7 +3152,7 @@ index af01f5d635eada7175b9d7fdb47a65530686a539..51e6cd6119465f9fd638507299797144 public final Thread serverThread; private final boolean debugWorld; private int d; -@@ -378,6 +380,91 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -387,6 +391,91 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return null; } @@ -2893,7 +3244,7 @@ index af01f5d635eada7175b9d7fdb47a65530686a539..51e6cd6119465f9fd638507299797144 public static boolean isValidLocation(BlockPosition blockposition) { return blockposition.isValidLocation(); // Paper - use better/optimized check } -@@ -899,12 +986,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -908,12 +997,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.enter("blockEntities"); timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { @@ -2911,7 +3262,7 @@ index af01f5d635eada7175b9d7fdb47a65530686a539..51e6cd6119465f9fd638507299797144 this.tileEntityListUnload.clear(); } -@@ -1016,19 +1108,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1025,19 +1119,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void a(Consumer consumer, Entity entity) { try { @@ -2934,6 +3285,14 @@ index af01f5d635eada7175b9d7fdb47a65530686a539..51e6cd6119465f9fd638507299797144 } // Paper start - Prevent armor stands from doing entity lookups @Override +@@ -1723,6 +1817,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + } + + public GameProfilerFiller getMethodProfiler() { ++ if (AirplaneConfig.disableMethodProfiler) return net.minecraft.util.profiling.GameProfilerDisabled.a; // Airplane + return (GameProfilerFiller) this.methodProfiler.get(); + } + diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java index 7279893d599351785652279c8827fe0efbd72f12..96d7990c66bd569b1b5ee287c0238c7dbb4c503e 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java @@ -2987,6 +3346,246 @@ index 70c32b7a53a1107cced3491ebac19b0eaf4fec2e..3f3e241f3b24d9df9d57760c5515ff02 if (iblockdata == null) { continue; } +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java +index 111f62d0e5b40e945793b8f504f2c035c0884a6a..cfabc9047cd3e972af84700725355d0fe149b221 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java +@@ -36,7 +36,7 @@ import org.bukkit.entity.HumanEntity; + + public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITickable + +- private NonNullList items; ++ private gg.airplane.structs.ItemListWithBitset items; // Airplane + protected float a; + protected float b; + public int viewingCount; +@@ -75,9 +75,31 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic + + protected TileEntityChest(TileEntityTypes tileentitytypes) { + super(tileentitytypes); ++ // Airplane start ++ /* + this.items = NonNullList.a(27, ItemStack.b); ++ */ ++ this.items = new gg.airplane.structs.ItemListWithBitset(27); ++ // Airplane end + } + ++ // Airplane start ++ @Override ++ public boolean hasEmptySlot(EnumDirection enumdirection) { ++ return !this.items.hasFullStacks(); ++ } ++ ++ @Override ++ public boolean isCompletelyFull(EnumDirection enumdirection) { ++ return this.items.hasFullStacks() && super.isCompletelyFull(enumdirection); ++ } ++ ++ @Override ++ public boolean isCompletelyEmpty(EnumDirection enumdirection) { ++ return this.items.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection); ++ } ++ // Airplane end ++ + public TileEntityChest() { + this(TileEntityTypes.CHEST); + } +@@ -95,7 +117,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic + @Override + public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) { + super.load(iblockdata, nbttagcompound); +- this.items = NonNullList.a(this.getSize(), ItemStack.b); ++ this.items = new gg.airplane.structs.ItemListWithBitset(this.getSize()); // Airplane + if (!this.b(nbttagcompound)) { + ContainerUtil.b(nbttagcompound, this.items); + } +@@ -295,7 +317,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic + + @Override + protected void a(NonNullList nonnulllist) { +- this.items = nonnulllist; ++ this.items = gg.airplane.structs.ItemListWithBitset.fromNonNullList(nonnulllist); // Airplane + } + + public static int a(IBlockAccess iblockaccess, BlockPosition blockposition) { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java +index 537dc52e5ff3325555ee6049bc7f277952983b76..056d280c7db6fc532d83b2a547d6a01402a49bd0 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java +@@ -46,7 +46,7 @@ import org.bukkit.inventory.Inventory; + + public class TileEntityHopper extends TileEntityLootable implements IHopper, ITickable { + +- private NonNullList items; ++ private gg.airplane.structs.ItemListWithBitset items; // Airplane + private int j; + private long k; + +@@ -82,14 +82,31 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi + + public TileEntityHopper() { + super(TileEntityTypes.HOPPER); +- this.items = NonNullList.a(5, ItemStack.b); ++ this.items = new gg.airplane.structs.ItemListWithBitset(5); // Airplane + this.j = -1; + } + ++ // Airplane start ++ @Override ++ public boolean hasEmptySlot(EnumDirection enumdirection) { ++ return !this.items.hasFullStacks(); ++ } ++ ++ @Override ++ public boolean isCompletelyFull(EnumDirection enumdirection) { ++ return this.items.hasFullStacks() && super.isCompletelyFull(enumdirection); ++ } ++ ++ @Override ++ public boolean isCompletelyEmpty(EnumDirection enumdirection) { ++ return this.items.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection); ++ } ++ // Airplane end ++ + @Override + public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) { + super.load(iblockdata, nbttagcompound); +- this.items = NonNullList.a(this.getSize(), ItemStack.b); ++ this.items = new gg.airplane.structs.ItemListWithBitset(this.getSize()); // Airplane + if (!this.b(nbttagcompound)) { + ContainerUtil.b(nbttagcompound, this.items); + } +@@ -181,16 +198,19 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi + } + + private boolean j() { +- Iterator iterator = this.items.iterator(); ++ // Airplane start - no iterator ++ //Iterator iterator = this.items.iterator(); ++ int i = 0; + + ItemStack itemstack; + + do { +- if (!iterator.hasNext()) { ++ if (i >= this.items.size()) { + return true; + } + +- itemstack = (ItemStack) iterator.next(); ++ itemstack = (ItemStack) this.items.get(i++); ++ // Airplane end + } while (!itemstack.isEmpty() && itemstack.getCount() == itemstack.getMaxStackSize()); + + return false; +@@ -205,7 +225,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi + skipPushModeEventFire = skipHopperEvents; + boolean foundItem = false; + for (int i = 0; i < this.getSize(); ++i) { +- ItemStack item = this.getItem(i); ++ ItemStack item = this.getHopperItem(i); // Airplane + if (!item.isEmpty()) { + foundItem = true; + ItemStack origItemStack = item; +@@ -429,14 +449,14 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi + private static boolean anyMatch(IInventory iinventory, EnumDirection enumdirection, java.util.function.BiPredicate test) { + if (iinventory instanceof IWorldInventory) { + for (int i : ((IWorldInventory) iinventory).getSlotsForFace(enumdirection)) { +- if (test.test(iinventory.getItem(i), i)) { ++ if (test.test(iinventory.getHopperItem(i), i)) { // Airplane + return true; + } + } + } else { + int size = iinventory.getSize(); + for (int i = 0; i < size; i++) { +- if (test.test(iinventory.getItem(i), i)) { ++ if (test.test(iinventory.getHopperItem(i), i)) { // Airplane + return true; + } + } +@@ -450,12 +470,22 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi + + private boolean b(IInventory iinventory, EnumDirection enumdirection) { + // Paper start - no streams ++ // Airplane start - use direct method ++ /* + return allMatch(iinventory, enumdirection, STACK_SIZE_TEST); ++ */ ++ return iinventory.isCompletelyFull(enumdirection); ++ // Airplane end + // Paper end + } + + private static boolean c(IInventory iinventory, EnumDirection enumdirection) { ++ // Airplane start - use direct method ++ /* + return allMatch(iinventory, enumdirection, IS_EMPTY_TEST); ++ */ ++ return iinventory.isCompletelyEmpty(enumdirection); ++ // Airplane end + } + + public static boolean a(IHopper ihopper) { +@@ -594,7 +624,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi + + if (a(iinventory1, itemstack, i, enumdirection)) { + boolean flag = false; +- boolean flag1 = iinventory1.isEmpty(); ++ boolean flag1 = iinventory1.isCompletelyEmpty(enumdirection); // Airplane + + if (itemstack1.isEmpty()) { + IGNORE_TILE_UPDATES = true; // Paper +@@ -677,7 +707,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi + if (block instanceof IInventoryHolder) { + object = ((IInventoryHolder) block).a(iblockdata, world, blockposition); + } else if (block.isTileEntity()) { +- TileEntity tileentity = world.getTileEntity(blockposition); ++ TileEntity tileentity = ((net.minecraft.server.level.WorldServer) world).getAndCheckTileEntity(iblockdata, blockposition); // Airplane - skip validation check, since we already looked it up + + if (tileentity instanceof IInventory) { + object = (IInventory) tileentity; +@@ -736,7 +766,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi + + @Override + protected void a(NonNullList nonnulllist) { +- this.items = nonnulllist; ++ this.items = gg.airplane.structs.ItemListWithBitset.fromNonNullList(nonnulllist); // Airplane + } + + public void a(Entity entity) { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java +index f0da819627035bed83561128a11059424d2b7e30..36ef5b11f12da1a7e3c8031ec84d28ba22d59a5c 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java +@@ -98,7 +98,11 @@ public abstract class TileEntityLootable extends TileEntityContainer { + public boolean isEmpty() { + this.d((EntityHuman) null); + // Paper start +- for (ItemStack itemStack : this.f()) { ++ // Airplane start - don't use abstract iterator ++ java.util.List list = this.f(); ++ for (int i = 0, size = list.size(); i < size; i++) { ++ ItemStack itemStack = list.get(i); ++ // Airplane end + if (!itemStack.isEmpty()) { + return false; + } +@@ -107,6 +111,13 @@ public abstract class TileEntityLootable extends TileEntityContainer { + return true; + } + ++ // Airplane start - skip loot check for hoppers ++ @Override ++ public final ItemStack getHopperItem(int index) { ++ return this.f().get(index); ++ } ++ // Airplane end ++ + @Override + public ItemStack getItem(int i) { + if (i == 0) this.d((EntityHuman) null); // Paper diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java index fc07e2014e961da5d97095c4ee6f972e2ece3ec3..8f5809756b4fb358f1207c1d61c5cbe6df3fff00 100644 --- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -3200,20 +3799,21 @@ index 95d0c9f22d79194ca83ca6f6a8e6d91180a3c8da..20cc04be75ab202d4c4ee9a07e9876ce public LootTableInfo build(LootContextParameterSet lootcontextparameterset) { diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeCollisionEntity.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeCollisionEntity.java -index dcb3e4b0cf34699ed77208f8122710bbdfa3d063..a51b47892c726f4b4b10d870991e9b8517f57fb7 100644 +index dcb3e4b0cf34699ed77208f8122710bbdfa3d063..dbb6a68eea01a3484f2ac862745b57d1d832b80c 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeCollisionEntity.java +++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeCollisionEntity.java -@@ -23,7 +23,8 @@ public class VoxelShapeCollisionEntity implements VoxelShapeCollision { +@@ -23,18 +23,22 @@ public class VoxelShapeCollisionEntity implements VoxelShapeCollision { }; private final boolean b; private final double c; - private final Item d; +- private final Predicate e; + private Item d; // Airplane + private Entity entity; // Airplane - private final Predicate e; ++ private Predicate e; // Airplane protected VoxelShapeCollisionEntity(boolean flag, double d0, Item item, Predicate predicate) { -@@ -31,10 +32,13 @@ public class VoxelShapeCollisionEntity implements VoxelShapeCollision { + this.b = flag; this.c = d0; this.d = item; this.e = predicate; @@ -3227,7 +3827,7 @@ index dcb3e4b0cf34699ed77208f8122710bbdfa3d063..a51b47892c726f4b4b10d870991e9b85 boolean flag = entity.by(); double d0 = entity.locY(); Item item = entity instanceof EntityLiving ? ((EntityLiving) entity).getItemInMainHand().getItem() : Items.AIR; -@@ -50,12 +54,21 @@ public class VoxelShapeCollisionEntity implements VoxelShapeCollision { +@@ -50,17 +54,27 @@ public class VoxelShapeCollisionEntity implements VoxelShapeCollision { return false; }; } @@ -3238,7 +3838,7 @@ index dcb3e4b0cf34699ed77208f8122710bbdfa3d063..a51b47892c726f4b4b10d870991e9b85 + entity.by(), + entity.locY(), + null, //entity instanceof EntityLiving ? ((EntityLiving) entity).getItemInMainHand().getItem() : Items.AIR, // Airplane - lazy -+ entity instanceof EntityLiving ? ((EntityLiving) entity)::a : (fluidtype) -> false ++ null //entity instanceof EntityLiving ? ((EntityLiving) entity)::a : (fluidtype) -> false + ); + this.entity = entity; + // Airplane end @@ -3250,8 +3850,14 @@ index dcb3e4b0cf34699ed77208f8122710bbdfa3d063..a51b47892c726f4b4b10d870991e9b85 return this.d == item; } + @Override + public boolean a(Fluid fluid, FluidTypeFlowing fluidtypeflowing) { ++ if (this.e == null) return this.entity instanceof EntityLiving && ((EntityLiving) this.entity).a(fluidtypeflowing); // Airplane + return this.e.test(fluidtypeflowing) && !fluid.getType().a((FluidType) fluidtypeflowing); + } + diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d02b8d4b7883f235894550514a6abae81651af82..3549abdc88f2708e6ccea3f152ae37770bfe951b 100644 +index 0e9819a7da160e7a5f28734c4dd3b673c8881792..e476806646c89c22da7e733d8072e0073383bd79 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -230,7 +230,7 @@ import javax.annotation.Nullable; // Paper diff --git a/patches/server/0003-Rebrand.patch b/patches/server/0003-Rebrand.patch index 6b66734a2..cd6e8f06b 100644 --- a/patches/server/0003-Rebrand.patch +++ b/patches/server/0003-Rebrand.patch @@ -92,10 +92,10 @@ index 3bc5cd1e53dd7c94b948e7f57f0dc8e073e349b0..87891161f5b06bb8be0e2016b490484e throwable = throwable1; throw throwable1; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 073df4e4e21b7a57e8d4159e2c5d68bda11e3d51..f754692eaff308b4a057e6b48f90d919cedfea73 100644 +index 06d0592bebaefc16c1995781a9e8a3554f4a3205..e26b1d7b6ffc726c8ae8b469eab9df73c033a73f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1647,7 +1647,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { @@ -76,7 +76,7 @@ index 4ed80e3bda7f984fa00320be647ac450c94fd72b..05dc6c1b83479bed2857ef799df8291d })) { // CraftBukkit start long l = this.worldData.getDayTime() + 24000L; -@@ -1368,7 +1368,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1384,7 +1384,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); diff --git a/patches/server/0010-Bring-back-server-name.patch b/patches/server/0010-Bring-back-server-name.patch index e070e4dc4..7f352b528 100644 --- a/patches/server/0010-Bring-back-server-name.patch +++ b/patches/server/0010-Bring-back-server-name.patch @@ -17,10 +17,10 @@ index 1fab9b9c7d41a0d2a551096c2c15f741a887fa2d..f33309f4c1ad92960d0634f3f5b8105c public final boolean spawnNpcs = this.getBoolean("spawn-npcs", true); public final boolean pvp = this.getBoolean("pvp", true); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5ff123626972215afcb29c8070aca26e1e5c3509..a78228bd594bf6d651d68f86a85b8d47602e7121 100644 +index f53389a49e62f54faa6af19226589305b597d1ae..3efe2a4eff95349107134b097033bf978f083d56 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2553,4 +2553,11 @@ public final class CraftServer implements Server { +@@ -2554,4 +2554,11 @@ public final class CraftServer implements Server { } // Paper end diff --git a/patches/server/0011-Configurable-server-mod-name.patch b/patches/server/0011-Configurable-server-mod-name.patch index 50a77e628..f51086d35 100644 --- a/patches/server/0011-Configurable-server-mod-name.patch +++ b/patches/server/0011-Configurable-server-mod-name.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable server mod name diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f754692eaff308b4a057e6b48f90d919cedfea73..f19d370052d9db98ed567f20dfc1abf968ae219b 100644 +index e26b1d7b6ffc726c8ae8b469eab9df73c033a73f..87d121dcbb8fcf3545f6c80ce3e219358800d6b9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1647,7 +1647,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0) { -@@ -286,6 +287,22 @@ public class EntityTrackerEntry { +@@ -288,6 +289,22 @@ public class EntityTrackerEntry { } diff --git a/patches/server/0057-Configurable-TPS-Catchup.patch b/patches/server/0057-Configurable-TPS-Catchup.patch index 5f20376ce..9a10b29e3 100644 --- a/patches/server/0057-Configurable-TPS-Catchup.patch +++ b/patches/server/0057-Configurable-TPS-Catchup.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable TPS Catchup diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 25ce3c3b76efd265fe9fbda2f6e49edde20bea45..11e69678c04017faa66a7527e892c5db73cf235b 100644 +index 8a11047d0e60d20c83f2013b5e1488fe08152142..ac21ebf5d835fb34dbaad5f3c40cc5aeb6153231 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1133,7 +1133,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant trackedPlayerMap = null; diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java -index 0b48961a18da76dd25c0930f393f0ac9f709ad78..7444878986c802ff10f67e9d5d9ba277db709af4 100644 +index c0d2b7fe726ea92e18871e3714ca9c249492ac93..717d5f98a51e95399f4cff225987fa60af9f15f6 100644 --- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java -@@ -2440,7 +2440,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -2446,7 +2446,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially public class EntityTracker { diff --git a/patches/server/0080-Add-phantom-spawning-options.patch b/patches/server/0080-Add-phantom-spawning-options.patch index 7b59963d5..c61045092 100644 --- a/patches/server/0080-Add-phantom-spawning-options.patch +++ b/patches/server/0080-Add-phantom-spawning-options.patch @@ -61,10 +61,10 @@ index d98526785ff2fa3b72e8ffffcb89a57a2203a5c8..7859d84471436b427138593776ebd30a return iblockdata.r(iblockaccess, blockposition) ? false : (iblockdata.isPowerSource() ? false : (!fluid.isEmpty() ? false : (iblockdata.a((Tag) TagsBlock.PREVENT_MOB_SPAWNING_INSIDE) ? false : !entitytypes.a(iblockdata)))); } diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java -index f8261e21a84bf8c29d72116fc3166dc745a59c02..62342aaf97a4aa6a579647b40d6d63d5db698005 100644 +index 18c8c1e5064b8704236b4a75abc2f995e0f8c6d7..adfb33278901677a5f63452813e284baebdaa7f3 100644 --- a/src/main/java/net/minecraft/world/level/World.java +++ b/src/main/java/net/minecraft/world/level/World.java -@@ -1749,6 +1749,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1760,6 +1760,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return new DifficultyDamageScaler(this.getDifficulty(), this.getDayTime(), i, f); } diff --git a/patches/server/0083-Add-allow-water-in-end-world-option.patch b/patches/server/0083-Add-allow-water-in-end-world-option.patch index cfd469e53..e1790359d 100644 --- a/patches/server/0083-Add-allow-water-in-end-world-option.patch +++ b/patches/server/0083-Add-allow-water-in-end-world-option.patch @@ -27,10 +27,10 @@ index d126f668828e0788e369294c0b376ef52b344f2c..154a76b1b77a97bdf65153250c41275f return true; diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java -index 62342aaf97a4aa6a579647b40d6d63d5db698005..056d827a2115370c01d0f2a98039f727b4c674d5 100644 +index adfb33278901677a5f63452813e284baebdaa7f3..66dadc03972020810e7b4c76188f536cad8149cf 100644 --- a/src/main/java/net/minecraft/world/level/World.java +++ b/src/main/java/net/minecraft/world/level/World.java -@@ -1824,4 +1824,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1836,4 +1836,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public final boolean isDebugWorld() { return this.debugWorld; } diff --git a/patches/server/0099-Add-no-random-tick-block-list.patch b/patches/server/0099-Add-no-random-tick-block-list.patch index 82a2b3930..bab1d2de4 100644 --- a/patches/server/0099-Add-no-random-tick-block-list.patch +++ b/patches/server/0099-Add-no-random-tick-block-list.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add no-random-tick block list diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java -index 117fdc51a9ecd7504f9ce1ef9cb2e5aafc0de7d4..ff704bc64146584d3e8085b332bada39912f71f3 100644 +index 44d20ffdc6d4ea46682f14ec5bf885bec36969cf..a3bd84427b81e8f0409d6f5fcbbf397b12532afd 100644 --- a/src/main/java/net/minecraft/server/level/WorldServer.java +++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -532,14 +532,14 @@ public class WorldServer extends World implements GeneratorAccessSeed { diff --git a/patches/server/0103-Ridables.patch b/patches/server/0103-Ridables.patch index 8075925f9..9f3e89123 100644 --- a/patches/server/0103-Ridables.patch +++ b/patches/server/0103-Ridables.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ridables diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b268068b5d2bc5f0d032e11ac38bf011a32df01c..ad4e1d5154bebf7458c38bed7380f12d06c3eaaf 100644 +index cbc6d074a7366f6456c6af2a3fedf0f7bd40cb5b..8ba25be0ea59483e824be9afc63d47cb75b5b334 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1541,6 +1541,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper worldserver.hasEntityMoveEvent = EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper @@ -104,7 +104,7 @@ index b3d12463fbeb2045860c6b933da74980f778472e..d06bae9d71f23fccbfaf65c0fd9e9a55 public void playerTick() { diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java -index ff704bc64146584d3e8085b332bada39912f71f3..faf6140085454b4e29869d6abe08353b7a301287 100644 +index a3bd84427b81e8f0409d6f5fcbbf397b12532afd..29f1353482ac93cc5eb59a0f7bd8b7e631271520 100644 --- a/src/main/java/net/minecraft/server/level/WorldServer.java +++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -216,6 +216,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -5590,10 +5590,10 @@ index 96efd974f1eb9c1e7c70e576e51ed69e15aacb99..fc86ef53c48503139667f7703019a07c default int getHeight() { diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java -index 056d827a2115370c01d0f2a98039f727b4c674d5..36b416636b4ded816701a065ff2ff0c3890e0987 100644 +index 66dadc03972020810e7b4c76188f536cad8149cf..0488b69f7b0bd4bf7d23488b7df615f515fa5d0b 100644 --- a/src/main/java/net/minecraft/world/level/World.java +++ b/src/main/java/net/minecraft/world/level/World.java -@@ -1833,5 +1833,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1845,5 +1845,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean isTheEnd() { return getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END; } diff --git a/patches/server/0109-Allow-toggling-special-MobSpawners-per-world.patch b/patches/server/0109-Allow-toggling-special-MobSpawners-per-world.patch index 2ccf0f1bf..1fd28e49c 100644 --- a/patches/server/0109-Allow-toggling-special-MobSpawners-per-world.patch +++ b/patches/server/0109-Allow-toggling-special-MobSpawners-per-world.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Allow toggling special MobSpawners per world In vanilla, these are all hardcoded on for world type 0 (overworld) and hardcoded off for every other world type. Default config behaviour matches this. diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java -index faf6140085454b4e29869d6abe08353b7a301287..48ec845fbe34367a40fdd7e601e093054b82a345 100644 +index 29f1353482ac93cc5eb59a0f7bd8b7e631271520..8bf5d370fc9e9e7ad678c49057f2ad0009a6379b 100644 --- a/src/main/java/net/minecraft/server/level/WorldServer.java +++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -92,6 +92,7 @@ import net.minecraft.world.entity.EnumCreatureType; @@ -93,10 +93,10 @@ index 7c8a2151be8a0f48cba1c15d231d5dbdb500b4d6..361771fc4fcf16b1b013c55073401953 if (SpawnerCreature.a(EntityPositionTypes.Surface.ON_GROUND, iworldreader, blockposition2, EntityTypes.WANDERING_TRADER)) { blockposition1 = blockposition2; diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java -index 36b416636b4ded816701a065ff2ff0c3890e0987..4c85525fe461fc3d52c538ab2610c1098c9d0151 100644 +index 0488b69f7b0bd4bf7d23488b7df615f515fa5d0b..a318c37d1b855739441119bcccbeb05722205b82 100644 --- a/src/main/java/net/minecraft/world/level/World.java +++ b/src/main/java/net/minecraft/world/level/World.java -@@ -250,7 +250,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -261,7 +261,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray this.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(((net.minecraft.world.level.storage.WorldDataServer)worlddatamutable).getName()); // Tuinity - Server Config diff --git a/patches/server/0118-Configurable-daylight-cycle.patch b/patches/server/0118-Configurable-daylight-cycle.patch index 9f4c87c7f..feb234823 100644 --- a/patches/server/0118-Configurable-daylight-cycle.patch +++ b/patches/server/0118-Configurable-daylight-cycle.patch @@ -18,7 +18,7 @@ index 3086ee023685781d94e2fb99fc8dff5264f01165..74c1047305cac5673e274096709c757e public PacketPlayOutUpdateTime() {} diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java -index 48ec845fbe34367a40fdd7e601e093054b82a345..590481914415374e2eb8b6b92d1469e7146620c3 100644 +index 8bf5d370fc9e9e7ad678c49057f2ad0009a6379b..56839f31bedd8efb5196325b7b31f0365844675f 100644 --- a/src/main/java/net/minecraft/server/level/WorldServer.java +++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -64,6 +64,7 @@ import net.minecraft.network.protocol.game.PacketPlayOutExplosion; @@ -45,7 +45,7 @@ index 48ec845fbe34367a40fdd7e601e093054b82a345..590481914415374e2eb8b6b92d1469e7 } // Tuinity start - optimise collision -@@ -1211,7 +1214,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1227,7 +1230,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.nextTickListBlock.nextTick(); // Paper this.nextTickListFluid.nextTick(); // Paper this.worldDataServer.u().a(this.server, i); @@ -68,7 +68,7 @@ index 48ec845fbe34367a40fdd7e601e093054b82a345..590481914415374e2eb8b6b92d1469e7 this.setDayTime(this.worldData.getDayTime() + 1L); } -@@ -1220,6 +1237,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1236,6 +1253,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { public void setDayTime(long i) { this.worldDataServer.setDayTime(i); diff --git a/patches/server/0124-Add-adjustable-breeding-cooldown-to-config.patch b/patches/server/0124-Add-adjustable-breeding-cooldown-to-config.patch index 918de7cdc..f6e7ebe19 100644 --- a/patches/server/0124-Add-adjustable-breeding-cooldown-to-config.patch +++ b/patches/server/0124-Add-adjustable-breeding-cooldown-to-config.patch @@ -33,10 +33,10 @@ index 4de0a733819d408e8b9a55b604f455281d7732c5..94b5874c1eb90c02a557179a2a1170b1 entityageable.setBaby(true); entityageable.setPositionRotation(this.locX(), this.locY(), this.locZ(), 0.0F, 0.0F); diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java -index 4c85525fe461fc3d52c538ab2610c1098c9d0151..b03865ca77c3fbd4fe61db450ffd3cede9613568 100644 +index a318c37d1b855739441119bcccbeb05722205b82..b8b22d4fbd8c2620d47c3de8d5bccdfc6c9ec63b 100644 --- a/src/main/java/net/minecraft/world/level/World.java +++ b/src/main/java/net/minecraft/world/level/World.java -@@ -41,6 +41,7 @@ import net.minecraft.world.DifficultyDamageScaler; +@@ -43,6 +43,7 @@ import net.minecraft.world.DifficultyDamageScaler; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityTypes; @@ -44,7 +44,7 @@ index 4c85525fe461fc3d52c538ab2610c1098c9d0151..b03865ca77c3fbd4fe61db450ffd3ced import net.minecraft.world.entity.decoration.EntityArmorStand; import net.minecraft.world.entity.player.EntityHuman; import net.minecraft.world.item.ItemStack; -@@ -166,6 +167,48 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -168,6 +169,48 @@ public abstract class World implements GeneratorAccess, AutoCloseable { private int tileTickPosition; public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here @@ -93,7 +93,7 @@ index 4c85525fe461fc3d52c538ab2610c1098c9d0151..b03865ca77c3fbd4fe61db450ffd3ced public CraftWorld getWorld() { return this.world; -@@ -251,6 +294,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -262,6 +305,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray this.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(((net.minecraft.world.level.storage.WorldDataServer)worlddatamutable).getName()); // Tuinity - Server Config this.purpurConfig = new net.pl3x.purpur.PurpurWorldConfig((((net.minecraft.world.level.storage.WorldDataServer)worlddatamutable).getName()), env); // Purpur diff --git a/patches/server/0145-Option-for-Villager-Clerics-to-farm-Nether-Wart.patch b/patches/server/0145-Option-for-Villager-Clerics-to-farm-Nether-Wart.patch index 0e63f1fe8..2e248569f 100644 --- a/patches/server/0145-Option-for-Villager-Clerics-to-farm-Nether-Wart.patch +++ b/patches/server/0145-Option-for-Villager-Clerics-to-farm-Nether-Wart.patch @@ -8,10 +8,10 @@ farm Nether Wart. Reimplemented based on a feature of the carpet-extra mod. diff --git a/src/main/java/net/minecraft/world/IInventory.java b/src/main/java/net/minecraft/world/IInventory.java -index 774ba6a923f7e329f6af5efc17e1c46e87ed2d77..b8c73cd0ba916b7bf166a6d2f6b7ab68cd9c939b 100644 +index 8faf3850f4c965feec42f6998563b7265a8f599e..96f814a2946a69e53cc1bcbf5499c5058ff982af 100644 --- a/src/main/java/net/minecraft/world/IInventory.java +++ b/src/main/java/net/minecraft/world/IInventory.java -@@ -38,6 +38,7 @@ public interface IInventory extends Clearable { +@@ -104,6 +104,7 @@ public interface IInventory extends Clearable { return true; } @@ -19,7 +19,7 @@ index 774ba6a923f7e329f6af5efc17e1c46e87ed2d77..b8c73cd0ba916b7bf166a6d2f6b7ab68 default int a(Item item) { int i = 0; -@@ -52,6 +53,7 @@ public interface IInventory extends Clearable { +@@ -118,6 +119,7 @@ public interface IInventory extends Clearable { return i; } diff --git a/patches/server/0153-Implement-TPSBar.patch b/patches/server/0153-Implement-TPSBar.patch index cbe5fba99..0f81a6791 100644 --- a/patches/server/0153-Implement-TPSBar.patch +++ b/patches/server/0153-Implement-TPSBar.patch @@ -17,10 +17,10 @@ index 0ea56c863a9a1019b36f7f9f9164301aef12637b..4338b459011bf7a083790b7bb76cf1b2 if (commanddispatcher_servertype.d) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ad4e1d5154bebf7458c38bed7380f12d06c3eaaf..f0db6072ebce4b60dcf3b4bea774ddabb3061302 100644 +index 8ba25be0ea59483e824be9afc63d47cb75b5b334..61603bda0d1e305679ab2463188c3f6cf9c8c18d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -990,6 +990,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant