aboutsummaryrefslogtreecommitdiff
path: root/runtime-engine
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-07-31 21:37:58 +0800
committershedaniel <daniel@shedaniel.me>2022-08-26 10:52:28 +0900
commit8f5d3ef632f3d1a733c98ce5607c9fd5a0fd7567 (patch)
treed25de04229cf417b81fe4166734890ab0f387bf3 /runtime-engine
parent9954713e457a5a5d80025432961b56ab0003bbb0 (diff)
downloadRoughlyEnoughItems-8f5d3ef632f3d1a733c98ce5607c9fd5a0fd7567.tar.gz
RoughlyEnoughItems-8f5d3ef632f3d1a733c98ce5607c9fd5a0fd7567.tar.bz2
RoughlyEnoughItems-8f5d3ef632f3d1a733c98ce5607c9fd5a0fd7567.zip
Add reload all to the api
Diffstat (limited to 'runtime-engine')
-rw-r--r--runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java80
-rw-r--r--runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java5
2 files changed, 41 insertions, 44 deletions
diff --git a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java
index df956d185..25c4aeb16 100644
--- a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java
+++ b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java
@@ -289,48 +289,9 @@ public class ConfigManagerImpl implements ConfigManagerInternal {
craftableOnly = !craftableOnly;
}
- @SuppressWarnings("deprecation")
+ @SuppressWarnings({"deprecation", "rawtypes", "UnstableApiUsage"})
@Override
public Screen getConfigScreen(Screen parent) {
- class EmptyEntry extends AbstractConfigListEntry<Object> {
- private final int height;
-
- public EmptyEntry(int height) {
- super(new TextComponent(UUID.randomUUID().toString()), false);
- this.height = height;
- }
-
- public int getItemHeight() {
- return this.height;
- }
-
- public Object getValue() {
- return null;
- }
-
- public Optional<Object> getDefaultValue() {
- return Optional.empty();
- }
-
- public boolean isMouseInside(int mouseX, int mouseY, int x, int y, int entryWidth, int entryHeight) {
- return false;
- }
-
- public void save() {
- }
-
- public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isHovered, float delta) {
- }
-
- public List<? extends GuiEventListener> children() {
- return Collections.emptyList();
- }
-
- public List<? extends NarratableEntry> narratables() {
- return Collections.emptyList();
- }
- }
-
try {
ConfigScreenProvider<ConfigObjectImpl> provider = (ConfigScreenProvider<ConfigObjectImpl>) AutoConfig.getConfigScreen(ConfigObjectImpl.class, parent);
provider.setI13nFunction(manager -> "config.roughlyenoughitems");
@@ -404,6 +365,45 @@ public class ConfigManagerImpl implements ConfigManagerInternal {
return null;
}
+ private static class EmptyEntry extends AbstractConfigListEntry<Object> {
+ private final int height;
+
+ public EmptyEntry(int height) {
+ super(new TextComponent(UUID.randomUUID().toString()), false);
+ this.height = height;
+ }
+
+ public int getItemHeight() {
+ return this.height;
+ }
+
+ public Object getValue() {
+ return null;
+ }
+
+ public Optional<Object> getDefaultValue() {
+ return Optional.empty();
+ }
+
+ public boolean isMouseInside(int mouseX, int mouseY, int x, int y, int entryWidth, int entryHeight) {
+ return false;
+ }
+
+ public void save() {
+ }
+
+ public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isHovered, float delta) {
+ }
+
+ public List<? extends GuiEventListener> children() {
+ return Collections.emptyList();
+ }
+
+ public List<? extends NarratableEntry> narratables() {
+ return Collections.emptyList();
+ }
+ }
+
@Override
public Object get(String fieldKey) {
Pair<Supplier<Object>, Field> pair = locateField(fieldKey);
diff --git a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java
index 45ab4ef4e..64da5ac42 100644
--- a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java
+++ b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java
@@ -27,8 +27,6 @@ import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.platform.Window;
import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import me.shedaniel.rei.RoughlyEnoughItemsCoreClient;
import me.shedaniel.rei.api.client.search.SearchProvider;
import me.shedaniel.rei.api.common.plugins.PluginManager;
import me.shedaniel.rei.impl.client.gui.screen.ConfigReloadingScreen;
@@ -50,8 +48,7 @@ import java.util.Optional;
public class ReloadPluginsEntry extends AbstractConfigListEntry<Unit> {
private int width;
private AbstractWidget reloadPluginsButton = new Button(0, 0, 0, 20, NarratorChatListener.NO_TITLE, button -> {
- RoughlyEnoughItemsCore.PERFORMANCE_LOGGER.clear();
- RoughlyEnoughItemsCoreClient.reloadPlugins(null, null);
+ PluginManager.reloadAll();
}) {
@Override
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {