From c99c917d7e9edc8b10cd575f8591e6551c2f8c03 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Sun, 29 Jan 2023 22:13:18 +0100 Subject: [PATCH] Move empty ServerLevel array to reduce allocations patch --- .../0079-Reduce-array-allocations.patch | 7 +++++-- patches/server/0145-Base-thread-pool.patch | 20 ------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/patches/server/0079-Reduce-array-allocations.patch b/patches/server/0079-Reduce-array-allocations.patch index 6b68ba0..c96c1e3 100644 --- a/patches/server/0079-Reduce-array-allocations.patch +++ b/patches/server/0079-Reduce-array-allocations.patch @@ -133,14 +133,16 @@ index f597d65d56964297eeeed6c7e77703764178fee0..d503c0a7c4706af28a7db2face5efd8d this.storage = Arrays.copyOf(this.storage, this.storage.length * 2); diff --git a/src/main/java/me/titaniumtown/ArrayConstants.java b/src/main/java/me/titaniumtown/ArrayConstants.java new file mode 100644 -index 0000000000000000000000000000000000000000..ceec23a85aae625fbbe2db95c8e9c83fb9f9767c +index 0000000000000000000000000000000000000000..c99e9e361ab4377c0df76b943b96bf87e138d91c --- /dev/null +++ b/src/main/java/me/titaniumtown/ArrayConstants.java -@@ -0,0 +1,18 @@ +@@ -0,0 +1,21 @@ +// Gale - JettPack - reduce array allocations + +package me.titaniumtown; + ++import net.minecraft.server.level.ServerLevel; ++ +public final class ArrayConstants { + + private ArrayConstants() {} @@ -153,6 +155,7 @@ index 0000000000000000000000000000000000000000..ceec23a85aae625fbbe2db95c8e9c83f + public static final long[] emptyLongArray = new long[0]; + public static final org.bukkit.entity.Entity[] emptyBukkitEntityArray = new org.bukkit.entity.Entity[0]; + public static final net.minecraft.world.entity.Entity[] emptyEntityArray = new net.minecraft.world.entity.Entity[0]; ++ public static final ServerLevel[] emptyServerLevelArray = new ServerLevel[0]; + +} diff --git a/src/main/java/net/minecraft/advancements/RequirementsStrategy.java b/src/main/java/net/minecraft/advancements/RequirementsStrategy.java diff --git a/patches/server/0145-Base-thread-pool.patch b/patches/server/0145-Base-thread-pool.patch index c1c07c0..552832d 100644 --- a/patches/server/0145-Base-thread-pool.patch +++ b/patches/server/0145-Base-thread-pool.patch @@ -630,26 +630,6 @@ index 95cac7edae8ac64811fc6a2f6b97dd4a0fceb0b0..a376259202b4a16c67db4d3ef071e0b3 this.dataFixer = dataFixer; this.generatorKey = generatorKey; this.removeCaches = removeCaches; -diff --git a/src/main/java/me/titaniumtown/ArrayConstants.java b/src/main/java/me/titaniumtown/ArrayConstants.java -index ceec23a85aae625fbbe2db95c8e9c83fb9f9767c..fdb9eefdcbd4abf1936761136077c3d10ef5e594 100644 ---- a/src/main/java/me/titaniumtown/ArrayConstants.java -+++ b/src/main/java/me/titaniumtown/ArrayConstants.java -@@ -2,6 +2,8 @@ - - package me.titaniumtown; - -+import net.minecraft.server.level.ServerLevel; -+ - public final class ArrayConstants { - - private ArrayConstants() {} -@@ -14,5 +16,6 @@ public final class ArrayConstants { - public static final long[] emptyLongArray = new long[0]; - public static final org.bukkit.entity.Entity[] emptyBukkitEntityArray = new org.bukkit.entity.Entity[0]; - public static final net.minecraft.world.entity.Entity[] emptyEntityArray = new net.minecraft.world.entity.Entity[0]; -+ public static final ServerLevel[] emptyServerLevelArray = new ServerLevel[0]; // Gale - base thread pool - - } diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java index 5ef58831a857fd8aa4ac30147762dc17d773a53e..6b109d92dec227d4a91a455caf596beb112a8351 100644 --- a/src/main/java/net/minecraft/Util.java