diff --git a/build.gradle.kts b/build.gradle.kts index 0934702..688f4c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -33,9 +33,6 @@ subprojects { tasks.withType { options.encoding = Charsets.UTF_8.name() options.release.set(17) - options.compilerArgs = listOf( - "--add-modules", "jdk.incubator.vector" - ) } tasks.withType { options.encoding = Charsets.UTF_8.name() diff --git a/gradle.properties b/gradle.properties index ea1ac82..7d9fb9e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=wtf.etil.mirai version=1.18.1-R0.1-SNAPSHOT mcVersion=1.18.1 packageVersion=1_18_R1 -pufferfishRef=bcbaf3e4dec81c89a226508984da4c1beb1f9e74 +pufferfishRef=22f20b245fa30e93d3e0ff695b8e719d201c88c2 org.gradle.caching=true org.gradle.caching.debug=false diff --git a/patches/api/0004-Add-NBT-API-as-a-first-class-lib.patch b/patches/api/0004-Add-NBT-API-as-a-first-class-lib.patch index 9f14c47..42afa98 100644 --- a/patches/api/0004-Add-NBT-API-as-a-first-class-lib.patch +++ b/patches/api/0004-Add-NBT-API-as-a-first-class-lib.patch @@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/build.gradle.kts b/build.gradle.kts -index 129c5b41b410b57952fedf90c1ea713ba1c36470..2c33800e7a49804a29f64fd5e6fde7d2c860ef4c 100644 +index 46348c1673366ab096051020817bf35adcf79320..78904d037f3a871ead92e4b478471bd20bb48334 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ @@ -26,7 +26,7 @@ index 129c5b41b410b57952fedf90c1ea713ba1c36470..2c33800e7a49804a29f64fd5e6fde7d2 implementation("org.ow2.asm:asm:9.2") implementation("org.ow2.asm:asm-commons:9.2") -@@ -94,6 +96,10 @@ tasks.jar { +@@ -101,6 +103,10 @@ tasks.jar { } } @@ -38,7 +38,7 @@ index 129c5b41b410b57952fedf90c1ea713ba1c36470..2c33800e7a49804a29f64fd5e6fde7d2 inputs.files(apiAndDocs) .ignoreEmptyDirectories() diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java -index 5a4884db36d448c885e49c965ae329a0638dd628..ce86d0d58182466dc1b2dbf1851e5bff42f7013f 100644 +index 049c36807d2a970842442c1b7517c06f3f150041..8bc45dcb8b739045cf4d867f2ea34488a4f59281 100644 --- a/src/main/java/org/bukkit/Chunk.java +++ b/src/main/java/org/bukkit/Chunk.java @@ -283,4 +283,16 @@ public interface Chunk extends PersistentDataHolder { @@ -90,7 +90,7 @@ index 3b10fcc13893403b29f0260b8605144679e89b82..1e9a96d8b08cc396acf73dc420830093 + // Yatopia end } diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 51ec2e4ec4239659272bba3d6ba2ad73926ebb88..6e7e2000c015484c4416c474fc1a4bd82da7f3e6 100644 +index c2c45a93887f99466a8ac4275355ac75c7f901c4..520865c7ea629848fda50f7589d56018d7b1acd1 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -190,6 +190,28 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @@ -123,7 +123,7 @@ index 51ec2e4ec4239659272bba3d6ba2ad73926ebb88..6e7e2000c015484c4416c474fc1a4bd8 * Returns a list of entities within a bounding box centered around this * entity diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 56072cb4d32ca8a09023be08a5a832c2c108379a..aebcc6d749e135445b7e779fc2f6412db91e591a 100644 +index 7dfc84c77d8e185bb0513d9f9c603ce1b501a5e0..eeab6b554b40e8c84e496ba62163f56d6696d705 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -587,6 +587,44 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor diff --git a/patches/server/0001-Mirai-Branding-Changes.patch b/patches/server/0001-Mirai-Branding-Changes.patch index 6fce7a3..562ef8c 100644 --- a/patches/server/0001-Mirai-Branding-Changes.patch +++ b/patches/server/0001-Mirai-Branding-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Mirai Branding Changes diff --git a/build.gradle.kts b/build.gradle.kts -index 0f194168f5fca8eb768bca3ce953f28097fed578..6a8786790cfeb4373d23d7e743f06b19efa45c35 100644 +index 86548210e50879504f646ef3aa46927998f2d775..e7f677cb5abb24c52b10087837f44c865140635c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ repositories { @@ -17,7 +17,7 @@ index 0f194168f5fca8eb768bca3ce953f28097fed578..6a8786790cfeb4373d23d7e743f06b19 // Pufferfish start implementation("io.papermc.paper:paper-mojangapi:1.18.1-R0.1-SNAPSHOT") { exclude("io.papermc.paper", "paper-api") -@@ -80,7 +80,7 @@ tasks.jar { +@@ -87,7 +87,7 @@ tasks.jar { attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", "Implementation-Title" to "CraftBukkit", diff --git a/patches/server/0005-lithium-fast-util.patch b/patches/server/0004-lithium-fast-util.patch similarity index 95% rename from patches/server/0005-lithium-fast-util.patch rename to patches/server/0004-lithium-fast-util.patch index 20ac9fd..f0027ce 100644 --- a/patches/server/0005-lithium-fast-util.patch +++ b/patches/server/0004-lithium-fast-util.patch @@ -29,7 +29,7 @@ index 6d883db5c04cbcf454952c0f361029ecbfe4f037..8f0d53a1abe148382df6a8133ccbd5c0 public static Direction getNearest(double x, double y, double z) { diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java -index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..706ac70115a28e8f97ac4c5a10f7339fe61c8de8 100644 +index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..dfbc871cd3474346b8d83f0b55b4f5f9665e4386 100644 --- a/src/main/java/net/minecraft/world/phys/AABB.java +++ b/src/main/java/net/minecraft/world/phys/AABB.java @@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos; @@ -49,7 +49,7 @@ index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..706ac70115a28e8f97ac4c5a10f7339f + assert Direction.Axis.X.ordinal() == 0; + assert Direction.Axis.Y.ordinal() == 1; + assert Direction.Axis.Z.ordinal() == 2; -+ assert me.titaniumtown.Constants.ALL_AXIS_Direction.length == 3; ++ assert Direction.Axis.values().length == 3; + } + // JettPack end + diff --git a/patches/server/0004-reduce-allocs.patch b/patches/server/0004-reduce-allocs.patch deleted file mode 100644 index 8e3132d..0000000 --- a/patches/server/0004-reduce-allocs.patch +++ /dev/null @@ -1,971 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Simon Gardling -Date: Tue, 9 Nov 2021 16:53:39 -0500 -Subject: [PATCH] reduce allocs - -Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0 -You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) - -diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index c0d123bff1825366c30aadd3ad8a7fde68ef74e4..7764b1f86aca33dc227bf4357c20839b8820eb67 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperCommand.java -+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -214,7 +214,7 @@ public class PaperCommand extends Command { - case "version": - Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version"); - if (ver != null) { -- ver.execute(sender, commandLabel, new String[0]); -+ ver.execute(sender, commandLabel, me.titaniumtown.Constants.EMPTY_string_arr); // JettPack - break; - } - // else - fall through to default -diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java -index 0133ea6feb1ab88f021f66855669f58367e7420b..cd5499e750764eaa5e361e73eb581bfce7f9f7c1 100644 ---- a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java -+++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java -@@ -17,9 +17,9 @@ public final class EntityList implements Iterable { - this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE); - } - -- protected static final Entity[] EMPTY_LIST = new Entity[0]; -+ // protected static final Entity[] EMPTY_LIST = new Entity[0]; // JettPack - -- protected Entity[] entities = EMPTY_LIST; -+ protected Entity[] entities = me.titaniumtown.Constants.EMPTY_entity_arr; // JettPack - protected int count; - - public int size() { -diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java -index 277cfd9d1e8fff5d9b5e534b75c3c5162d58b0b7..27b6dc17a38f80abad2f959c90ffa5ef81635e1a 100644 ---- a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java -+++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java -@@ -20,7 +20,7 @@ public final class IBlockDataList { - this.map.defaultReturnValue(Long.MAX_VALUE); - } - -- private static final long[] EMPTY_LIST = new long[0]; -+ private static final long[] EMPTY_LIST = me.titaniumtown.Constants.EMPTY_long_arr; // JettPack - - private long[] byIndex = EMPTY_LIST; - private int size; -diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java -index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..a919e8a2aa10ba01d7f389985591a0681c1b4426 100644 ---- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java -+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java -@@ -63,7 +63,7 @@ public final class ChunkEntitySlices { - } - } - -- return ret.toArray(new org.bukkit.entity.Entity[0]); -+ return ret.toArray(me.titaniumtown.Constants.EMPTY_bukkit_entity_arr); // JettPack - } - // Paper end - optimise CraftChunk#getEntities - -@@ -189,7 +189,7 @@ public final class ChunkEntitySlices { - - protected static final class BasicEntityList { - -- protected static final Entity[] EMPTY = new Entity[0]; -+ // protected static final Entity[] EMPTY = new Entity[0]; // JettPack - protected static final int DEFAULT_CAPACITY = 4; - - protected E[] storage; -@@ -200,7 +200,7 @@ public final class ChunkEntitySlices { - } - - public BasicEntityList(final int cap) { -- this.storage = (E[])(cap <= 0 ? EMPTY : new Entity[cap]); -+ this.storage = (E[])(cap <= 0 ? me.titaniumtown.Constants.EMPTY_entity_arr : new Entity[cap]); // JettPack - } - - public boolean isEmpty() { -@@ -212,7 +212,7 @@ public final class ChunkEntitySlices { - } - - private void resize() { -- if (this.storage == EMPTY) { -+ if (this.storage == me.titaniumtown.Constants.EMPTY_entity_arr) { // JettPack - this.storage = (E[])new Entity[DEFAULT_CAPACITY]; - } else { - this.storage = Arrays.copyOf(this.storage, this.storage.length * 2); -diff --git a/src/main/java/me/titaniumtown/Constants.java b/src/main/java/me/titaniumtown/Constants.java -new file mode 100644 -index 0000000000000000000000000000000000000000..9ede2f067eacc1d418a8d6223f4052b81410d3b3 ---- /dev/null -+++ b/src/main/java/me/titaniumtown/Constants.java -@@ -0,0 +1,22 @@ -+package me.titaniumtown; -+ -+import net.minecraft.core.Direction; -+import net.minecraft.world.entity.EquipmentSlot; -+import net.minecraft.core.BlockPos; -+ -+public final class Constants { -+ -+ public static final Direction[] ALL_Direction = Direction.values(); -+ public static final Direction[] VERTICAL_Direction = {Direction.DOWN, Direction.UP}; -+ public static final Direction[] HORIZONTAL_Direction = {Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH}; -+ public static final Direction.Axis[] ALL_AXIS_Direction = Direction.Axis.values(); -+ -+ public static final EquipmentSlot[] ALL_EquipmentSlot = EquipmentSlot.values(); -+ public static final int[] EMPTY_int_arr = new int[0]; -+ public static final int[] ZERO_int_arr = new int[]{0}; -+ public static final byte[] EMPTY_byte_arr = new byte[0]; -+ public static final String[] EMPTY_string_arr = new String[0]; -+ public static final long[] EMPTY_long_arr = new long[0]; -+ public static final org.bukkit.entity.Entity[] EMPTY_bukkit_entity_arr = new org.bukkit.entity.Entity[0]; -+ public static final net.minecraft.world.entity.Entity[] EMPTY_entity_arr = new net.minecraft.world.entity.Entity[0]; -+} -\ No newline at end of file -diff --git a/src/main/java/net/minecraft/nbt/ByteArrayTag.java b/src/main/java/net/minecraft/nbt/ByteArrayTag.java -index 3dd8a189c26f41759c59c3b9d0e5282038989a9f..147beddf8ef369cdae4b1ed2dcd0d7b2fd865315 100644 ---- a/src/main/java/net/minecraft/nbt/ByteArrayTag.java -+++ b/src/main/java/net/minecraft/nbt/ByteArrayTag.java -@@ -170,7 +170,7 @@ public class ByteArrayTag extends CollectionTag { - } - - public void clear() { -- this.data = new byte[0]; -+ this.data = me.titaniumtown.Constants.EMPTY_byte_arr; // JettPack - } - - @Override -diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index 210f81e380cb38c2d5d69849e593d2fdb54e8856..bf2faf02785689e2296f9bae146f8865fc105c66 100644 ---- a/src/main/java/net/minecraft/nbt/CompoundTag.java -+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -365,7 +365,7 @@ public class CompoundTag implements Tag { - throw new ReportedException(this.createReport(key, ByteArrayTag.TYPE, var3)); - } - -- return new byte[0]; -+ return me.titaniumtown.Constants.EMPTY_byte_arr; // JettPack - } - - public int[] getIntArray(String key) { -@@ -377,7 +377,7 @@ public class CompoundTag implements Tag { - throw new ReportedException(this.createReport(key, IntArrayTag.TYPE, var3)); - } - -- return new int[0]; -+ return me.titaniumtown.Constants.EMPTY_int_arr; // JettPack - } - - public long[] getLongArray(String key) { -@@ -389,7 +389,7 @@ public class CompoundTag implements Tag { - throw new ReportedException(this.createReport(key, LongArrayTag.TYPE, var3)); - } - -- return new long[0]; -+ return me.titaniumtown.Constants.EMPTY_long_arr; // JettPack - } - - public CompoundTag getCompound(String key) { -diff --git a/src/main/java/net/minecraft/nbt/IntArrayTag.java b/src/main/java/net/minecraft/nbt/IntArrayTag.java -index a14b01cee7a8d7022c4fa7264d349a76be143ba5..44f441d6c102fa5bd50071cae991a8a6ba0ec713 100644 ---- a/src/main/java/net/minecraft/nbt/IntArrayTag.java -+++ b/src/main/java/net/minecraft/nbt/IntArrayTag.java -@@ -184,7 +184,7 @@ public class IntArrayTag extends CollectionTag { - } - - public void clear() { -- this.data = new int[0]; -+ this.data = me.titaniumtown.Constants.EMPTY_int_arr; // JettPack - } - - @Override -diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java -index ea68b26e506e48d8238b7ee4266e61b211d52bd2..5d7d160a1e575903999c00da9faf5359949ce1cb 100644 ---- a/src/main/java/net/minecraft/nbt/ListTag.java -+++ b/src/main/java/net/minecraft/nbt/ListTag.java -@@ -221,7 +221,7 @@ public class ListTag extends CollectionTag { - } - } - -- return new int[0]; -+ return me.titaniumtown.Constants.EMPTY_int_arr; // JettPack - } - - public long[] getLongArray(int index) { -@@ -232,7 +232,7 @@ public class ListTag extends CollectionTag { - } - } - -- return new long[0]; -+ return me.titaniumtown.Constants.EMPTY_long_arr; // JettPack - } - - public double getDouble(int index) { -diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index e2c8f716af55ebb7e4233c2a3d6515f8f4a239fa..2f5c021b6849acb81064d55418707921424b649b 100644 ---- a/src/main/java/net/minecraft/server/Main.java -+++ b/src/main/java/net/minecraft/server/Main.java -@@ -76,7 +76,7 @@ public class Main { - OptionSpec optionspec6 = optionparser.accepts("safeMode", "Loads level with vanilla datapack only"); - OptionSpec optionspec7 = optionparser.accepts("help").forHelp(); - OptionSpec optionspec8 = optionparser.accepts("singleplayer").withRequiredArg(); -- OptionSpec optionspec9 = optionparser.accepts("universe").withRequiredArg().defaultsTo(".", new String[0]); -+ OptionSpec optionspec9 = optionparser.accepts("universe").withRequiredArg().defaultsTo(".", me.titaniumtown.Constants.EMPTY_string_arr); // JettPack - OptionSpec optionspec10 = optionparser.accepts("world").withRequiredArg(); - OptionSpec optionspec11 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1, new Integer[0]); - OptionSpec optionspec12 = optionparser.accepts("serverId").withRequiredArg(); -diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index addf249717b5271b664f4a9d28dd6cc177db5688..99a86acedeed4aede7e7afc7e9ee122b78201c7e 100644 ---- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java -+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -77,6 +77,8 @@ public class ServerChunkCache extends ChunkSource { - final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock(); - final Long2ObjectOpenHashMap loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f); - -+ private final java.util.ArrayList cachedChunkList = new java.util.ArrayList<>(); // JettPack - reduce allocs -+ - private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4]; - - public boolean firstRunSpawnCounts = true; // Pufferfish -@@ -928,6 +930,16 @@ public class ServerChunkCache extends ChunkSource { - this.clearCache(); - } - -+ // JettPack start - lithium: reduce allocs -+ private java.util.ArrayList redirectChunksListClone(int initialArraySize) { -+ java.util.ArrayList list = this.cachedChunkList; -+ list.clear(); // Ensure the list is empty before re-using it -+ list.ensureCapacity(initialArraySize); -+ -+ return list; -+ } -+ // JettPack end -+ - private void tickChunks() { - long i = this.level.getGameTime(); - long j = i - this.lastInhabitedUpdate; -@@ -1019,7 +1031,7 @@ public class ServerChunkCache extends ChunkSource { - iterator1 = this.entityTickingChunks.iterator(); - } else { - iterator1 = this.entityTickingChunks.unsafeIterator(); -- List shuffled = Lists.newArrayListWithCapacity(this.entityTickingChunks.size()); -+ java.util.ArrayList shuffled = this.redirectChunksListClone(this.entityTickingChunks.size()); // JettPack - reduce allocs - while (iterator1.hasNext()) { - shuffled.add(iterator1.next()); - } -diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index e80176708db486190dd527e3ade5fc690ceb39f7..4fa44b576404438d08085e1d8c82fa96206eae50 100644 ---- a/src/main/java/net/minecraft/server/level/ServerEntity.java -+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -313,7 +313,7 @@ public class ServerEntity { - - if (this.entity instanceof LivingEntity) { - List> list = Lists.newArrayList(); -- EquipmentSlot[] aenumitemslot = EquipmentSlot.values(); -+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - int i = aenumitemslot.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 59d57108f38f38e03cd8b69a53c3e9d40179599a..a0857991d64d89874fea552a5459a45f14529034 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -849,7 +849,7 @@ public class ServerLevel extends Level implements WorldGenLevel { - BlockPos blockposition2 = blockposition.set(j + randomX, randomY, k + randomZ); - BlockState iblockdata = com.destroystokyo.paper.util.maplist.IBlockDataList.getBlockDataFromRaw(raw); - -- iblockdata.randomTick(this, blockposition2, this.randomTickRandom); -+ iblockdata.randomTick(this, blockposition2.immutable(), this.randomTickRandom); // JettPack - reduce allocs - // We drop the fluid tick since LAVA is ALREADY TICKED by the above method (See LiquidBlock). - // TODO CHECK ON UPDATE - } -@@ -1102,7 +1102,7 @@ public class ServerLevel extends Level implements WorldGenLevel { - - public static List getCurrentlyTickingEntities() { - Entity ticking = currentlyTickingEntity.get(); -- List ret = java.util.Arrays.asList(ticking == null ? new Entity[0] : new Entity[] { ticking }); -+ List ret = java.util.Arrays.asList(ticking == null ? me.titaniumtown.Constants.EMPTY_entity_arr : new Entity[] { ticking }); // JettPack - - return ret; - } -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 3125af569ec2bb1cd613a9dd96c3a181d723006d..534c7a702e96523bd2e3cf0bc20c7c63929b4f07 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -220,7 +220,7 @@ public class ServerPlayerGameMode { - if (event.isCancelled()) { - // Let the client know the block still exists - // Paper start - brute force neighbor blocks for any attached blocks -- for (Direction dir : Direction.values()) { -+ for (Direction dir : me.titaniumtown.Constants.ALL_Direction) { // JettPack - this.player.connection.send(new ClientboundBlockUpdatePacket(level, pos.relative(dir))); - } - // Paper end -@@ -407,7 +407,7 @@ public class ServerPlayerGameMode { - this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); - - // Brute force all possible updates -- for (Direction dir : Direction.values()) { -+ for (Direction dir : me.titaniumtown.Constants.ALL_Direction) { // JettPack - this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos.relative(dir))); - } - -diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java -index 8982562721c3a5a5a3305e90bd8b5bc21585a425..08ec8433931fc4347b4e679b9359895ade82d7f6 100644 ---- a/src/main/java/net/minecraft/server/players/StoredUserList.java -+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java -@@ -95,7 +95,7 @@ public abstract class StoredUserList> { - } - - public String[] getUserList() { -- return (String[]) this.map.keySet().toArray(new String[0]); -+ return (String[]) this.map.keySet().toArray(me.titaniumtown.Constants.EMPTY_string_arr); // JettPack - } - - // CraftBukkit start -diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java -index 5d8e9bdf5538b19681f21949368d862fab8a89ad..97c744508cc535418eba65fa722859c81c22d647 100644 ---- a/src/main/java/net/minecraft/util/ZeroBitStorage.java -+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java -@@ -5,7 +5,7 @@ import java.util.function.IntConsumer; - import org.apache.commons.lang3.Validate; - - public class ZeroBitStorage implements BitStorage { -- public static final long[] RAW = new long[0]; -+ public static final long[] RAW = me.titaniumtown.Constants.EMPTY_long_arr; // JettPack - private final int size; - - public ZeroBitStorage(int size) { -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3236a1dc51c394b784d3f42b78e76bf7c2f69c37..3556586c8cd24827bf7b1018c426e258f0f6444d 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3020,7 +3020,7 @@ public abstract class LivingEntity extends Entity { - @Nullable - private Map collectEquipmentChanges() { - Map map = null; -- EquipmentSlot[] aenumitemslot = EquipmentSlot.values(); -+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // Jettpack - int i = aenumitemslot.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 35ff7abd8251b0af6c23fbb63804db632ec5b85d..def1aadb3002441b34bebb24cf727b1b91a688ba 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1011,7 +1011,7 @@ public abstract class Mob extends LivingEntity { - @Override - protected void dropCustomDeathLoot(DamageSource source, int lootingMultiplier, boolean allowDrops) { - super.dropCustomDeathLoot(source, lootingMultiplier, allowDrops); -- EquipmentSlot[] aenumitemslot = EquipmentSlot.values(); -+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs - int j = aenumitemslot.length; - - for (int k = 0; k < j; ++k) { -@@ -1069,7 +1069,7 @@ public abstract class Mob extends LivingEntity { - } - - boolean flag = true; -- EquipmentSlot[] aenumitemslot = EquipmentSlot.values(); -+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs - int j = aenumitemslot.length; - - for (int k = 0; k < j; ++k) { -@@ -1156,7 +1156,7 @@ public abstract class Mob extends LivingEntity { - float f = difficulty.getSpecialMultiplier(); - - this.enchantSpawnedWeapon(f); -- EquipmentSlot[] aenumitemslot = EquipmentSlot.values(); -+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs - int i = aenumitemslot.length; - - for (int j = 0; j < i; ++j) { -@@ -1367,7 +1367,7 @@ public abstract class Mob extends LivingEntity { - t0.setInvulnerable(this.isInvulnerable()); - if (flag) { - t0.setCanPickUpLoot(this.canPickUpLoot()); -- EquipmentSlot[] aenumitemslot = EquipmentSlot.values(); -+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs - int i = aenumitemslot.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java -index a9dfe190f46230077e2e1bf9aacbf5375651f216..431a07a8aa3c5c94eda582c37ef6afc56efdec45 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java -@@ -355,7 +355,7 @@ public class Shulker extends AbstractGolem implements Enemy { - - @Nullable - protected Direction findAttachableSurface(BlockPos pos) { -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java -index 5c6b2bc734c4f49395856975ff77bfbae2b0e85a..dc5c38973cffc3c13ce8f5a83cf9a3d88cecd96a 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java -+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -226,7 +226,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { - return; - } - // CraftBukkit end -- EquipmentSlot[] aenumitemslot = EquipmentSlot.values(); -+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs - int i = aenumitemslot.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 66f808cabcf6a9a6584849b285f1c60133adc7b4..4d0f9131d1bad591b96b2156bd870447104b5a30 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -387,7 +387,7 @@ public final class ItemStack { - - // Brute force all possible updates - BlockPos placedPos = ((CraftBlock) placeEvent.getBlock()).getPosition(); -- for (Direction dir : Direction.values()) { -+ for (Direction dir : me.titaniumtown.Constants.ALL_Direction) { // JettPack - ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, placedPos.relative(dir))); - } - SignItem.openSign = null; // SPIGOT-6758 - Reset on early return -@@ -946,7 +946,7 @@ public final class ItemStack { - int k; - - if (ItemStack.shouldShowInTooltip(i, ItemStack.TooltipPart.MODIFIERS)) { -- EquipmentSlot[] aenumitemslot = EquipmentSlot.values(); -+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - - k = aenumitemslot.length; - -diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java -index 9e3f9099cc47e6c6e40d11ef6d6e83fbf19a3cf7..b9c1db394ee35ed1acead620f7e9e47c60fa1532 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java -+++ b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java -@@ -242,7 +242,7 @@ public class ShapedRecipe implements CraftingRecipe { - } - - if (pattern.length == l) { -- return new String[0]; -+ return me.titaniumtown.Constants.EMPTY_string_arr; // JettPack - } else { - String[] astring1 = new String[pattern.length - l - k]; - -diff --git a/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java b/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java -index ef36f0a9b1849dd3152c0a1c81cded5c4f06aa3c..31f36d9cff9407dbe1d20bffc9a76e940afbff34 100644 ---- a/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java -+++ b/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java -@@ -42,8 +42,8 @@ public class Enchantments { - public static final Enchantment MULTISHOT = Enchantments.register("multishot", new MultiShotEnchantment(Enchantment.Rarity.RARE, new EquipmentSlot[]{EquipmentSlot.MAINHAND})); - public static final Enchantment QUICK_CHARGE = Enchantments.register("quick_charge", new QuickChargeEnchantment(Enchantment.Rarity.UNCOMMON, new EquipmentSlot[]{EquipmentSlot.MAINHAND})); - public static final Enchantment PIERCING = Enchantments.register("piercing", new ArrowPiercingEnchantment(Enchantment.Rarity.COMMON, new EquipmentSlot[]{EquipmentSlot.MAINHAND})); -- public static final Enchantment MENDING = Enchantments.register("mending", new MendingEnchantment(Enchantment.Rarity.RARE, EquipmentSlot.values())); -- public static final Enchantment VANISHING_CURSE = Enchantments.register("vanishing_curse", new VanishingCurseEnchantment(Enchantment.Rarity.VERY_RARE, EquipmentSlot.values())); -+ public static final Enchantment MENDING = Enchantments.register("mending", new MendingEnchantment(Enchantment.Rarity.RARE, me.titaniumtown.Constants.ALL_EquipmentSlot)); // JettPack -+ public static final Enchantment VANISHING_CURSE = Enchantments.register("vanishing_curse", new VanishingCurseEnchantment(Enchantment.Rarity.VERY_RARE, me.titaniumtown.Constants.ALL_EquipmentSlot)); // JettPack - - // CraftBukkit start - static { -diff --git a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java -index 2f9f15d99f8b31e9f13f7f32378b2a9e09bcb5e5..aa565ab33700c92ca607463bdc0dcaef5a9accf1 100644 ---- a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java -+++ b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java -@@ -15,9 +15,17 @@ public class EntityBasedExplosionDamageCalculator extends ExplosionDamageCalcula - - @Override - public Optional getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState) { -- return super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState).map((max) -> { -- return this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, max); -- }); -+ // JettPack start - lithium: reduce allocs -+ Optional optionalBlastResistance = super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState); -+ if (optionalBlastResistance.isPresent()) { -+ float blastResistance = optionalBlastResistance.get(); -+ float effectiveExplosionResistance = this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, blastResistance); -+ if (effectiveExplosionResistance != blastResistance) { -+ return Optional.of(effectiveExplosionResistance); -+ } -+ } -+ return optionalBlastResistance; -+ // Jettpack end - } - - @Override -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index a98d115b7dccd836fa2c0f50333730db6f388aff..33dfda7f4b03c4782cfcf4cc9f36dc26b64fd6d5 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -111,7 +111,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - public static final int MAX_LEVEL_SIZE = 30000000; - public static final int LONG_PARTICLE_CLIP_RANGE = 512; - public static final int SHORT_PARTICLE_CLIP_RANGE = 32; -- private static final Direction[] DIRECTIONS = Direction.values(); - public static final int MAX_BRIGHTNESS = 15; - public static final int TICKS_PER_DAY = 24000; - public static final int MAX_ENTITY_SPAWN_Y = 20000000; -@@ -209,7 +208,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - public org.bukkit.entity.Entity[] getChunkEntities(int chunkX, int chunkZ) { - io.papermc.paper.world.ChunkEntitySlices slices = this.entitySliceManager.getChunk(chunkX, chunkZ); - if (slices == null) { -- return new org.bukkit.entity.Entity[0]; -+ return me.titaniumtown.Constants.EMPTY_bukkit_entity_arr; // JettPack - } - return slices.getChunkEntities(); - } -@@ -1304,7 +1303,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - - public int getBestNeighborSignal(BlockPos pos) { - int i = 0; -- Direction[] aenumdirection = Level.DIRECTIONS; -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int j = aenumdirection.length; - - for (int k = 0; k < j; ++k) { -diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java -index 4d1f94c576b65e067efce95d5ef8c0078453b494..ea6072a8ebc57bb2f4a223f5923361777247ccf8 100644 ---- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java -@@ -191,7 +191,7 @@ public abstract class BaseFireBlock extends Block { - } else { - BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable(); - boolean flag = false; -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java -index 02fc3ede12eadbf72e26e31b1c475c7f5b2ad73a..1653e09e0cdc4d2b0db91194861bf5a91f99c10d 100644 ---- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java -@@ -12,7 +12,7 @@ import net.minecraft.world.level.material.PushReaction; - public class BuddingAmethystBlock extends AmethystBlock { - - public static final int GROWTH_CHANCE = 5; -- private static final Direction[] DIRECTIONS = Direction.values(); -+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - - public BuddingAmethystBlock(BlockBehaviour.Properties settings) { - super(settings); -diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java -index fb8b8a9733ac50096d8406487ab1ae167ef5f7b1..3d0438dd6f51c399782b177b75f048064be58c12 100644 ---- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java -@@ -373,7 +373,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { - - @Override - public int[] getSlotsForFace(Direction side) { -- return side == Direction.DOWN ? new int[]{0} : new int[0]; -+ return side == Direction.DOWN ? me.titaniumtown.Constants.ZERO_int_arr : me.titaniumtown.Constants.EMPTY_int_arr; // Jettpack - } - - @Override -@@ -422,7 +422,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { - - @Override - public int[] getSlotsForFace(Direction side) { -- return side == Direction.UP ? new int[]{0} : new int[0]; -+ return side == Direction.UP ? me.titaniumtown.Constants.ZERO_int_arr : me.titaniumtown.Constants.EMPTY_int_arr; // Jettpack - } - - @Override -@@ -459,7 +459,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { - - @Override - public int[] getSlotsForFace(Direction side) { -- return new int[0]; -+ return me.titaniumtown.Constants.EMPTY_int_arr; // Jettpack - } - - @Override -diff --git a/src/main/java/net/minecraft/world/level/block/ConcretePowderBlock.java b/src/main/java/net/minecraft/world/level/block/ConcretePowderBlock.java -index 0ccdcf43d208e3d35b5e6fcd04245b29012d828c..290fd93bc21285b6a04558250b4afe93bcd1a3d7 100644 ---- a/src/main/java/net/minecraft/world/level/block/ConcretePowderBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/ConcretePowderBlock.java -@@ -67,7 +67,7 @@ public class ConcretePowderBlock extends FallingBlock { - private static boolean touchesLiquid(BlockGetter world, BlockPos pos) { - boolean flag = false; - BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable(); -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/level/block/CoralBlock.java b/src/main/java/net/minecraft/world/level/block/CoralBlock.java -index 3b1dd57d266bdaa617ec4013b39ebbf608e08f1f..1590506e0fe98239a24f4c5df94ca35dbe6a52ef 100644 ---- a/src/main/java/net/minecraft/world/level/block/CoralBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/CoralBlock.java -@@ -46,7 +46,7 @@ public class CoralBlock extends Block { - } - - protected boolean scanForWater(BlockGetter world, BlockPos pos) { -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/level/block/DiodeBlock.java b/src/main/java/net/minecraft/world/level/block/DiodeBlock.java -index 9c764d2273d70b8dffcaa7f324544cb48f12acc3..14db3ab0eaa3b3a259366a6ca73026bf07ddfed8 100644 ---- a/src/main/java/net/minecraft/world/level/block/DiodeBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/DiodeBlock.java -@@ -86,7 +86,7 @@ public abstract class DiodeBlock extends HorizontalDirectionalBlock { - - dropResources(state, world, pos, tileentity); - world.removeBlock(pos, false); -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java -index d8e4fda2d501545e5f891bca317e2aa5f9368f47..ee47460d66156d9629435bfcaa40d32b61ff4093 100644 ---- a/src/main/java/net/minecraft/world/level/block/FireBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java -@@ -137,7 +137,7 @@ public class FireBlock extends BaseFireBlock { - - if (!this.canBurn(iblockdata) && !iblockdata.isFaceSturdy(world, blockposition1, Direction.UP)) { - BlockState iblockdata1 = this.defaultBlockState(); -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -@@ -320,7 +320,7 @@ public class FireBlock extends BaseFireBlock { - } - - private boolean isValidFireLocation(BlockGetter world, BlockPos pos) { -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -@@ -339,7 +339,7 @@ public class FireBlock extends BaseFireBlock { - return 0; - } else { - int i = 0; -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int j = aenumdirection.length; - - for (int k = 0; k < j; ++k) { -diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java -index 4f27969196fe21b38e81d070fe5c0a999dd320dc..81368e748037733c75b48fa0e0157ec773e1e3e4 100644 ---- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java -@@ -36,7 +36,7 @@ public class FrostedIceBlock extends IceBlock { - if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) && this.slightlyMelt(state, world, pos)) { - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - -- for(Direction direction : Direction.values()) { -+ for(Direction direction : me.titaniumtown.Constants.ALL_Direction) { // JettPack - reduce allocs - mutableBlockPos.setWithOffset(pos, direction); - BlockState blockState = world.getBlockStateIfLoaded(mutableBlockPos); // Paper - if (blockState == null) { continue; } // Paper -@@ -74,7 +74,7 @@ public class FrostedIceBlock extends IceBlock { - int i = 0; - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - -- for(Direction direction : Direction.values()) { -+ for(Direction direction : me.titaniumtown.Constants.ALL_Direction) { // JettPack - reduce allocs - mutableBlockPos.setWithOffset(pos, direction); - // Paper start - BlockState blockState = world.getBlockStateIfLoaded(mutableBlockPos); -diff --git a/src/main/java/net/minecraft/world/level/block/LeavesBlock.java b/src/main/java/net/minecraft/world/level/block/LeavesBlock.java -index 0ce900235fd083545a208132079510b5ca3c9cab..1afd59499a71d07222c08ccbc6248e30c24b31bb 100644 ---- a/src/main/java/net/minecraft/world/level/block/LeavesBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/LeavesBlock.java -@@ -84,7 +84,7 @@ public class LeavesBlock extends Block { - private static BlockState updateDistance(BlockState state, LevelAccessor world, BlockPos pos) { - int i = 7; - BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int j = aenumdirection.length; - - for (int k = 0; k < j; ++k) { -diff --git a/src/main/java/net/minecraft/world/level/block/MultifaceBlock.java b/src/main/java/net/minecraft/world/level/block/MultifaceBlock.java -index babffeec9aa8a1526767f2d9fcedd146fc8a2e05..390e9b1f76a6fbbd34c638b4135c31d088901c13 100644 ---- a/src/main/java/net/minecraft/world/level/block/MultifaceBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/MultifaceBlock.java -@@ -52,7 +52,6 @@ public class MultifaceBlock extends Block { - enummap.put(Direction.UP, MultifaceBlock.UP_AABB); - enummap.put(Direction.DOWN, MultifaceBlock.DOWN_AABB); - }); -- protected static final Direction[] DIRECTIONS = Direction.values(); - private final ImmutableMap shapesCache; - private final boolean canRotate; - private final boolean canMirrorX; -@@ -73,7 +72,7 @@ public class MultifaceBlock extends Block { - - @Override - protected void createBlockStateDefinition(StateDefinition.Builder builder) { -- Direction[] aenumdirection = MultifaceBlock.DIRECTIONS; -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -@@ -99,7 +98,7 @@ public class MultifaceBlock extends Block { - @Override - public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { - boolean flag = false; -- Direction[] aenumdirection = MultifaceBlock.DIRECTIONS; -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -@@ -185,7 +184,7 @@ public class MultifaceBlock extends Block { - - private BlockState mapDirections(BlockState state, Function mirror) { - BlockState iblockdata1 = state; -- Direction[] aenumdirection = MultifaceBlock.DIRECTIONS; -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -@@ -200,7 +199,7 @@ public class MultifaceBlock extends Block { - } - - public boolean spreadFromRandomFaceTowardRandomDirection(BlockState state, ServerLevel world, BlockPos pos, Random random) { -- List list = Lists.newArrayList(MultifaceBlock.DIRECTIONS); -+ List list = Lists.newArrayList(me.titaniumtown.Constants.ALL_Direction); // JettPack - - Collections.shuffle(list); - return list.stream().filter((enumdirection) -> { -@@ -211,7 +210,7 @@ public class MultifaceBlock extends Block { - } - - public boolean spreadFromFaceTowardRandomDirection(BlockState state, LevelAccessor world, BlockPos pos, Direction from, Random random, boolean postProcess) { -- List list = Arrays.asList(MultifaceBlock.DIRECTIONS); -+ List list = Arrays.asList(me.titaniumtown.Constants.ALL_Direction); // JettPack - - Collections.shuffle(list, random); - return list.stream().anyMatch((enumdirection1) -> { -@@ -232,7 +231,7 @@ public class MultifaceBlock extends Block { - } - - protected boolean canSpread(BlockState state, BlockGetter world, BlockPos pos, Direction from) { -- return Stream.of(MultifaceBlock.DIRECTIONS).anyMatch((enumdirection1) -> { -+ return Stream.of(me.titaniumtown.Constants.ALL_Direction).anyMatch((enumdirection1) -> { // JettPack - return this.getSpreadFromFaceTowardDirection(state, world, pos, from, enumdirection1).isPresent(); - }); - } -@@ -330,7 +329,7 @@ public class MultifaceBlock extends Block { - - private static VoxelShape calculateMultifaceShape(BlockState state) { - VoxelShape voxelshape = Shapes.empty(); -- Direction[] aenumdirection = MultifaceBlock.DIRECTIONS; -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -@@ -345,13 +344,13 @@ public class MultifaceBlock extends Block { - } - - protected static boolean hasAnyFace(BlockState state) { -- return Arrays.stream(MultifaceBlock.DIRECTIONS).anyMatch((enumdirection) -> { -+ return Arrays.stream(me.titaniumtown.Constants.ALL_Direction).anyMatch((enumdirection) -> { // JettPack - return MultifaceBlock.hasFace(state, enumdirection); - }); - } - - private static boolean hasAnyVacantFace(BlockState state) { -- return Arrays.stream(MultifaceBlock.DIRECTIONS).anyMatch((enumdirection) -> { -+ return Arrays.stream(me.titaniumtown.Constants.ALL_Direction).anyMatch((enumdirection) -> { // JettPack - return !MultifaceBlock.hasFace(state, enumdirection); - }); - } -diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java -index 0bea8d5be72c08236841e7313e20751af8ddb83a..5d7ab3949033e29d88349623547b5ff65573d153 100644 ---- a/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java -@@ -136,7 +136,7 @@ public class RedStoneOreBlock extends Block { - private static void spawnParticles(Level world, BlockPos pos) { - double d0 = 0.5625D; - Random random = world.random; -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java -index 037330bcb10039c013b2ed5fd68dee16ede20fbe..ec89c162ad7de9d1647934efd02b2581b4689a6d 100644 ---- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -392,7 +392,7 @@ public class RedStoneWireBlock extends Block { - Set set = Sets.newHashSet(); - - set.add(pos); -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int j = aenumdirection.length; - - for (int k = 0; k < j; ++k) { -@@ -449,7 +449,7 @@ public class RedStoneWireBlock extends Block { - private void checkCornerChangeAt(Level world, BlockPos pos) { - if (world.getBlockState(pos).is((Block) this)) { - world.updateNeighborsAt(pos, this); -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -@@ -482,7 +482,7 @@ public class RedStoneWireBlock extends Block { - if (!moved && !state.is(newState.getBlock())) { - super.onRemove(state, world, pos, newState, moved); - if (!world.isClientSide) { -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java -index 954b86bea345a8e0e3a8dd425f356db6f5cd496f..93a2dade36a08a17eae34181f087114eca706872 100644 ---- a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java -@@ -34,7 +34,7 @@ public class RedstoneTorchBlock extends TorchBlock { - - @Override - public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -@@ -48,7 +48,7 @@ public class RedstoneTorchBlock extends TorchBlock { - @Override - public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { - if (!moved) { -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java -index 842997ea9f25a05d74a2e8300e44cc39a7e9cd96..d0401376198cbb595abb20ee0d63504fca3b00f9 100644 ---- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java -@@ -62,7 +62,7 @@ public class SpongeBlock extends Block { - Tuple tuple = (Tuple) queue.poll(); - BlockPos blockposition1 = (BlockPos) tuple.getA(); - int j = (Integer) tuple.getB(); -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int k = aenumdirection.length; - - for (int l = 0; l < k; ++l) { -diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index bc028de0ac71e69e8d714db5f65286f306544bf1..6278115e3511fe2176b29122e2c733498f31bb5a 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -@@ -363,7 +363,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { - - public int getParticleAmount() { - int i = 0; -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int j = aenumdirection.length; - - for (int k = 0; k < j; ++k) { -diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index c9c18cf84e4ee5c253bbc64a4b41e91f9f4c4bc7..6ec908eda3855b926958cd546acd9055fb8569b8 100644 ---- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -163,7 +163,7 @@ public class PistonBaseBlock extends DirectionalBlock { - } - - private boolean getNeighborSignal(Level world, BlockPos pos, Direction pistonFace) { -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - int j; -@@ -180,7 +180,7 @@ public class PistonBaseBlock extends DirectionalBlock { - return true; - } else { - BlockPos blockposition1 = pos.above(); -- Direction[] aenumdirection1 = Direction.values(); -+ Direction[] aenumdirection1 = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - - j = aenumdirection1.length; - -diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index eac017fc521bfd1391e75db8628f42b28329d681..101763868fcfa8f0e428b3b7f36983d21d20f9ff 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -1115,7 +1115,7 @@ public abstract class BlockBehaviour { - - private static final class Cache { - -- private static final Direction[] DIRECTIONS = Direction.values(); -+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - private static final int SUPPORT_TYPE_COUNT = SupportType.values().length; - protected final boolean solidRender; - final boolean propagatesSkylightDown; -@@ -1155,7 +1155,7 @@ public abstract class BlockBehaviour { - if (!this.collisionShape.isEmpty() && block.getOffsetType() != BlockBehaviour.OffsetType.NONE) { - throw new IllegalStateException(String.format("%s has a collision shape and an offset type, but is not marked as dynamicShape in its properties.", Registry.BLOCK.getKey(block))); - } else { -- this.largeCollisionShape = Arrays.stream(Direction.Axis.values()).anyMatch((enumdirection_enumaxis) -> { -+ this.largeCollisionShape = Arrays.stream(me.titaniumtown.Constants.ALL_AXIS_Direction).anyMatch((enumdirection_enumaxis) -> { - return this.collisionShape.min(enumdirection_enumaxis) < 0.0D || this.collisionShape.max(enumdirection_enumaxis) > 1.0D; - }); - this.faceSturdy = new boolean[BlockBehaviour.BlockStateBase.Cache.DIRECTIONS.length * BlockBehaviour.BlockStateBase.Cache.SUPPORT_TYPE_COUNT]; -diff --git a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java -index 37d7165dfd17da03428f8dbbbf95aa8005be289c..3994fbc9c81ecec1864f16f1c28600381b3d3fb7 100644 ---- a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java -+++ b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java -@@ -13,7 +13,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; - import org.apache.commons.lang3.mutable.MutableInt; - - public final class BlockLightEngine extends LayerLightEngine { -- private static final Direction[] DIRECTIONS = Direction.values(); -+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); - private final MutableInt mutableInt = new MutableInt(); // Paper - -diff --git a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java -index 4f7b63f2cc8a69fa8efb3a84f6abc3d3dcf05b49..fa7dac236d7456f152193743a17794c75a4cd0d9 100644 ---- a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java -+++ b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java -@@ -22,7 +22,7 @@ public abstract class LayerLightSectionStorage> - protected static final int LIGHT_ONLY = 1; - protected static final int EMPTY = 2; - protected static final DataLayer EMPTY_DATA = new DataLayer(); -- private static final Direction[] DIRECTIONS = Direction.values(); -+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - private final LightLayer layer; - private final LightChunkGetter chunkSource; - protected final LongSet dataSectionSet = new LongOpenHashSet(); -diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java -index d122475c1a9d340046c478087d3ff5bf1ff8932c..a8913009d873d8e646489ffde8ecc780d4b0df02 100644 ---- a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java -+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java -@@ -12,7 +12,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; - import org.apache.commons.lang3.mutable.MutableInt; - - public final class SkyLightEngine extends LayerLightEngine { -- private static final Direction[] DIRECTIONS = Direction.values(); -+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - private static final Direction[] HORIZONTALS = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST}; - private final MutableInt mutableInt = new MutableInt(); // Paper - -diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java -index 8e15976c83c71b8f335511e6747d56d3c8ff6856..657120ddfdc27094de6f38f47375bb281925b0bb 100644 ---- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java -+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java -@@ -125,7 +125,7 @@ public abstract class LavaFluid extends FlowingFluid { - } - - private boolean hasFlammableNeighbours(LevelReader world, BlockPos pos) { -- Direction[] aenumdirection = Direction.values(); -+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs - int i = aenumdirection.length; - - for (int j = 0; j < i; ++j) { -diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -index 35c39aed9583275ef25d32c783715798b52bdb63..b470da69f271d1a5ebb9727c0c34944e85ce3a51 100644 ---- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -@@ -119,7 +119,7 @@ public class PlayerDataStorage { - String[] astring = this.playerDir.list(); - - if (astring == null) { -- astring = new String[0]; -+ astring = me.titaniumtown.Constants.EMPTY_string_arr; // JettPack - } - - for (int i = 0; i < astring.length; ++i) { diff --git a/patches/server/0006-lithium-HashedList.patch b/patches/server/0005-lithium-HashedList.patch similarity index 100% rename from patches/server/0006-lithium-HashedList.patch rename to patches/server/0005-lithium-HashedList.patch diff --git a/patches/server/0007-lithium-CompactSineLUT.patch b/patches/server/0006-lithium-CompactSineLUT.patch similarity index 98% rename from patches/server/0007-lithium-CompactSineLUT.patch rename to patches/server/0006-lithium-CompactSineLUT.patch index 231fec7..65a950a 100644 --- a/patches/server/0007-lithium-CompactSineLUT.patch +++ b/patches/server/0006-lithium-CompactSineLUT.patch @@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..d2b00d9a91b60716d5f458048df3d944 +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java -index 7443df5c2648d279630a7db38d7ddcf4e7113f97..3b6a84fee8e24f53f2f1f8a1ef7db388ae414fe8 100644 +index 87f6559990fde02318bfe2fc7e0a40b39b116888..5e789ce4d13212b83cceeead0a24613a2d247f32 100644 --- a/src/main/java/net/minecraft/util/Mth.java +++ b/src/main/java/net/minecraft/util/Mth.java @@ -8,6 +8,7 @@ import net.minecraft.core.Vec3i; diff --git a/patches/server/0008-lithium-fast-retrieval.patch b/patches/server/0007-lithium-fast-retrieval.patch similarity index 69% rename from patches/server/0008-lithium-fast-retrieval.patch rename to patches/server/0007-lithium-fast-retrieval.patch index b32432e..4d20af3 100644 --- a/patches/server/0008-lithium-fast-retrieval.patch +++ b/patches/server/0007-lithium-fast-retrieval.patch @@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3 You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java -index 74210dc2eef63da7360b1f833bb59b278419fb2b..c3826f82bdf72a03b1f8ce61d0f75e4f733feced 100644 +index 74210dc2eef63da7360b1f833bb59b278419fb2b..859d2e82f21efa1232e7e69f787840b16ed4bd4b 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java +++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java -@@ -32,33 +32,45 @@ public class EntitySectionStorage { +@@ -32,33 +32,66 @@ public class EntitySectionStorage { this.intialSectionVisibility = chunkStatusDiscriminator; } @@ -36,8 +36,6 @@ index 74210dc2eef63da7360b1f833bb59b278419fb2b..c3826f82bdf72a03b1f8ce61d0f75e4f - EntitySection entitySection = this.sections.get(r); - if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible()) { - action.accept(entitySection); -- } -- } + int minX = SectionPos.posToSectionCoord(box.minX - 2.0D); + int minY = SectionPos.posToSectionCoord(box.minY - 2.0D); + int minZ = SectionPos.posToSectionCoord(box.minZ - 2.0D); @@ -45,18 +43,39 @@ index 74210dc2eef63da7360b1f833bb59b278419fb2b..c3826f82bdf72a03b1f8ce61d0f75e4f + int maxY = SectionPos.posToSectionCoord(box.maxY + 2.0D); + int maxZ = SectionPos.posToSectionCoord(box.maxZ + 2.0D); + -+ for (int x = minX; x <= maxX; x++) { -+ for (int z = Math.max(minZ, 0); z <= maxZ; z++) { -+ this.forEachInColumn(x, minY, maxY, z, action); ++ if (maxX >= minX + 4 || maxZ >= minZ + 4) { ++ // [VanillaCopy] ++ for(int o = minX; o <= maxX; ++o) { ++ long p = SectionPos.asLong(o, 0, 0); ++ long q = SectionPos.asLong(o, -1, -1); ++ LongIterator longIterator = this.sectionIds.subSet(p, q + 1L).iterator(); ++ ++ while(longIterator.hasNext()) { ++ long r = longIterator.nextLong(); ++ int s = SectionPos.y(r); ++ int t = SectionPos.z(r); ++ if (s >= minY && s <= maxY && t >= minZ && t <= maxZ) { ++ EntitySection entitySection = this.sections.get(r); ++ if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible()) { ++ action.accept(entitySection); ++ } + } + } } ++ } else { ++ for (int x = minX; x <= maxX; x++) { ++ for (int z = Math.max(minZ, 0); z <= maxZ; z++) { ++ this.forEachInColumn(x, minY, maxY, z, action); ++ } + -+ int bound = Math.min(-1, maxZ); -+ for (int z = minZ; z <= bound; z++) { -+ this.forEachInColumn(x, minY, maxY, z, action); ++ int bound = Math.min(-1, maxZ); ++ for (int z = minZ; z <= bound; z++) { ++ this.forEachInColumn(x, minY, maxY, z, action); ++ } + } -+ } + } + } -+ + + private void forEachInColumn(int x, int minY, int maxY, int z, Consumer> action) { + //y from negative to positive, but y is treated as unsigned + for (int y = Math.max(minY, 0); y <= maxY; y++) { @@ -65,9 +84,9 @@ index 74210dc2eef63da7360b1f833bb59b278419fb2b..c3826f82bdf72a03b1f8ce61d0f75e4f + int bound = Math.min(-1, maxY); + for (int y = minY; y <= bound; y++) { + this.consumeSection(SectionPos.asLong(x, y, z), action); - } ++ } + } - ++ + private void consumeSection(long pos, Consumer> action) { + EntitySection section = this.getSection(pos); + if (section != null && 0 != section.size() && section.getStatus().isAccessible()) { diff --git a/patches/server/0009-Add-config-for-logging-login-location.patch b/patches/server/0008-Add-config-for-logging-login-location.patch similarity index 95% rename from patches/server/0009-Add-config-for-logging-login-location.patch rename to patches/server/0008-Add-config-for-logging-login-location.patch index 2d7f1db..1a00ecd 100644 --- a/patches/server/0009-Add-config-for-logging-login-location.patch +++ b/patches/server/0008-Add-config-for-logging-login-location.patch @@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index cd08f9b16c065be8f0eacaeba51d3e72d332daf9..c1156377bb9314241772ba5e4f458915bba84d47 100644 +index 7a0c1ba40156df69bbbf36d96bed0950130d2351..133286cae44d984c5cd91302b94b9bfa9a32401d 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -487,7 +487,13 @@ public abstract class PlayerList { diff --git a/patches/server/0010-Optimize-TileEntity-load-unload.patch b/patches/server/0009-Optimize-TileEntity-load-unload.patch similarity index 92% rename from patches/server/0010-Optimize-TileEntity-load-unload.patch rename to patches/server/0009-Optimize-TileEntity-load-unload.patch index 84fbd56..ee16201 100644 --- a/patches/server/0010-Optimize-TileEntity-load-unload.patch +++ b/patches/server/0009-Optimize-TileEntity-load-unload.patch @@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 364ecdbe5bbe837b76451bb032fc52f41d8e0dca..96c6ef03a64e425472c64884c91ac4951950362b 100644 +index a98d115b7dccd836fa2c0f50333730db6f388aff..39666d538ea0d87a4defa6f5a00a062ec0d3027b 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -115,8 +115,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -116,8 +116,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public static final int TICKS_PER_DAY = 24000; public static final int MAX_ENTITY_SPAWN_Y = 20000000; public static final int MIN_ENTITY_SPAWN_Y = -20000000; diff --git a/patches/server/0011-Global-Eula-file.patch b/patches/server/0010-Global-Eula-file.patch similarity index 100% rename from patches/server/0011-Global-Eula-file.patch rename to patches/server/0010-Global-Eula-file.patch diff --git a/patches/server/0012-Stop-wasting-resources-on-JsonList-get.patch b/patches/server/0011-Stop-wasting-resources-on-JsonList-get.patch similarity index 95% rename from patches/server/0012-Stop-wasting-resources-on-JsonList-get.patch rename to patches/server/0011-Stop-wasting-resources-on-JsonList-get.patch index 6053456..4f84dfa 100644 --- a/patches/server/0012-Stop-wasting-resources-on-JsonList-get.patch +++ b/patches/server/0011-Stop-wasting-resources-on-JsonList-get.patch @@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index c1156377bb9314241772ba5e4f458915bba84d47..29fafe94b0d42f84af810b9ec9d78e2913970d1d 100644 +index 133286cae44d984c5cd91302b94b9bfa9a32401d..e4c5521ecc421bbf7150d08c5961d484cb02bd0f 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -747,13 +747,19 @@ public abstract class PlayerList { @@ -31,7 +31,7 @@ index c1156377bb9314241772ba5e4f458915bba84d47..29fafe94b0d42f84af810b9ec9d78e29 //chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java -index 08ec8433931fc4347b4e679b9359895ade82d7f6..e630c5a97fae9db6b85d6d0e66cf4c261b2f2138 100644 +index 8982562721c3a5a5a3305e90bd8b5bc21585a425..db22fc485e6091bd81c0c369f302c6ffb4157448 100644 --- a/src/main/java/net/minecraft/server/players/StoredUserList.java +++ b/src/main/java/net/minecraft/server/players/StoredUserList.java @@ -73,9 +73,14 @@ public abstract class StoredUserList> { diff --git a/patches/server/0013-Use-XoRoShiRoRandom.patch b/patches/server/0012-Use-XoRoShiRoRandom.patch similarity index 98% rename from patches/server/0013-Use-XoRoShiRoRandom.patch rename to patches/server/0012-Use-XoRoShiRoRandom.patch index 7f23afa..e757d47 100644 --- a/patches/server/0013-Use-XoRoShiRoRandom.patch +++ b/patches/server/0012-Use-XoRoShiRoRandom.patch @@ -20,7 +20,7 @@ index 20cfe7b9b7127ddeb97aa91d759fc17b4a548eaf..34665a768285fd99e49d57d3879deb1f private long lastFill = -1; private long nextRefill = -1; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 663ab7f3c2e7514c211f01114aa8869f24615da0..5830bda766ea88bb45096d900afe76600ce2f9e0 100644 +index 1d5cee5cae732fbe9181cb3cecc68ec980257248..babc3235c8e7d1e45c21e42184a4c1a13485d950 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -415,7 +415,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop optional = Optional.of(this.getFile("server-icon.png")).filter(File::isFile); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 99a86acedeed4aede7e7afc7e9ee122b78201c7e..4c853c5fd3251c177d31048df545ed55f57cc6ee 100644 +index addf249717b5271b664f4a9d28dd6cc177db5688..d63d923562878e00cd0c95d3b46a11ee68932011 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -1276,10 +1276,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -1264,10 +1264,12 @@ public class ServerChunkCache extends ChunkSource { return runnable; } diff --git a/patches/server/0016-Remove-VersionFetcher.patch b/patches/server/0015-Remove-VersionFetcher.patch similarity index 100% rename from patches/server/0016-Remove-VersionFetcher.patch rename to patches/server/0015-Remove-VersionFetcher.patch diff --git a/patches/server/0017-Remove-unnecessary-getLogger.patch b/patches/server/0016-Remove-unnecessary-getLogger.patch similarity index 100% rename from patches/server/0017-Remove-unnecessary-getLogger.patch rename to patches/server/0016-Remove-unnecessary-getLogger.patch diff --git a/patches/server/0018-Make-a-field-final.patch b/patches/server/0017-Make-a-field-final.patch similarity index 100% rename from patches/server/0018-Make-a-field-final.patch rename to patches/server/0017-Make-a-field-final.patch diff --git a/patches/server/0019-Don-t-create-new-random-instance.patch b/patches/server/0018-Don-t-create-new-random-instance.patch similarity index 93% rename from patches/server/0019-Don-t-create-new-random-instance.patch rename to patches/server/0018-Don-t-create-new-random-instance.patch index 061bb38..67d142f 100644 --- a/patches/server/0019-Don-t-create-new-random-instance.patch +++ b/patches/server/0018-Don-t-create-new-random-instance.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't create new random instance diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5e9c7f428e4a0d920569c2a02e999da910fc9397..0011192cdba6dcb7ca125ae4a49ca89a93cc40f2 100644 +index 1912e5a0db7f15e21028ef80e19623900c655f4a..cd6c398e9cc12b24ffbb30ff1665c92a0d1a1051 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -368,7 +368,7 @@ public class ServerPlayer extends Player { @@ -40,10 +40,10 @@ index f42bce03c21309efbb208be21263b6c09927ed6c..711d5dc2a8b3a5f2a2a35cab59b5ecfd } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 1b6fc6511c32e6509f773d5259e7a07c3b8e79bf..bda7ec47f0a91055a4e86b8968c695a71c2c95aa 100644 +index 2bc690b1ed94a998b30e313922ab889aaa262416..023c9da96e0269bd5082baf5a34d0dbe79d1450b 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -123,13 +123,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -124,13 +124,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public final Thread thread; private final boolean isDebug; private int skyDarken; diff --git a/patches/server/0020-Completely-remove-bootstrapExecutor.patch b/patches/server/0019-Completely-remove-bootstrapExecutor.patch similarity index 100% rename from patches/server/0020-Completely-remove-bootstrapExecutor.patch rename to patches/server/0019-Completely-remove-bootstrapExecutor.patch diff --git a/patches/server/0021-Use-LinkedBlockingDeque-in-IAsyncTaskHandler.patch b/patches/server/0020-Use-LinkedBlockingDeque-in-IAsyncTaskHandler.patch similarity index 100% rename from patches/server/0021-Use-LinkedBlockingDeque-in-IAsyncTaskHandler.patch rename to patches/server/0020-Use-LinkedBlockingDeque-in-IAsyncTaskHandler.patch diff --git a/patches/server/0022-Better-handling-of-async-tasks.patch b/patches/server/0021-Better-handling-of-async-tasks.patch similarity index 100% rename from patches/server/0022-Better-handling-of-async-tasks.patch rename to patches/server/0021-Better-handling-of-async-tasks.patch diff --git a/patches/server/0023-Use-MCUtil.asyncExecutor-for-MAIN_WORKER_EXECUTOR-in.patch b/patches/server/0022-Use-MCUtil.asyncExecutor-for-MAIN_WORKER_EXECUTOR-in.patch similarity index 100% rename from patches/server/0023-Use-MCUtil.asyncExecutor-for-MAIN_WORKER_EXECUTOR-in.patch rename to patches/server/0022-Use-MCUtil.asyncExecutor-for-MAIN_WORKER_EXECUTOR-in.patch diff --git a/patches/server/0024-Remove-sync-chunk-writes-in-server.properties.patch b/patches/server/0023-Remove-sync-chunk-writes-in-server.properties.patch similarity index 100% rename from patches/server/0024-Remove-sync-chunk-writes-in-server.properties.patch rename to patches/server/0023-Remove-sync-chunk-writes-in-server.properties.patch diff --git a/patches/server/0025-Remove-Spigot-tick-limiter.patch b/patches/server/0024-Remove-Spigot-tick-limiter.patch similarity index 94% rename from patches/server/0025-Remove-Spigot-tick-limiter.patch rename to patches/server/0024-Remove-Spigot-tick-limiter.patch index 04b633a..807af2a 100644 --- a/patches/server/0025-Remove-Spigot-tick-limiter.patch +++ b/patches/server/0024-Remove-Spigot-tick-limiter.patch @@ -7,10 +7,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0 You can find the original code on https://gitlab.com/Titaniumtown/JettPack diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index bda7ec47f0a91055a4e86b8968c695a71c2c95aa..980c34a1b816e9c57e31255465626192f96ae147 100644 +index 023c9da96e0269bd5082baf5a34d0dbe79d1450b..3fc2177553756d6759ccf72aa10f7be0eb07df85 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -173,8 +173,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -174,8 +174,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPos lastPhysicsProblem; // Spigot @@ -21,7 +21,7 @@ index bda7ec47f0a91055a4e86b8968c695a71c2c95aa..980c34a1b816e9c57e31255465626192 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 -@@ -400,8 +400,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -401,8 +401,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper diff --git a/patches/server/0026-New-NBT-cache.patch b/patches/server/0025-New-NBT-cache.patch similarity index 98% rename from patches/server/0026-New-NBT-cache.patch rename to patches/server/0025-New-NBT-cache.patch index b690b6b..60769e4 100644 --- a/patches/server/0026-New-NBT-cache.patch +++ b/patches/server/0025-New-NBT-cache.patch @@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -index b470da69f271d1a5ebb9727c0c34944e85ce3a51..633a27ec48a7bb208a7a1629d2b6079a7da27518 100644 +index 35c39aed9583275ef25d32c783715798b52bdb63..6bff63c5897ffd24eeb0dba8a8bfabc38e6b21ee 100644 --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java @@ -24,6 +24,7 @@ public class PlayerDataStorage { diff --git a/patches/server/0027-Add-NBT-API-as-a-first-class-lib.patch b/patches/server/0026-Add-NBT-API-as-a-first-class-lib.patch similarity index 83% rename from patches/server/0027-Add-NBT-API-as-a-first-class-lib.patch rename to patches/server/0026-Add-NBT-API-as-a-first-class-lib.patch index 4a4e528..3c0aae8 100644 --- a/patches/server/0027-Add-NBT-API-as-a-first-class-lib.patch +++ b/patches/server/0026-Add-NBT-API-as-a-first-class-lib.patch @@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/build.gradle.kts b/build.gradle.kts -index 6a8786790cfeb4373d23d7e743f06b19efa45c35..6e66a19c1c9ce284359e3b65552df68a40804aab 100644 +index e7f677cb5abb24c52b10087837f44c865140635c..c501ffbd1f49b2da666888bc7737b1370befe07b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -106,6 +106,7 @@ relocation { +@@ -113,6 +113,7 @@ relocation { relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$packageVersion") { exclude("org.bukkit.craftbukkit.Main*") } diff --git a/patches/server/0028-Add-last-tick-time-API.patch b/patches/server/0027-Add-last-tick-time-API.patch similarity index 98% rename from patches/server/0028-Add-last-tick-time-API.patch rename to patches/server/0027-Add-last-tick-time-API.patch index f615972..ed87843 100644 --- a/patches/server/0028-Add-last-tick-time-API.patch +++ b/patches/server/0027-Add-last-tick-time-API.patch @@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 99cb51ad54f7a6ed63d392070a7dd6903c1676de..8e02bfa3a4530326d32c01bd4948b307cc4a6923 100644 +index 19fb9fe02ef029aecec00dc02f72a2b4a2cda48b..e945a82a23e16820866b899d1b79b4fafe6945dc 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1200,6 +1200,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop -Date: Thu, 23 Dec 2021 23:59:12 -0500 -Subject: [PATCH] PaperPR Fix entity position desync - - -diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 756d4a9f7e2be49076af43212a7c1126e28a11fc..ab0ec6d91694abb836a70e7ce2971f63913a53f6 100644 ---- a/src/main/java/net/minecraft/server/level/ServerEntity.java -+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -164,7 +164,7 @@ public class ServerEntity { - } - // CraftBukkit end - -- if (this.tickCount > 0 || this.entity instanceof AbstractArrow) { -+ if (this.tickCount >= 0 || this.entity instanceof AbstractArrow) { - // Paper start - remove allocation of Vec3D here - long k = ClientboundMoveEntityPacket.entityToPacket(vec3d_dx); - long l = ClientboundMoveEntityPacket.entityToPacket(vec3d_dy); diff --git a/patches/server/0077-vmp-ingredient_matching.patch b/patches/server/0075-vmp-ingredient_matching.patch similarity index 100% rename from patches/server/0077-vmp-ingredient_matching.patch rename to patches/server/0075-vmp-ingredient_matching.patch diff --git a/patches/server/0078-Fix-MC-121706.patch b/patches/server/0076-Fix-MC-121706.patch similarity index 100% rename from patches/server/0078-Fix-MC-121706.patch rename to patches/server/0076-Fix-MC-121706.patch diff --git a/patches/server/0079-vmp-entity.iteration.patch b/patches/server/0077-vmp-entity.iteration.patch similarity index 100% rename from patches/server/0079-vmp-entity.iteration.patch rename to patches/server/0077-vmp-entity.iteration.patch diff --git a/patches/server/0080-vmp-spawn_density_cap.patch b/patches/server/0078-vmp-spawn_density_cap.patch similarity index 100% rename from patches/server/0080-vmp-spawn_density_cap.patch rename to patches/server/0078-vmp-spawn_density_cap.patch diff --git a/patches/server/0081-Configurable-server-metrics.patch b/patches/server/0079-Configurable-server-metrics.patch similarity index 100% rename from patches/server/0081-Configurable-server-metrics.patch rename to patches/server/0079-Configurable-server-metrics.patch diff --git a/patches/server/0082-Configurable-FastMath.round.patch b/patches/server/0080-Configurable-FastMath.round.patch similarity index 99% rename from patches/server/0082-Configurable-FastMath.round.patch rename to patches/server/0080-Configurable-FastMath.round.patch index d4a4b7a..047eb73 100644 --- a/patches/server/0082-Configurable-FastMath.round.patch +++ b/patches/server/0080-Configurable-FastMath.round.patch @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..da81a142d2b072f846f9905a0d5b8e29 +} \ No newline at end of file diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 7764b1f86aca33dc227bf4357c20839b8820eb67..2e141e7b85ef54a084698b5a920b85212271fce8 100644 +index c0d123bff1825366c30aadd3ad8a7fde68ef74e4..d248c83016c8dbd5573c615335a390235003cbe0 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -725,12 +725,12 @@ public class PaperCommand extends Command { @@ -126,7 +126,7 @@ index 88f10d729aa1e0a01790521821d691a0ecd373a2..df2c8dffd626eab0e03b1b62940a52fa // Paper end } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e9777c0d9c0de9378951fb08155409a3dfcc9958..d0a3dac7920d309eefdb72e888817f282662bf0a 100644 +index ce1872b69ed6162f4bbab6c839fa8b9cd1d2aa9a..05490f66d645a61e74c3fda6c757ed03803dbd1d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1470,7 +1470,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0083-lithium-tag.patch b/patches/server/0081-lithium-tag.patch similarity index 100% rename from patches/server/0083-lithium-tag.patch rename to patches/server/0081-lithium-tag.patch diff --git a/patches/server/0084-Time-Utilities.patch b/patches/server/0082-Time-Utilities.patch similarity index 100% rename from patches/server/0084-Time-Utilities.patch rename to patches/server/0082-Time-Utilities.patch diff --git a/patches/server/0086-PaperPR-Don-t-tick-markers.patch b/patches/server/0083-PaperPR-Don-t-tick-markers.patch similarity index 93% rename from patches/server/0086-PaperPR-Don-t-tick-markers.patch rename to patches/server/0083-PaperPR-Don-t-tick-markers.patch index d20dbc6..45df294 100644 --- a/patches/server/0086-PaperPR-Don-t-tick-markers.patch +++ b/patches/server/0083-PaperPR-Don-t-tick-markers.patch @@ -9,7 +9,7 @@ list is only used in the tick and tickPassenger methods, so we can safely not ad markers to it. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 2e141e7b85ef54a084698b5a920b85212271fce8..6b843f9fba6c26b1581be114d6f255a655cde411 100644 +index d248c83016c8dbd5573c615335a390235003cbe0..1bdffb061c9ba08160f35a8c56582f575fea6903 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -614,7 +614,7 @@ public class PaperCommand extends Command { @@ -22,7 +22,7 @@ index 2e141e7b85ef54a084698b5a920b85212271fce8..6b843f9fba6c26b1581be114d6f255a6 } }); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a0857991d64d89874fea552a5459a45f14529034..b836f61a7b5490dea6a531a7e7342ff986194485 100644 +index 59d57108f38f38e03cd8b69a53c3e9d40179599a..a7ac129b754f8aa2c96606c88685caf3a32dc8a2 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2408,6 +2408,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0087-PaperPR-Add-Alternate-Current-redstone-implementatio.patch b/patches/server/0084-PaperPR-Add-Alternate-Current-redstone-implementatio.patch similarity index 99% rename from patches/server/0087-PaperPR-Add-Alternate-Current-redstone-implementatio.patch rename to patches/server/0084-PaperPR-Add-Alternate-Current-redstone-implementatio.patch index 552e963..b33df3e 100644 --- a/patches/server/0087-PaperPR-Add-Alternate-Current-redstone-implementatio.patch +++ b/patches/server/0084-PaperPR-Add-Alternate-Current-redstone-implementatio.patch @@ -2067,7 +2067,7 @@ index d7dcf36c8c972e30320c56e447822cf26f6d5fb3..d7913e8ce46b38d9e2e345c33ecf63f6 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b836f61a7b5490dea6a531a7e7342ff986194485..fd50a81c6cce512e5c7fa47f5e6ab7ab131c575c 100644 +index a7ac129b754f8aa2c96606c88685caf3a32dc8a2..fc1e584ade36bf2c21c34f6a41b5a6ae8eb5d350 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -161,9 +161,14 @@ import org.bukkit.event.weather.LightningStrikeEvent; @@ -2184,7 +2184,7 @@ index f6b8df3493a902c1b8d0d5fe81d593f63ba464d1..334d065b953590d6eba6e853cd9938a1 public static final BooleanProperty INVERTED = BlockStateProperties.INVERTED; protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D); diff --git a/src/main/java/net/minecraft/world/level/block/DiodeBlock.java b/src/main/java/net/minecraft/world/level/block/DiodeBlock.java -index 14db3ab0eaa3b3a259366a6ca73026bf07ddfed8..b1fd5adb98e5b9c6f0798c65c0c83af879acc46f 100644 +index 9c764d2273d70b8dffcaa7f324544cb48f12acc3..63adeacd5f05e56cebca89ac2c2fba221dc60607 100644 --- a/src/main/java/net/minecraft/world/level/block/DiodeBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DiodeBlock.java @@ -22,6 +22,18 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit @@ -2317,7 +2317,7 @@ index 0afffc33f3be221a28c62115f493808aeffb1bd8..eb792a5d16826bbed2c9b4d306b9eed0 public boolean isSignalSource(BlockState state) { return true; diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java -index ec89c162ad7de9d1647934efd02b2581b4689a6d..e1cd41d548115aea464aa11fb5e50021f6a3b4a4 100644 +index 037330bcb10039c013b2ed5fd68dee16ede20fbe..9f150a0075544f2e777f0efd5dbb82746b0fa3d0 100644 --- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -39,8 +39,82 @@ import net.minecraft.world.phys.shapes.CollisionContext; @@ -2506,7 +2506,7 @@ index ec89c162ad7de9d1647934efd02b2581b4689a6d..e1cd41d548115aea464aa11fb5e50021 @Override diff --git a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java -index 93a2dade36a08a17eae34181f087114eca706872..b592b13fc2119100c53a7092acee2ae24616f24c 100644 +index 954b86bea345a8e0e3a8dd425f356db6f5cd496f..6b18f1947df9ddc427ec8deb2890592ae61d621c 100644 --- a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java @@ -20,6 +20,18 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit diff --git a/patches/server/0085-Add-new-Object-0-to-reduce-allocs.patch b/patches/server/0085-Add-new-Object-0-to-reduce-allocs.patch deleted file mode 100644 index 168e037..0000000 --- a/patches/server/0085-Add-new-Object-0-to-reduce-allocs.patch +++ /dev/null @@ -1,153 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Etil <81570777+etil2jz@users.noreply.github.com> -Date: Thu, 6 Jan 2022 18:48:10 +0100 -Subject: [PATCH] Add `new Object[0]` to `reduce allocs` - - -diff --git a/src/main/java/me/titaniumtown/Constants.java b/src/main/java/me/titaniumtown/Constants.java -index 9ede2f067eacc1d418a8d6223f4052b81410d3b3..13a710a6d517a229b8c5679f40cffa3924dc791b 100644 ---- a/src/main/java/me/titaniumtown/Constants.java -+++ b/src/main/java/me/titaniumtown/Constants.java -@@ -19,4 +19,5 @@ public final class Constants { - public static final long[] EMPTY_long_arr = new long[0]; - public static final org.bukkit.entity.Entity[] EMPTY_bukkit_entity_arr = new org.bukkit.entity.Entity[0]; - public static final net.minecraft.world.entity.Entity[] EMPTY_entity_arr = new net.minecraft.world.entity.Entity[0]; -+ public static final Object[] EMPTY_object_arr = new Object[0]; - } -\ No newline at end of file -diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 7b8f9cf06833860d0fc02399822e6aea214883ed..1caa987e2f03203379fb2f798d38d2240665fa00 100644 ---- a/src/main/java/net/minecraft/network/Connection.java -+++ b/src/main/java/net/minecraft/network/Connection.java -@@ -304,7 +304,7 @@ public class Connection extends SimpleChannelInboundHandler> { - } - - public void setListener(PacketListener listener) { -- Validate.notNull(listener, "packetListener", new Object[0]); -+ Validate.notNull(listener, "packetListener", me.titaniumtown.Constants.EMPTY_object_arr); - this.packetListener = listener; - } - // Paper start -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 79936ad8196846e187f8153c15cd8a3e21380876..cb074736f3d547fa188c65da0db7a344ec5f7fa9 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1442,8 +1442,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected - ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info -- this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause -+ this.disconnect(new TranslatableComponent("disconnect.timeout", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause - } - } else { - if (elapsedTime >= 15000L) { // 15 seconds -@@ -815,13 +815,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async - // CraftBukkit start - if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable -- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause -+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause - return; - } - // Paper start - String str = packet.getCommand(); int index = -1; - if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) { -- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause -+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause - return; - } - // Paper end -@@ -2949,7 +2949,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser - // Paper start - if (!org.bukkit.Bukkit.isPrimaryThread()) { - if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { -- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause -+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause - return; - } - } -diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 6006b9b824eee427712c5eafc67788982fc64936..a53f2210409410ba2b0edbd479ed8ab21fc8e5a9 100644 ---- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -255,7 +255,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener - - @Override - public void handleHello(ServerboundHelloPacket packet) { -- Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]); -+ Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", me.titaniumtown.Constants.EMPTY_object_arr); - this.gameProfile = packet.getGameProfile(); - // Paper start - validate usernames - if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) { -@@ -299,7 +299,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener - - @Override - public void handleKey(ServerboundKeyPacket packet) { -- Validate.validState(this.state == ServerLoginPacketListenerImpl.State.KEY, "Unexpected key packet", new Object[0]); -+ Validate.validState(this.state == ServerLoginPacketListenerImpl.State.KEY, "Unexpected key packet", me.titaniumtown.Constants.EMPTY_object_arr); - PrivateKey privatekey = this.server.getKeyPair().getPrivate(); - - final String s; -diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 4feddab26597b67edc4f79e10d41a88d96f16b37..ddd687336a727b164b5f4c566e02b3ad50b26dad 100644 ---- a/src/main/java/net/minecraft/server/players/PlayerList.java -+++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -316,7 +316,7 @@ public abstract class PlayerList { - } - - void disconnectPendingPlayer(ServerPlayer entityplayer) { -- TranslatableComponent msg = new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]); -+ TranslatableComponent msg = new TranslatableComponent("multiplayer.disconnect.duplicate_login", me.titaniumtown.Constants.EMPTY_object_arr); - entityplayer.networkManager.send(new ClientboundDisconnectPacket(msg), (future) -> { - entityplayer.networkManager.disconnect(msg); - entityplayer.networkManager = null; -@@ -730,7 +730,7 @@ public abstract class PlayerList { - while (iterator.hasNext()) { - entityplayer = (ServerPlayer) iterator.next(); - this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved -- entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause -+ entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause - } - - // Instead of kicking then returning, we need to store the kick reason -diff --git a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java -index 049d750d3af991dd14ac8cf644330404e74b2151..f965d6751c8f5a8ec4b26e6ac65414540345b04a 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java -@@ -166,7 +166,7 @@ public final class WeakCollection implements Collection { - - @Override - public Object[] toArray() { -- return this.toArray(new Object[0]); -+ return this.toArray(me.titaniumtown.Constants.EMPTY_object_arr); - } - - @Override -diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java -index bf4c622735bf1f4ae190329465426dac6d178c0d..a4b760c8e001545d519b977aeb474222c5bd2c66 100644 ---- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java -+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java -@@ -310,7 +310,7 @@ public class ItemStackTest extends AbstractTestingBase { - return ImmutableList.of(); // TODO, test basic durability issues - } - -- static final Object[][] EMPTY_ARRAY = new Object[0][]; -+ static final Object[][] EMPTY_ARRAY = me.titaniumtown.Constants.EMPTY_object_arr[]; - /** - * Materials that generate unique item meta types. - */ diff --git a/patches/server/0088-lithium-entity.fast_elytra_check.patch b/patches/server/0085-lithium-entity.fast_elytra_check.patch similarity index 90% rename from patches/server/0088-lithium-entity.fast_elytra_check.patch rename to patches/server/0085-lithium-entity.fast_elytra_check.patch index 5e2de68..5915a3f 100644 --- a/patches/server/0088-lithium-entity.fast_elytra_check.patch +++ b/patches/server/0085-lithium-entity.fast_elytra_check.patch @@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3 You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d0a3dac7920d309eefdb72e888817f282662bf0a..30fdf60cf255414f5efe8d842f291f74892629bc 100644 +index 05490f66d645a61e74c3fda6c757ed03803dbd1d..bb033fa7fa99b3c1d47d5e48ba361d9bf69bfb48 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3370,6 +3370,8 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0089-lithium-profiler.patch b/patches/server/0086-lithium-profiler.patch similarity index 92% rename from patches/server/0089-lithium-profiler.patch rename to patches/server/0086-lithium-profiler.patch index c7b2aab..f13f01e 100644 --- a/patches/server/0089-lithium-profiler.patch +++ b/patches/server/0086-lithium-profiler.patch @@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3 You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index fd50a81c6cce512e5c7fa47f5e6ab7ab131c575c..91317d79ce86368aa1826cafe7fa0de41b04a569 100644 +index fc1e584ade36bf2c21c34f6a41b5a6ae8eb5d350..68854fa91cb9558256b819aaa2a51de6f84b0803 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -220,6 +220,13 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0090-lithium-entity.fast_hand_swing.patch b/patches/server/0087-lithium-entity.fast_hand_swing.patch similarity index 90% rename from patches/server/0090-lithium-entity.fast_hand_swing.patch rename to patches/server/0087-lithium-entity.fast_hand_swing.patch index dad0169..f750e66 100644 --- a/patches/server/0090-lithium-entity.fast_hand_swing.patch +++ b/patches/server/0087-lithium-entity.fast_hand_swing.patch @@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3 You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 30fdf60cf255414f5efe8d842f291f74892629bc..2b84a6a38459b715a415a183ca40697d4f8fbf72 100644 +index bb033fa7fa99b3c1d47d5e48ba361d9bf69bfb48..60384a8ff1d60be7a02dfb5d81864085a554ee3c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2419,6 +2419,8 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0091-c2me-optimization.math.patch b/patches/server/0088-c2me-optimization.math.patch similarity index 80% rename from patches/server/0091-c2me-optimization.math.patch rename to patches/server/0088-c2me-optimization.math.patch index 6bce3d3..3ec24f4 100644 --- a/patches/server/0091-c2me-optimization.math.patch +++ b/patches/server/0088-c2me-optimization.math.patch @@ -9,7 +9,7 @@ Original code by RelativityMC, licensed under MIT You can find the original code on https://github.com/RelativityMC/C2ME-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java -index 765b56776e457109ddea9f7dbfd0b17beefee51e..883a8dcf94b619cd5ffbcfc6f28809c2c6a71f55 100644 +index 765b56776e457109ddea9f7dbfd0b17beefee51e..8a9783a15e1bd1a1c82ec221d662f71cd71f8371 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java +++ b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java @@ -11,6 +11,27 @@ public final class ImprovedNoise { @@ -92,7 +92,7 @@ index 765b56776e457109ddea9f7dbfd0b17beefee51e..883a8dcf94b619cd5ffbcfc6f28809c2 public double noiseWithDerivative(double x, double y, double z, double[] ds) { double d = x + this.xo; -@@ -84,26 +109,141 @@ public final class ImprovedNoise { +@@ -84,26 +109,107 @@ public final class ImprovedNoise { return this.p[hash & 255] & 255; } @@ -185,38 +185,14 @@ index 765b56776e457109ddea9f7dbfd0b17beefee51e..883a8dcf94b619cd5ffbcfc6f28809c2 + final double var60 = localX - 1.0; + final double var61 = localY - 1.0; + final double var62 = localZ - 1.0; -+ final double var63 = var36 * localX; -+ final double var64 = var37 * localY; -+ final double var65 = var38 * localZ; -+ final double var66 = var39 * var60; -+ final double var67 = var40 * localY; -+ final double var68 = var41 * localZ; -+ final double var69 = var42 * localX; -+ final double var70 = var43 * var61; -+ final double var71 = var44 * localZ; -+ final double var72 = var45 * var60; -+ final double var73 = var46 * var61; -+ final double var74 = var47 * localZ; -+ final double var75 = var48 * localX; -+ final double var76 = var49 * localY; -+ final double var77 = var50 * var62; -+ final double var78 = var51 * var60; -+ final double var79 = var52 * localY; -+ final double var80 = var53 * var62; -+ final double var81 = var54 * localX; -+ final double var82 = var55 * var61; -+ final double var83 = var56 * var62; -+ final double var84 = var57 * var60; -+ final double var85 = var58 * var61; -+ final double var86 = var59 * var62; -+ final double var87 = var63 + var64 + var65; -+ final double var88 = var66 + var67 + var68; -+ final double var89 = var69 + var70 + var71; -+ final double var90 = var72 + var73 + var74; -+ final double var91 = var75 + var76 + var77; -+ final double var92 = var78 + var79 + var80; -+ final double var93 = var81 + var82 + var83; -+ final double var94 = var84 + var85 + var86; ++ final double var87 = var36 * localX + var37 * localY + var38 * localZ; ++ final double var88 = var39 * var60 + var40 * localY + var41 * localZ; ++ final double var89 = var42 * localX + var43 * var61 + var44 * localZ; ++ final double var90 = var45 * var60 + var46 * var61 + var47 * localZ; ++ final double var91 = var48 * localX + var49 * localY + var50 * var62; ++ final double var92 = var51 * var60 + var52 * localY + var53 * var62; ++ final double var93 = var54 * localX + var55 * var61 + var56 * var62; ++ final double var94 = var57 * var60 + var58 * var61 + var59 * var62; + + final double var95 = localX * 6.0 - 15.0; + final double var96 = fadeLocalX * 6.0 - 15.0; @@ -228,21 +204,11 @@ index 765b56776e457109ddea9f7dbfd0b17beefee51e..883a8dcf94b619cd5ffbcfc6f28809c2 + final double var102 = fadeLocalX * fadeLocalX * fadeLocalX * var99; + final double var103 = localZ * localZ * localZ * var100; + -+ final double var104 = var90 - var89; -+ final double var105 = var88 - var87; -+ final double var106 = var94 - var93; -+ final double var107 = var92 - var91; -+ final double var108 = var101 * var104; -+ final double var109 = var101 * var105; -+ final double var110 = var101 * var106; -+ final double var111 = var101 * var107; -+ final double var112 = var89 + var108; -+ final double var113 = var87 + var109; -+ final double var114 = var93 + var110; -+ final double var115 = var91 + var111; -+ final double var116 = var112 - var113; ++ final double var113 = var87 + var101 * (var88 - var87); ++ final double var114 = var93 + var101 * (var94 - var93); ++ final double var115 = var91 + var101 * (var92 - var91); + final double var117 = var114 - var115; -+ final double var118 = var102 * var116; ++ final double var118 = var102 * (var89 + var101 * (var90 - var89) - var113); + final double var119 = var102 * var117; + final double var120 = var113 + var118; + final double var121 = var115 + var119; diff --git a/patches/server/0092-lithium-entity.fast_powder_snow_check.patch b/patches/server/0089-lithium-entity.fast_powder_snow_check.patch similarity index 94% rename from patches/server/0092-lithium-entity.fast_powder_snow_check.patch rename to patches/server/0089-lithium-entity.fast_powder_snow_check.patch index c488267..e1e87ca 100644 --- a/patches/server/0092-lithium-entity.fast_powder_snow_check.patch +++ b/patches/server/0089-lithium-entity.fast_powder_snow_check.patch @@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3 You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2b84a6a38459b715a415a183ca40697d4f8fbf72..b7c6dd25e439d24719c8f663c7a448854dc6ee7a 100644 +index 60384a8ff1d60be7a02dfb5d81864085a554ee3c..eab2a2daff86dbcdf5f2f63c6948d89033686118 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -564,11 +564,11 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0093-lithium-collections.attributes.patch b/patches/server/0090-lithium-collections.attributes.patch similarity index 100% rename from patches/server/0093-lithium-collections.attributes.patch rename to patches/server/0090-lithium-collections.attributes.patch diff --git a/patches/server/0095-lithium-collections.entity_by_type.patch b/patches/server/0091-lithium-collections.entity_by_type.patch similarity index 100% rename from patches/server/0095-lithium-collections.entity_by_type.patch rename to patches/server/0091-lithium-collections.entity_by_type.patch diff --git a/patches/server/0096-lithium-collections.entity_filtering.patch b/patches/server/0092-lithium-collections.entity_filtering.patch similarity index 100% rename from patches/server/0096-lithium-collections.entity_filtering.patch rename to patches/server/0092-lithium-collections.entity_filtering.patch diff --git a/patches/server/0097-lithium-chunk.serialization.patch b/patches/server/0093-lithium-chunk.serialization.patch similarity index 88% rename from patches/server/0097-lithium-chunk.serialization.patch rename to patches/server/0093-lithium-chunk.serialization.patch index b9d4c9e..6dffb04 100644 --- a/patches/server/0097-lithium-chunk.serialization.patch +++ b/patches/server/0093-lithium-chunk.serialization.patch @@ -8,7 +8,7 @@ You can find the original code on https://github.com/CaffeineMC/lithium-fabric ( diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java new file mode 100644 -index 0000000000000000000000000000000000000000..74057e9ccfb8b4bc6c44f64cfcde4f9429444bf2 +index 0000000000000000000000000000000000000000..16debe176798f316c122e8e7aef2b50ecb9883a6 --- /dev/null +++ b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java @@ -0,0 +1,189 @@ @@ -201,6 +201,7 @@ index 0000000000000000000000000000000000000000..74057e9ccfb8b4bc6c44f64cfcde4f94 + return new LithiumHashPalette<>(idList, bits, listener, list); + } +} +\ No newline at end of file diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java index 106610ccc74b70b557b01c61262d56c4f1147acf..fc986f02290fbe20246022072944980f35dd200c 100644 --- a/src/main/java/net/minecraft/util/BitStorage.java @@ -221,21 +222,22 @@ index 106610ccc74b70b557b01c61262d56c4f1147acf..fc986f02290fbe20246022072944980f + void compact(Palette srcPalette, Palette dstPalette, short[] out); // JettPack - lithium: chunk.serialization } diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java -index 881a2318aac72526e0451688af58c620e4f525d1..d5ade4b516f41b58be87bcf33286e8e764c30068 100644 +index 881a2318aac72526e0451688af58c620e4f525d1..cf5051f05f8bd387b20fd4dafcbe2a5fd9b7170c 100644 --- a/src/main/java/net/minecraft/util/SimpleBitStorage.java +++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java -@@ -3,6 +3,7 @@ package net.minecraft.util; +@@ -2,6 +2,7 @@ package net.minecraft.util; + import java.util.function.IntConsumer; import javax.annotation.Nullable; - import org.apache.commons.lang3.Validate; +import net.minecraft.world.level.chunk.Palette; // JettPack + import org.apache.commons.lang3.Validate; public class SimpleBitStorage implements BitStorage { - private static final int[] MAGIC = new int[]{-1, -1, 0, Integer.MIN_VALUE, 0, 0, 1431655765, 1431655765, 0, Integer.MIN_VALUE, 0, 1, 858993459, 858993459, 0, 715827882, 715827882, 0, 613566756, 613566756, 0, Integer.MIN_VALUE, 0, 2, 477218588, 477218588, 0, 429496729, 429496729, 0, 390451572, 390451572, 0, 357913941, 357913941, 0, 330382099, 330382099, 0, 306783378, 306783378, 0, 286331153, 286331153, 0, Integer.MIN_VALUE, 0, 3, 252645135, 252645135, 0, 238609294, 238609294, 0, 226050910, 226050910, 0, 214748364, 214748364, 0, 204522252, 204522252, 0, 195225786, 195225786, 0, 186737708, 186737708, 0, 178956970, 178956970, 0, 171798691, 171798691, 0, 165191049, 165191049, 0, 159072862, 159072862, 0, 153391689, 153391689, 0, 148102320, 148102320, 0, 143165576, 143165576, 0, 138547332, 138547332, 0, Integer.MIN_VALUE, 0, 4, 130150524, 130150524, 0, 126322567, 126322567, 0, 122713351, 122713351, 0, 119304647, 119304647, 0, 116080197, 116080197, 0, 113025455, 113025455, 0, 110127366, 110127366, 0, 107374182, 107374182, 0, 104755299, 104755299, 0, 102261126, 102261126, 0, 99882960, 99882960, 0, 97612893, 97612893, 0, 95443717, 95443717, 0, 93368854, 93368854, 0, 91382282, 91382282, 0, 89478485, 89478485, 0, 87652393, 87652393, 0, 85899345, 85899345, 0, 84215045, 84215045, 0, 82595524, 82595524, 0, 81037118, 81037118, 0, 79536431, 79536431, 0, 78090314, 78090314, 0, 76695844, 76695844, 0, 75350303, 75350303, 0, 74051160, 74051160, 0, 72796055, 72796055, 0, 71582788, 71582788, 0, 70409299, 70409299, 0, 69273666, 69273666, 0, 68174084, 68174084, 0, Integer.MIN_VALUE, 0, 5}; @@ -201,4 +202,44 @@ public class SimpleBitStorage implements BitStorage { super(message); } } +-} + + // JettPack start - lithium: chunk.serialization + @Override @@ -276,19 +278,20 @@ index 881a2318aac72526e0451688af58c620e4f525d1..d5ade4b516f41b58be87bcf33286e8e7 + } + } + // JettPack end - } ++} +\ No newline at end of file diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java -index 97c744508cc535418eba65fa722859c81c22d647..3558ce5dfb7bafff17b41ebad76b63c611c0b07d 100644 +index 5d8e9bdf5538b19681f21949368d862fab8a89ad..2224245a985dfe78565dfdb42840d3ed43530525 100644 --- a/src/main/java/net/minecraft/util/ZeroBitStorage.java +++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java -@@ -3,6 +3,7 @@ package net.minecraft.util; +@@ -2,6 +2,7 @@ package net.minecraft.util; + import java.util.Arrays; import java.util.function.IntConsumer; - import org.apache.commons.lang3.Validate; +import net.minecraft.world.level.chunk.Palette; // JettPack + import org.apache.commons.lang3.Validate; public class ZeroBitStorage implements BitStorage { - public static final long[] RAW = me.titaniumtown.Constants.EMPTY_long_arr; // JettPack @@ -72,4 +73,6 @@ public class ZeroBitStorage implements BitStorage { public BitStorage copy() { return this; @@ -308,10 +311,10 @@ index acae3eb30e0689048937f479dc3070f0688abdad..9c2b79655f2c63a208c7087d5d897db0 int onResize(int newBits, T object); } diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..62defdcdaa15abea2b5bf796d7eb248b7775e1da 100644 +index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..446592f9343fe005bf9a4055250efb1a8ba93fbd 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -22,8 +22,26 @@ import net.minecraft.util.Mth; +@@ -22,8 +22,23 @@ import net.minecraft.util.Mth; import net.minecraft.util.SimpleBitStorage; import net.minecraft.util.ThreadingDetector; import net.minecraft.util.ZeroBitStorage; @@ -321,11 +324,9 @@ index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..62defdcdaa15abea2b5bf796d7eb248b + // JettPack start - lithium: chunk.serialization + private static final ThreadLocal CACHED_ARRAY_4096 = ThreadLocal.withInitial(() -> new short[4096]); + private static final ThreadLocal CACHED_ARRAY_64 = ThreadLocal.withInitial(() -> new short[64]); -+ + private Optional asOptional(long[] data) { + return Optional.of(Arrays.stream(data)); + } -+ + private short[] getOrCreate(int size) { + return switch (size) { + case 64 -> CACHED_ARRAY_64.get(); @@ -333,12 +334,11 @@ index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..62defdcdaa15abea2b5bf796d7eb248b + default -> new short[size]; + }; + } -+ + // JettPack end private static final int MIN_PALETTE_BITS = 0; private final PaletteResize dummyPaletteResize = (newSize, added) -> { return 0; -@@ -278,30 +296,54 @@ public class PalettedContainer implements PaletteResize { +@@ -278,30 +293,54 @@ public class PalettedContainer implements PaletteResize { private synchronized PalettedContainer.DiscData write(IdMap idList, PalettedContainer.Strategy provider) { // Paper - synchronize this.acquire(); @@ -410,7 +410,7 @@ index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..62defdcdaa15abea2b5bf796d7eb248b } private static void swapPalette(int[] is, IntUnaryOperator intUnaryOperator) { -@@ -333,17 +375,37 @@ public class PalettedContainer implements PaletteResize { +@@ -333,17 +372,37 @@ public class PalettedContainer implements PaletteResize { } public void count(PalettedContainer.CountConsumer counter) { diff --git a/patches/server/0094-c2me-vectorizations.vectorize_noise.patch b/patches/server/0094-c2me-vectorizations.vectorize_noise.patch deleted file mode 100644 index 85a7fc1..0000000 --- a/patches/server/0094-c2me-vectorizations.vectorize_noise.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ishland -Date: Tue, 21 Sep 2021 10:37:45 +0200 -Subject: [PATCH] c2me: vectorizations.vectorize_noise - -Copyright (c) 2021-2022 ishland - -Original code by RelativityMC, licensed under MIT -You can find the original code on https://github.com/RelativityMC/C2ME-fabric (Yarn mappings) - -diff --git a/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedAlgorithms.java b/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedAlgorithms.java -new file mode 100644 -index 0000000000000000000000000000000000000000..77aed653efa723b17e1943e40202954d730f4b47 ---- /dev/null -+++ b/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedAlgorithms.java -@@ -0,0 +1,9 @@ -+package com.ishland.c2me.libs.vectorized_algorithms; -+ -+public class VectorizedAlgorithms { -+ -+ public static double perlinNoiseVectorized(byte[] p, int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalX) { -+ return VectorizedPerlinNoise.sample(p, sectionX, sectionY, sectionZ, localX, localY, localZ, fadeLocalX); -+ } -+ -+} -diff --git a/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedPerlinNoise.java b/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedPerlinNoise.java -new file mode 100644 -index 0000000000000000000000000000000000000000..6679e557f4a3c7dbe88c77c605c97ff673425d7e ---- /dev/null -+++ b/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedPerlinNoise.java -@@ -0,0 +1,115 @@ -+package com.ishland.c2me.libs.vectorized_algorithms; -+ -+import jdk.incubator.vector.DoubleVector; -+import jdk.incubator.vector.VectorSpecies; -+ -+public class VectorizedPerlinNoise { -+ -+ protected static final int[][] GRADIENTS = new int[][]{{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, {0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}, {1, 1, 0}, {0, -1, 1}, {-1, 1, 0}, {0, -1, -1}}; -+ private static final VectorSpecies speciesPreferred = DoubleVector.SPECIES_PREFERRED; -+ private static final VectorSpecies speciesGrad = speciesPreferred.length() > 8 ? DoubleVector.SPECIES_512 : speciesPreferred; -+ private static final VectorSpecies speciesPerlinFade = speciesPreferred.length() > 4 ? DoubleVector.SPECIES_256 : speciesPreferred; -+ -+ static { -+ System.out.println("Using vector size of " + speciesGrad.vectorBitSize() + " bits for grad()"); -+ System.out.println("Using vector size of " + speciesPerlinFade.vectorBitSize() + " bits for perlinFade()"); -+ } -+ -+ private static double lerp(double delta, double start, double end) { -+ return start + delta * (end - start); -+ } -+ -+ static double sample(byte[] p, int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalX) { -+ int i = p[sectionX & 0xFF] & 255; -+ int j = p[sectionX + 1 & 0xFF] & 255; -+ int k = p[i + sectionY & 0xFF] & 255; -+ int l = p[i + sectionY + 1 & 0xFF] & 255; -+ int m = p[j + sectionY & 0xFF] & 255; -+ int n = p[j + sectionY + 1 & 0xFF] & 255; -+ -+ // grad ops -+ double[] gradX = new double[] { -+ GRADIENTS[p[k + sectionZ & 0xFF] & 15][0], -+ GRADIENTS[p[m + sectionZ & 0xFF] & 15][0], -+ GRADIENTS[p[l + sectionZ & 0xFF] & 15][0], -+ GRADIENTS[p[n + sectionZ & 0xFF] & 15][0], -+ GRADIENTS[p[k + sectionZ + 1 & 0xFF] & 15][0], -+ GRADIENTS[p[m + sectionZ + 1 & 0xFF] & 15][0], -+ GRADIENTS[p[l + sectionZ + 1 & 0xFF] & 15][0], -+ GRADIENTS[p[n + sectionZ + 1 & 0xFF] & 15][0], -+ }; -+ double[] mulX = new double[] { -+ localX, localX - 1.0, localX, localX - 1.0, -+ localX, localX - 1.0, localX, localX - 1.0, -+ }; -+ double[] gradY = new double[] { -+ GRADIENTS[p[k + sectionZ & 0xFF] & 15][1], -+ GRADIENTS[p[m + sectionZ & 0xFF] & 15][1], -+ GRADIENTS[p[l + sectionZ & 0xFF] & 15][1], -+ GRADIENTS[p[n + sectionZ & 0xFF] & 15][1], -+ GRADIENTS[p[k + sectionZ + 1 & 0xFF] & 15][1], -+ GRADIENTS[p[m + sectionZ + 1 & 0xFF] & 15][1], -+ GRADIENTS[p[l + sectionZ + 1 & 0xFF] & 15][1], -+ GRADIENTS[p[n + sectionZ + 1 & 0xFF] & 15][1], -+ }; -+ double[] mulY = new double[] { -+ localY, localY, localY - 1.0, localY - 1.0, -+ localY, localY, localY - 1.0, localY - 1.0, -+ }; -+ double[] gradZ = new double[] { -+ GRADIENTS[p[k + sectionZ & 0xFF] & 15][2], -+ GRADIENTS[p[m + sectionZ & 0xFF] & 15][2], -+ GRADIENTS[p[l + sectionZ & 0xFF] & 15][2], -+ GRADIENTS[p[n + sectionZ & 0xFF] & 15][2], -+ GRADIENTS[p[k + sectionZ + 1 & 0xFF] & 15][2], -+ GRADIENTS[p[m + sectionZ + 1 & 0xFF] & 15][2], -+ GRADIENTS[p[l + sectionZ + 1 & 0xFF] & 15][2], -+ GRADIENTS[p[n + sectionZ + 1 & 0xFF] & 15][2], -+ }; -+ double[] mulZ = new double[] { -+ localZ, localZ, localZ, localZ, -+ localZ - 1.0, localZ - 1.0, localZ - 1.0, localZ - 1.0, -+ }; -+ -+ double[] gradResArray = new double[8]; -+ for (int i1 = 0; i1 < gradX.length; i1 += speciesGrad.length()) { -+ final DoubleVector gradXVector = DoubleVector.fromArray(speciesGrad, gradX, i1); -+ final DoubleVector mulXVector = DoubleVector.fromArray(speciesGrad, mulX, i1); -+ final DoubleVector resX = gradXVector.mul(mulXVector); -+ final DoubleVector gradYVector = DoubleVector.fromArray(speciesGrad, gradY, i1); -+ final DoubleVector mulYVector = DoubleVector.fromArray(speciesGrad, mulY, i1); -+ final DoubleVector resY = gradYVector.mul(mulYVector); -+ final DoubleVector gradZVector = DoubleVector.fromArray(speciesGrad, gradZ, i1); -+ final DoubleVector mulZVector = DoubleVector.fromArray(speciesGrad, mulZ, i1); -+ final DoubleVector resZ = gradZVector.mul(mulZVector); -+ final DoubleVector res = resX.add(resY).add(resZ); -+ res.intoArray(gradResArray, i1); -+ } -+ -+ // fade ops -+ // perlinFade(value): value * value * value * (value * (value * 6.0 - 15.0) + 10.0) -+ final double[] fades = new double[]{localX, fadeLocalX, localZ, 0.0}; -+ final double[] fadeResArray = new double[4]; -+ for (int i1 = 0; i1 < fades.length; i1 += speciesPerlinFade.length()) { -+ final DoubleVector vector = DoubleVector.fromArray(speciesPerlinFade, fades, i1); -+ final DoubleVector res = vector -+ .mul(6.0) -+ .add(-15.0) -+ .mul(vector) -+ .add(10.0) -+ .mul(vector) -+ .mul(vector) -+ .mul(vector); -+ res.intoArray(fadeResArray, i1); -+ } -+ -+ // lerp(delta, start, end): start + delta * (end - start) -+ -+ return lerp( -+ fadeResArray[2], -+ lerp(fadeResArray[1], lerp(fadeResArray[0], gradResArray[0], gradResArray[1]), lerp(fadeResArray[0], gradResArray[2], gradResArray[3])), -+ lerp(fadeResArray[1], lerp(fadeResArray[0], gradResArray[4], gradResArray[5]), lerp(fadeResArray[0], gradResArray[6], gradResArray[7])) -+ ); -+ } -+ -+} -diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java -index 883a8dcf94b619cd5ffbcfc6f28809c2c6a71f55..873614980ec45bcd64ef05fd938bd99b85b9e51e 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java -@@ -1,5 +1,6 @@ - package net.minecraft.world.level.levelgen.synth; - -+import com.ishland.c2me.libs.vectorized_algorithms.VectorizedAlgorithms; // Mirai - c2me: vectorizations.vectorize_noise - import com.google.common.annotations.VisibleForTesting; - import net.minecraft.util.Mth; - import net.minecraft.world.level.levelgen.RandomSource; -@@ -115,6 +116,7 @@ public final class ImprovedNoise { - * @reason inline Mth & small optimization: remove frequent type conversions and redundant ops - */ - private double sampleAndLerp(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalX) { -+ if (wtf.etil.mirai.MiraiConfig.vectorizedPerlinNoise) { return VectorizedAlgorithms.perlinNoiseVectorized(p, sectionX, sectionY, sectionZ, localX, localY, localZ, fadeLocalX); } // Mirai - c2me: vectorizations.vectorize_noise - // TODO [VanillaCopy] but inlined - final int var0 = sectionX & 0xFF; - final int var1 = (sectionX + 1) & 0xFF; -diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java -index 1ba057cbd0ec23cd7ef3d3d1c7685f44cfe34eec..90cf922c8df669ac80451d64b376918dece09dc9 100644 ---- a/src/main/java/wtf/etil/mirai/MiraiConfig.java -+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java -@@ -247,4 +247,9 @@ public class MiraiConfig { - riskyMathRoundOpt = getBoolean("use-risky-mathround-opt", riskyMathRoundOpt); - } - -+ public static boolean vectorizedPerlinNoise = false; -+ private static void vectorizedNoise() { -+ vectorizedPerlinNoise = getBoolean("use-vectorized-perlin-noise", vectorizedPerlinNoise); -+ } -+ - } -\ No newline at end of file diff --git a/patches/server/0098-lithium-world.inline_height.patch b/patches/server/0094-lithium-world.inline_height.patch similarity index 100% rename from patches/server/0098-lithium-world.inline_height.patch rename to patches/server/0094-lithium-world.inline_height.patch diff --git a/patches/server/0099-hydrogen.patch b/patches/server/0095-hydrogen.patch similarity index 99% rename from patches/server/0099-hydrogen.patch rename to patches/server/0095-hydrogen.patch index 02034db..760a03c 100644 --- a/patches/server/0099-hydrogen.patch +++ b/patches/server/0095-hydrogen.patch @@ -1284,7 +1284,7 @@ index 6e5d13e63c97cb95b93af1d997dc0eb53f966566..231448a1a49f1c4034ce09e06dcbdabe throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(this.namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(this.path)); // Paper } else if (!isValidPath(this.path)) { diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 2f5c021b6849acb81064d55418707921424b649b..8cf835307c36fb048d62af9f417daeeeb71a0cff 100644 +index e2c8f716af55ebb7e4233c2a3d6515f8f4a239fa..3392c4b39c7edb2ddfe6580ab15c75573e64c850 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -64,6 +64,7 @@ public class Main { diff --git a/patches/server/0100-Configurable-criterion-triggers.patch b/patches/server/0096-Configurable-criterion-triggers.patch similarity index 71% rename from patches/server/0100-Configurable-criterion-triggers.patch rename to patches/server/0096-Configurable-criterion-triggers.patch index 2150e93..595bb24 100644 --- a/patches/server/0100-Configurable-criterion-triggers.patch +++ b/patches/server/0096-Configurable-criterion-triggers.patch @@ -9,42 +9,44 @@ Original code by YatopiaMC, licensed under MIT You can find the original code on https://github.com/YatopiaMC/Yatopia diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0eddb9829788ab7c9bf72805bc46a24152c4a7a1..c0bc0dedb74a5b8a0f8afef51c28323209d9b5d5 100644 +index 0eddb9829788ab7c9bf72805bc46a24152c4a7a1..665374434b58fe55cea27a2a9c4fee864a6e4c73 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -607,6 +607,7 @@ public class ServerPlayer extends Player { +@@ -607,7 +607,7 @@ public class ServerPlayer extends Player { @Override protected void onInsideBlock(BlockState state) { -+ if (wtf.etil.mirai.MiraiConfig.criterionTriggerEnterBlock) // Mirai - CriteriaTriggers.ENTER_BLOCK.trigger(this, state); +- CriteriaTriggers.ENTER_BLOCK.trigger(this, state); ++ if (wtf.etil.mirai.MiraiConfig.criterionTriggerEnterBlock) { CriteriaTriggers.ENTER_BLOCK.trigger(this, state); } // Mirai } -@@ -652,8 +653,7 @@ public class ServerPlayer extends Player { - this.setCamera(this); + @Override +@@ -653,7 +653,7 @@ public class ServerPlayer extends Player { } } -- + - CriteriaTriggers.TICK.trigger(this); + if (wtf.etil.mirai.MiraiConfig.criterionTriggerTick) { CriteriaTriggers.TICK.trigger(this); } // Mirai if (this.levitationStartPos != null) { CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime); } -@@ -729,7 +729,7 @@ public class ServerPlayer extends Player { +@@ -729,9 +729,7 @@ public class ServerPlayer extends Player { this.connection.send(new ClientboundSetExperiencePacket(this.experienceProgress, this.totalExperience, this.experienceLevel)); } - if (this.tickCount % 20 == 0) { -+ if (wtf.etil.mirai.MiraiConfig.criterionTriggerLocation && this.tickCount % 20 == 0) { // Mirai - CriteriaTriggers.LOCATION.trigger(this); - } +- CriteriaTriggers.LOCATION.trigger(this); +- } ++ if (wtf.etil.mirai.MiraiConfig.criterionTriggerLocation && this.tickCount % 20 == 0) { CriteriaTriggers.LOCATION.trigger(this); } // Mirai + // CraftBukkit start - initialize oldLevel and fire PlayerLevelChangeEvent + if (this.oldLevel == -1) { diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java -index 90cf922c8df669ac80451d64b376918dece09dc9..f327714292019eb0a401eef06f67a3562d6baab0 100644 +index 1ba057cbd0ec23cd7ef3d3d1c7685f44cfe34eec..86cc31add10259a248b6044d1bcfb0a9a6bac9c6 100644 --- a/src/main/java/wtf/etil/mirai/MiraiConfig.java +++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java -@@ -252,4 +252,13 @@ public class MiraiConfig { - vectorizedPerlinNoise = getBoolean("use-vectorized-perlin-noise", vectorizedPerlinNoise); +@@ -247,4 +247,13 @@ public class MiraiConfig { + riskyMathRoundOpt = getBoolean("use-risky-mathround-opt", riskyMathRoundOpt); } + public static boolean criterionTriggerEnterBlock = true; diff --git a/patches/server/0101-Set-item-stuck-sleep-to-15-ticks.patch b/patches/server/0097-Set-item-stuck-sleep-to-15-ticks.patch similarity index 100% rename from patches/server/0101-Set-item-stuck-sleep-to-15-ticks.patch rename to patches/server/0097-Set-item-stuck-sleep-to-15-ticks.patch diff --git a/patches/server/0102-Smarter-statistics-ticking.patch b/patches/server/0098-Smarter-statistics-ticking.patch similarity index 100% rename from patches/server/0102-Smarter-statistics-ticking.patch rename to patches/server/0098-Smarter-statistics-ticking.patch diff --git a/patches/server/0103-lithium-collections.brain-and-ai.task.memory_change_.patch b/patches/server/0099-lithium-collections.brain-and-ai.task.memory_change_.patch similarity index 100% rename from patches/server/0103-lithium-collections.brain-and-ai.task.memory_change_.patch rename to patches/server/0099-lithium-collections.brain-and-ai.task.memory_change_.patch diff --git a/patches/server/0104-lithium-ai.brain.patch b/patches/server/0100-lithium-ai.brain.patch similarity index 100% rename from patches/server/0104-lithium-ai.brain.patch rename to patches/server/0100-lithium-ai.brain.patch diff --git a/patches/server/0105-lithium-ai.nearby_entity_tracking-and-ai.nearby_enti.patch b/patches/server/0101-lithium-ai.nearby_entity_tracking-and-ai.nearby_enti.patch similarity index 99% rename from patches/server/0105-lithium-ai.nearby_entity_tracking-and-ai.nearby_enti.patch rename to patches/server/0101-lithium-ai.nearby_entity_tracking-and-ai.nearby_enti.patch index 431a2dc..94c3b24 100644 --- a/patches/server/0105-lithium-ai.nearby_entity_tracking-and-ai.nearby_enti.patch +++ b/patches/server/0101-lithium-ai.nearby_entity_tracking-and-ai.nearby_enti.patch @@ -900,7 +900,7 @@ index c9cb4fa8c96ca53a0692aee6ce0cf46a9466bec1..cd5576f1c39da04642211f265623e38a this.chunkStatus = status; return visibility; diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java -index c3826f82bdf72a03b1f8ce61d0f75e4f733feced..504be6004b3c1b23e6253c50ad046a2a0e0e7996 100644 +index 859d2e82f21efa1232e7e69f787840b16ed4bd4b..12e37be963d39033ae530f480854fb20496f17d1 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java +++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java @@ -20,6 +20,10 @@ import net.minecraft.core.SectionPos; @@ -914,7 +914,7 @@ index c3826f82bdf72a03b1f8ce61d0f75e4f733feced..504be6004b3c1b23e6253c50ad046a2a public class EntitySectionStorage { private final Class entityClass; -@@ -72,6 +76,20 @@ public class EntitySectionStorage { +@@ -93,6 +97,20 @@ public class EntitySectionStorage { } // JettPack end @@ -935,7 +935,7 @@ index c3826f82bdf72a03b1f8ce61d0f75e4f733feced..504be6004b3c1b23e6253c50ad046a2a public LongStream getExistingSectionPositionsInChunk(long chunkPos) { int i = ChunkPos.getX(chunkPos); int j = ChunkPos.getZ(chunkPos); -@@ -99,7 +117,11 @@ public class EntitySectionStorage { +@@ -120,7 +138,11 @@ public class EntitySectionStorage { } public EntitySection getOrCreateSection(long sectionPos) { diff --git a/patches/server/0106-some-entity-micro-opts.patch b/patches/server/0102-some-entity-micro-opts.patch similarity index 97% rename from patches/server/0106-some-entity-micro-opts.patch rename to patches/server/0102-some-entity-micro-opts.patch index 41fc233..fb0d16d 100644 --- a/patches/server/0106-some-entity-micro-opts.patch +++ b/patches/server/0102-some-entity-micro-opts.patch @@ -42,7 +42,7 @@ index e43127f6325e4de9971b01fbeda03dcbc578a2f0..72e39b9c7344e89bb9919b882002b4eb // Paper start this.setPosRaw(x, y, z, false); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index d696bbb44994994af87ee0df5317ca94d20cb74c..ba5b19b8ffede5d0abc98d71a6c36537ce74f1df 100644 +index b101e0b234c9cef315f871b880c1dcb3647d5ff6..f7fc3fdac2ed7a67f5db5fb4f7718275bb97b341 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1617,15 +1617,31 @@ public abstract class Mob extends LivingEntity { diff --git a/patches/server/0107-lithium-cache-iterate-outwards.patch b/patches/server/0103-lithium-cache-iterate-outwards.patch similarity index 100% rename from patches/server/0107-lithium-cache-iterate-outwards.patch rename to patches/server/0103-lithium-cache-iterate-outwards.patch diff --git a/patches/server/0108-lithium-ai.raid.patch b/patches/server/0104-lithium-ai.raid.patch similarity index 100% rename from patches/server/0108-lithium-ai.raid.patch rename to patches/server/0104-lithium-ai.raid.patch diff --git a/patches/server/0109-Dont-eat-blocks-in-non-ticking-chunks.patch b/patches/server/0105-Dont-eat-blocks-in-non-ticking-chunks.patch similarity index 100% rename from patches/server/0109-Dont-eat-blocks-in-non-ticking-chunks.patch rename to patches/server/0105-Dont-eat-blocks-in-non-ticking-chunks.patch diff --git a/patches/server/0110-Fast-speed-check.patch b/patches/server/0106-Fast-speed-check.patch similarity index 94% rename from patches/server/0110-Fast-speed-check.patch rename to patches/server/0106-Fast-speed-check.patch index 55fada5..61d4d0b 100644 --- a/patches/server/0110-Fast-speed-check.patch +++ b/patches/server/0106-Fast-speed-check.patch @@ -34,10 +34,10 @@ index 72e39b9c7344e89bb9919b882002b4ebbd2d464d..7947271bbdc58011088e626cd1b3f962 this.setDeltaMovement(this.getDeltaMovement().multiply((double) f2, 1.0D, (double) f2)); // Paper start - remove expensive streams from here diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java -index f327714292019eb0a401eef06f67a3562d6baab0..54a28a47d6096740cf56ca8e1156c008e6de1997 100644 +index 86cc31add10259a248b6044d1bcfb0a9a6bac9c6..abbbcc568ead90575aef85317e973275b6b16d46 100644 --- a/src/main/java/wtf/etil/mirai/MiraiConfig.java +++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java -@@ -261,4 +261,9 @@ public class MiraiConfig { +@@ -256,4 +256,9 @@ public class MiraiConfig { criterionTriggerLocation = getBoolean("criterion-trigger.location", criterionTriggerLocation); } diff --git a/patches/server/0111-lithium-block.moving_block_shapes.patch b/patches/server/0107-lithium-block.moving_block_shapes.patch similarity index 100% rename from patches/server/0111-lithium-block.moving_block_shapes.patch rename to patches/server/0107-lithium-block.moving_block_shapes.patch diff --git a/patches/server/0112-lithium-shapes.blockstate_cache.patch b/patches/server/0108-lithium-shapes.blockstate_cache.patch similarity index 100% rename from patches/server/0112-lithium-shapes.blockstate_cache.patch rename to patches/server/0108-lithium-shapes.blockstate_cache.patch diff --git a/patches/server/0113-lithium-gen.patch b/patches/server/0109-lithium-gen.patch similarity index 100% rename from patches/server/0113-lithium-gen.patch rename to patches/server/0109-lithium-gen.patch diff --git a/patches/server/0114-c2me-reduce_allocs.patch b/patches/server/0110-c2me-reduce_allocs.patch similarity index 100% rename from patches/server/0114-c2me-reduce_allocs.patch rename to patches/server/0110-c2me-reduce_allocs.patch diff --git a/patches/server/0111-randomTick-blocks-below-y-0-and-above-y-255.patch b/patches/server/0111-randomTick-blocks-below-y-0-and-above-y-255.patch new file mode 100644 index 0000000..98cbdaa --- /dev/null +++ b/patches/server/0111-randomTick-blocks-below-y-0-and-above-y-255.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Simon Gardling +Date: Tue, 25 Jan 2022 11:21:34 -0500 +Subject: [PATCH] randomTick blocks below y=0 and above y=255 + +Fixes an issue with Paper's "Optimise random block ticking" patch where the handling of world height in respect for IBlockDataList and picking a Y position wasn't updated to match 1.18. Resulting in only blocks between y levels 0-255 being randomTicked. + +Original code by Titaniumtown, licensed under GNU General Public License v3.0 +You can find the original code on https://gitlab.com/Titaniumtown/JettPack + +diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java +index 277cfd9d1e8fff5d9b5e534b75c3c5162d58b0b7..b1d7a34b6e05fcf1c681ebb160f69e447fe98621 100644 +--- a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java ++++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java +@@ -26,7 +26,7 @@ public final class IBlockDataList { + private int size; + + public static int getLocationKey(final int x, final int y, final int z) { +- return (x & 15) | (((z & 15) << 4)) | ((y & 255) << (4 + 4)); ++ return (x & 15) | ((z & 15) << 4) | ((y & 4095) << 8); // JettPack + } + + public static BlockState getBlockDataFromRaw(final long raw) { +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 68854fa91cb9558256b819aaa2a51de6f84b0803..c92bc769f3bdbe9193d21b427bbc8f22cca3b508 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -850,7 +850,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + continue; + } + +- int yPos = (sectionIndex + minSection) << 4; ++ int yPos = ((sectionIndex + minSection) << 4) + 4096; + for (int a = 0; a < randomTickSpeed; ++a) { + int tickingBlocks = section.tickingList.size(); + int index = this.randomTickRandom.nextInt(16 * 16 * 16); +@@ -861,7 +861,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + long raw = section.tickingList.getRaw(index); + int location = com.destroystokyo.paper.util.maplist.IBlockDataList.getLocationFromRaw(raw); + int randomX = location & 15; +- int randomY = ((location >>> (4 + 4)) & 255) | yPos; ++ int randomY = (((location >>> 8) & 4095) | yPos)-4096; // JettPack + int randomZ = (location >>> 4) & 15; + + BlockPos blockposition2 = blockposition.set(j + randomX, randomY, k + randomZ); +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +index 16874e3c7c8e2577f3661cb3a459c63ea061b2d8..c7247458d77324519f430bff0c9bdff701674dd0 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +@@ -191,7 +191,7 @@ public class LevelChunkSection { + if (iblockdata1.isRandomlyTicking()) { + --this.tickingBlockCount; + // Paper start +- this.tickingList.remove(x, y, z); ++ this.tickingList.remove(x, y+4096, z); + // Paper end + } + } +@@ -206,7 +206,7 @@ public class LevelChunkSection { + if (state.isRandomlyTicking()) { + ++this.tickingBlockCount; + // Paper start +- this.tickingList.add(x, y, z, state); ++ this.tickingList.add(x, y+4096, z, state); + // Paper end + } + }