diff --git a/patches/server/0031-ImproveBiomeTemperatureCache.patch b/patches/server/0031-Improve-BiomeTemperatureCache.patch similarity index 94% rename from patches/server/0031-ImproveBiomeTemperatureCache.patch rename to patches/server/0031-Improve-BiomeTemperatureCache.patch index f6f410358..219008b3d 100644 --- a/patches/server/0031-ImproveBiomeTemperatureCache.patch +++ b/patches/server/0031-Improve-BiomeTemperatureCache.patch @@ -3,8 +3,9 @@ From: IPECTER Date: Tue, 28 Mar 2023 12:42:17 +0900 Subject: [PATCH] Improve BiomeTemperatureCache + diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java -index ed439b7e94646141c93a7dd3704d1cdeb5c27e16..2bddcaf8762ee7834c32622402a976bfad12d127 100644 +index ed439b7e94646141c93a7dd3704d1cdeb5c27e16..71880b6fde3a287aa75c3799ffdd82a7943bb9db 100644 --- a/src/main/java/net/minecraft/world/level/biome/Biome.java +++ b/src/main/java/net/minecraft/world/level/biome/Biome.java @@ -67,7 +67,7 @@ public final class Biome { diff --git a/patches/server/0044-CarpetFixes-Optimizations-RecipeManager.patch b/patches/server/0044-CarpetFixes-Optimizations-RecipeManager.patch deleted file mode 100644 index 2c6c00fbc..000000000 --- a/patches/server/0044-CarpetFixes-Optimizations-RecipeManager.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Wed, 6 Sep 2023 16:23:56 +0900 -Subject: [PATCH] CarpetFixes-Optimizations-RecipeManager - -Original: fxmorin/carpet-fixes -Copyright (C) 2023 fxmorin - -RecipeManager optimization. -Optimized by taking out streams & doing extra early checks to quickly remove unrelated recipes - -diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index ab6dc3449a1d3b7acf1d7bf5ac1c24224cc252c7..53756f780dd0315fc18bf93cf4607b51a8d5059e 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -103,13 +103,38 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - } - - public > Optional getRecipeFor(RecipeType type, C inventory, Level world) { -- // CraftBukkit start -- Optional recipe = this.byType(type).values().stream().filter((irecipe) -> { -- return irecipe.matches(inventory, world); -- }).findFirst(); -- inventory.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found -- // CraftBukkit end -- return recipe; -+ // Plazma start - CarpetFixes - Optimized RecipeManager -+ if (world.plazmaLevelConfiguration().carpetFixes.optimizedRecipeManager() && type == RecipeType.CRAFTING) { -+ int slots = 0; -+ int count; -+ //compare size to quickly remove recipes that are not even close. Plus remove streams -+ for (int slot = 0; slot < inventory.getContainerSize(); slot++) -+ if (!inventory.getItem(slot).isEmpty()) slots++; -+ for (Recipe recipe : this.byType(type).values()) { -+ count = 0; -+ if (recipe instanceof CustomRecipe) { -+ if (recipe.matches(inventory, world)) { -+ return (Optional) Optional.of(recipe); -+ } -+ } else { -+ for (Ingredient ingredient : recipe.getIngredients()) -+ if (ingredient != Ingredient.EMPTY) count++; -+ if (count == slots && recipe.matches(inventory, world)) { -+ return (Optional) Optional.of(recipe); -+ } -+ } -+ } -+ return Optional.empty(); -+ } else { -+ // CraftBukkit start -+ Optional recipe = this.byType(type).values().stream().filter((irecipe) -> { -+ return irecipe.matches(inventory, world); -+ }).findFirst(); -+ inventory.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found -+ // CraftBukkit end -+ return recipe; -+ } -+ // Plazma end - } - - public > Optional> getRecipeFor(RecipeType type, C inventory, Level world, @Nullable ResourceLocation id) { -@@ -131,7 +156,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - } - - public > List getAllRecipesFor(RecipeType type) { -- return List.copyOf(this.byType(type).values()); -+ return org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.optimizedRecipeManager() ? (List) new java.util.ArrayList<>(this.byType(type).values()) : List.copyOf(this.byType(type).values()); // Plazma start - CarpetFixes - Optimized RecipeManager - } - - public > List getRecipesFor(RecipeType type, C inventory, Level world) { -diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index bf323df50bc07e19ec6e3a4a11f3b7db466064c9..e68ec6e28b0b3a1e3ced2bbcad029d6e1fac17b6 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -82,10 +82,15 @@ public class GlobalConfiguration extends ConfigurationPart { - - public boolean enabled = DO_OPTIMIZE; - boolean optimizedBiomeAccess = true; -+ boolean optimizedRecipeManager = true; - - public boolean optimizedBiomeAccess() { - return enabled && optimizedBiomeAccess; - } - -+ public boolean optimizedRecipeManager() { -+ return enabled && optimizedRecipeManager; -+ } -+ - } - } -diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -index b0deec445b5ea3cd3e4802eca04e99818b539bd8..e089a881600b61060bae1135b89703f6c0b5c7e8 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -@@ -137,6 +137,11 @@ public class LevelConfigurations extends ConfigurationPart { - public class CarpetFixes extends ConfigurationPart { - - public boolean enabled = DO_OPTIMIZE; -+ boolean optimizedRecipeManager = true; -+ -+ public boolean optimizedRecipeManager() { -+ return enabled && optimizedRecipeManager; -+ } - - } - } diff --git a/patches/server/0045-CarpetFixes-Optimizations-Sheep.patch b/patches/server/0044-CarpetFixes-Optimizations-Sheep.patch similarity index 94% rename from patches/server/0045-CarpetFixes-Optimizations-Sheep.patch rename to patches/server/0044-CarpetFixes-Optimizations-Sheep.patch index 3f54edf87..bb6bf42df 100644 --- a/patches/server/0045-CarpetFixes-Optimizations-Sheep.patch +++ b/patches/server/0044-CarpetFixes-Optimizations-Sheep.patch @@ -56,23 +56,19 @@ index 9399361c8d26a140fa6042988a30a1d3d552e418..5bfb246bfabf82feb805665b0be1a36c private static CraftingContainer makeContainer(DyeColor firstColor, DyeColor secondColor) { diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -index e089a881600b61060bae1135b89703f6c0b5c7e8..29d451f55dabc15478e9c32d2c37bd0ea2d9bebc 100644 +index b0deec445b5ea3cd3e4802eca04e99818b539bd8..de1fa9ccb088597d059e8dc7fbb0c8788e3815fc 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -@@ -138,10 +138,15 @@ public class LevelConfigurations extends ConfigurationPart { +@@ -137,6 +137,11 @@ public class LevelConfigurations extends ConfigurationPart { + public class CarpetFixes extends ConfigurationPart { public boolean enabled = DO_OPTIMIZE; - boolean optimizedRecipeManager = true; + boolean optimizedSheepChildColor = false; - - public boolean optimizedRecipeManager() { - return enabled && optimizedRecipeManager; - } - ++ + public boolean optimizedSheepChildColor() { + return enabled && optimizedSheepChildColor; + } -+ + } } diff --git a/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java b/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java diff --git a/patches/server/0046-Async-PathProcessing.patch b/patches/server/0045-Async-PathProcessing.patch similarity index 99% rename from patches/server/0046-Async-PathProcessing.patch rename to patches/server/0045-Async-PathProcessing.patch index 369058735..c1604fc45 100644 --- a/patches/server/0046-Async-PathProcessing.patch +++ b/patches/server/0045-Async-PathProcessing.patch @@ -840,10 +840,10 @@ index 0e2b14e7dfedf209d63279c81723fd7955122d78..6e2c0790c3b932d3aad1b1eaf11d2798 public SwimNodeEvaluator(boolean canJumpOutOfWater) { diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index e68ec6e28b0b3a1e3ced2bbcad029d6e1fac17b6..614b1147e963397a64e064cf1e06a212b56f9021 100644 +index bf323df50bc07e19ec6e3a4a11f3b7db466064c9..04b52e15632709a3cb86d0520065d6b601fac61e 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -93,4 +93,33 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -88,4 +88,33 @@ public class GlobalConfiguration extends ConfigurationPart { } } @@ -878,7 +878,7 @@ index e68ec6e28b0b3a1e3ced2bbcad029d6e1fac17b6..614b1147e963397a64e064cf1e06a212 + } } diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -index 29d451f55dabc15478e9c32d2c37bd0ea2d9bebc..ed1963723db04aa027e987f1aa421b2a3e914cc4 100644 +index de1fa9ccb088597d059e8dc7fbb0c8788e3815fc..6b69321b940e1083bd687a0c38fb8faa4801aa26 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java @@ -130,6 +130,19 @@ public class LevelConfigurations extends ConfigurationPart {