diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-05-16 16:21:55 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-05-16 16:21:55 +0800 |
| commit | 189f02afbe5d49a093bf31bee5c42433dc547c55 (patch) | |
| tree | 78f9bbb4689d6a1fa5525919ac86a96a66c52659 /runtime/src/main/java/me | |
| parent | c4cbda6b11f6dbb1148f729dfaf5577e2f639b4f (diff) | |
| parent | 4e24411029bb5e21cbc91696503bab600cc7cd51 (diff) | |
| download | RoughlyEnoughItems-189f02afbe5d49a093bf31bee5c42433dc547c55.tar.gz RoughlyEnoughItems-189f02afbe5d49a093bf31bee5c42433dc547c55.tar.bz2 RoughlyEnoughItems-189f02afbe5d49a093bf31bee5c42433dc547c55.zip | |
Merge remote-tracking branch 'origin/6.x' into 6.x-1.17
Diffstat (limited to 'runtime/src/main/java/me')
4 files changed, 10 insertions, 11 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index 6e37adb49..8112b7630 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -27,6 +27,7 @@ import com.google.common.collect.Lists; import me.shedaniel.architectury.event.events.GuiEvent; import me.shedaniel.architectury.event.events.RecipeUpdateEvent; import me.shedaniel.architectury.event.events.client.ClientScreenInputEvent; +import me.shedaniel.architectury.hooks.ScreenHooks; import me.shedaniel.architectury.networking.NetworkManager; import me.shedaniel.architectury.platform.Platform; import me.shedaniel.architectury.registry.ReloadListeners; @@ -517,7 +518,8 @@ public class RoughlyEnoughItemsCore { GuiEvent.INIT_POST.register((screen, widgets, children) -> { REIHelperImpl.getInstance().setPreviousScreen(screen); if (ConfigObject.getInstance().doesDisableRecipeBook() && screen instanceof AbstractContainerScreen) { - widgets.removeIf(widget -> widget instanceof ImageButton && ((ImageButton) widget).resourceLocation.equals(recipeButtonTex)); + ScreenHooks.getButtons(screen).removeIf(widget -> widget instanceof ImageButton && ((ImageButton) widget).resourceLocation.equals(recipeButtonTex)); + children.removeIf(widget -> widget instanceof ImageButton && ((ImageButton) widget).resourceLocation.equals(recipeButtonTex)); } }); ClientScreenInputEvent.MOUSE_CLICKED_PRE.register((minecraftClient, screen, mouseX, mouseY, button) -> { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java index 94196c19e..cadbe569c 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java @@ -49,7 +49,7 @@ public class ReloadPluginsEntry extends AbstractConfigListEntry<Unit> { private AbstractWidget buttonWidget = new Button(0, 0, 0, 20, NarratorChatListener.NO_TITLE, button -> RoughlyEnoughItemsCore.reloadPlugins(null)) { @Override public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { - if (PluginManager.areAnyPluginsReloading()) { + if (PluginManager.areAnyReloading()) { Screen screen = Minecraft.getInstance().screen; Minecraft.getInstance().setScreen(new ConfigReloadingScreen(() -> Minecraft.getInstance().setScreen(screen))); } else { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java index 17fede258..52a531acf 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java @@ -48,7 +48,7 @@ public class ConfigReloadingScreen extends Screen { @Override public void render(PoseStack matrices, int int_1, int int_2, float float_1) { this.renderDirtBackground(0); - if (!PluginManager.areAnyPluginsReloading()) { + if (!PluginManager.areAnyReloading()) { parent.run(); } drawCenteredString(matrices, this.font, I18n.get("text.rei.config.is.reloading"), this.width / 2, this.height / 2 - 50, 16777215); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java index 249abc0c6..684be988e 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java @@ -28,15 +28,12 @@ import com.google.common.base.Stopwatch; import com.google.common.collect.FluentIterable; import com.google.common.collect.Iterables; import me.shedaniel.rei.RoughlyEnoughItemsCore; -import me.shedaniel.rei.api.client.registry.entry.EntryRegistry; import me.shedaniel.rei.api.common.plugins.PluginManager; import me.shedaniel.rei.api.common.plugins.PluginView; import me.shedaniel.rei.api.common.plugins.REIPlugin; import me.shedaniel.rei.api.common.plugins.REIPluginProvider; import me.shedaniel.rei.api.common.registry.Reloadable; import me.shedaniel.rei.api.common.util.CollectionUtils; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.minecraft.Util; import org.apache.commons.lang3.tuple.MutablePair; import org.jetbrains.annotations.ApiStatus; @@ -54,7 +51,7 @@ public class PluginManagerImpl<P extends REIPlugin<?>> implements PluginManager< private final Map<Class<? extends Reloadable<P>>, Reloadable<? super P>> cache = new ConcurrentHashMap<>(); private final Class<P> pluginClass; private final UnaryOperator<PluginView<P>> view; - private boolean arePluginsLoading = false; + private boolean reloading = false; private final List<REIPluginProvider<P>> plugins = new ArrayList<>(); private final LongConsumer reloadDoneListener; @@ -74,8 +71,8 @@ public class PluginManagerImpl<P extends REIPlugin<?>> implements PluginManager< } @Override - public boolean arePluginsReloading() { - return arePluginsLoading; + public boolean isReloading() { + return reloading; } @Override @@ -154,7 +151,7 @@ public class PluginManagerImpl<P extends REIPlugin<?>> implements PluginManager< @Override public void startReload() { try { - arePluginsLoading = true; + reloading = true; long startTime = Util.getMillis(); MutablePair<Stopwatch, String> sectionData = new MutablePair<>(Stopwatch.createUnstarted(), ""); @@ -193,7 +190,7 @@ public class PluginManagerImpl<P extends REIPlugin<?>> implements PluginManager< } catch (Throwable throwable) { throwable.printStackTrace(); } finally { - arePluginsLoading = false; + reloading = false; } } } |
