diff options
| author | shedaniel <daniel@shedaniel.me> | 2024-08-14 19:26:34 +0900 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2024-08-14 19:34:44 +0900 |
| commit | 612dddf0b65be65a70783622c6406a966d935ebc (patch) | |
| tree | c14ca86eae0dadace3617681aad605da5b849b56 /runtime | |
| parent | d0a69811215c779229e9227264f5b79839c471af (diff) | |
| parent | 90af6e03bcf45b0c13d5b7af51126bd2fc7389a5 (diff) | |
| download | RoughlyEnoughItems-612dddf0b65be65a70783622c6406a966d935ebc.tar.gz RoughlyEnoughItems-612dddf0b65be65a70783622c6406a966d935ebc.tar.bz2 RoughlyEnoughItems-612dddf0b65be65a70783622c6406a966d935ebc.zip | |
Merge remote-tracking branch 'origin/15.x-1.20.5' into 16.x-1.21
Fixes #1665
Fixes #1662
Fixes #1663
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java index f25e40735..055f92d38 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java @@ -100,6 +100,7 @@ import net.minecraft.client.gui.screens.inventory.CraftingScreen; import net.minecraft.client.gui.screens.recipebook.GhostRecipe; import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.RegistryAccess; import net.minecraft.data.models.blockstates.PropertyDispatch; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -112,6 +113,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeManager; import org.apache.commons.lang3.mutable.MutableLong; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; @@ -120,15 +122,12 @@ import java.util.Collection; import java.util.ConcurrentModificationException; import java.util.List; import java.util.concurrent.*; -import java.util.function.BiFunction; -import java.util.function.BooleanSupplier; -import java.util.function.Function; -import java.util.function.Supplier; +import java.util.function.*; import java.util.stream.Stream; @Environment(EnvType.CLIENT) public class RoughlyEnoughItemsCoreClient { - public static final Event<ClientRecipeUpdateEvent> PRE_UPDATE_RECIPES = EventFactory.createLoop(); + public static final Event<BiConsumer<RecipeManager, RegistryAccess>> PRE_UPDATE_RECIPES = EventFactory.createLoop(); public static final Event<Runnable> POST_UPDATE_TAGS = EventFactory.createLoop(); public static boolean isLeftMousePressed = false; private static final ExecutorService RELOAD_PLUGINS = Executors.newSingleThreadScheduledExecutor(task -> { @@ -317,9 +316,9 @@ public class RoughlyEnoughItemsCoreClient { final ResourceLocation recipeButtonTex = ResourceLocation.withDefaultNamespace("textures/gui/recipe_button.png"); MutableLong startReload = new MutableLong(-1); MutableLong endReload = new MutableLong(-1); - PRE_UPDATE_RECIPES.register(recipeManager -> { + PRE_UPDATE_RECIPES.register((recipeManager, registryAccess) -> { RoughlyEnoughItemsCore.PERFORMANCE_LOGGER.clear(); - reloadPlugins(startReload, ReloadStage.START); + reloadPlugins(startReload, ReloadStage.START, registryAccess); }); ClientRecipeUpdateEvent.EVENT.register(recipeManager -> { reloadPlugins(endReload, ReloadStage.END); @@ -469,6 +468,11 @@ public class RoughlyEnoughItemsCoreClient { @ApiStatus.Internal public static void reloadPlugins(MutableLong lastReload, @Nullable ReloadStage start) { + reloadPlugins(lastReload, start, null); + } + + @ApiStatus.Internal + public static void reloadPlugins(MutableLong lastReload, @Nullable ReloadStage start, @Nullable RegistryAccess registryAccess) { if (Minecraft.getInstance().level == null) return; if (lastReload != null) { if (lastReload.getValue() > 0 && System.currentTimeMillis() - lastReload.getValue() <= 5000) { |
