diff options
Diffstat (limited to 'runtime/src/main/java/me/shedaniel/rei/impl')
72 files changed, 2292 insertions, 829 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java index 16fafcbff..64f3a186c 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java @@ -82,6 +82,7 @@ import net.minecraft.network.chat.ClickEvent; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.HoverEvent; import net.minecraft.network.chat.TextColor; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.InteractionResult; import org.jetbrains.annotations.ApiStatus; @@ -138,6 +139,14 @@ public class ConfigManagerImpl implements ConfigManager { } private static Jankson buildJankson(Jankson.Builder builder) { + // ResourceLocation + builder.registerSerializer(ResourceLocation.class, (location, marshaller) -> { + return new JsonPrimitive(location == null ? null : location.toString()); + }); + builder.registerDeserializer(String.class, ResourceLocation.class, (value, marshaller) -> { + return value == null ? null : new ResourceLocation(value); + }); + // CheatingMode builder.registerSerializer(CheatingMode.class, (value, marshaller) -> { if (value == CheatingMode.WHEN_CREATIVE) { @@ -366,12 +375,12 @@ public class ConfigManagerImpl implements ConfigManager { if (Minecraft.getInstance().getConnection() != null && Minecraft.getInstance().getConnection().getRecipeManager() != null) { TextListEntry feedbackEntry = ConfigEntryBuilder.create().startTextDescription( Component.translatable("text.rei.feedback", Component.translatable("text.rei.feedback.link") - .withStyle(style -> style - .withColor(TextColor.fromRgb(0xff1fc3ff)) - .withUnderlined(true) - .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://forms.gle/5tdnK5WN1wng78pV8")) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://forms.gle/5tdnK5WN1wng78pV8"))) - )) + .withStyle(style -> style + .withColor(TextColor.fromRgb(0xff1fc3ff)) + .withUnderlined(true) + .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://forms.gle/5tdnK5WN1wng78pV8")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://forms.gle/5tdnK5WN1wng78pV8"))) + )) .withStyle(ChatFormatting.GRAY) ).build(); builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.advanced")).getEntries().add(0, feedbackEntry); @@ -389,19 +398,19 @@ public class ConfigManagerImpl implements ConfigManager { ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new EmptyEntry(4)); TextListEntry supportText = ConfigEntryBuilder.create().startTextDescription( Component.translatable("text.rei.support.me.desc", - Component.translatable("text.rei.support.me.patreon") - .withStyle(style -> style - .withColor(TextColor.fromRgb(0xff1fc3ff)) - .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://patreon.com/shedaniel")) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://patreon.com/shedaniel"))) - ), - Component.translatable("text.rei.support.me.bisect") - .withStyle(style -> style - .withColor(TextColor.fromRgb(0xff1fc3ff)) - .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.bisecthosting.com/shedaniel")) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://www.bisecthosting.com/shedaniel"))) - ) - ) + Component.translatable("text.rei.support.me.patreon") + .withStyle(style -> style + .withColor(TextColor.fromRgb(0xff1fc3ff)) + .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://patreon.com/shedaniel")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://patreon.com/shedaniel"))) + ), + Component.translatable("text.rei.support.me.bisect") + .withStyle(style -> style + .withColor(TextColor.fromRgb(0xff1fc3ff)) + .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.bisecthosting.com/shedaniel")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://www.bisecthosting.com/shedaniel"))) + ) + ) .withStyle(ChatFormatting.GRAY) ).build(); supportText.setScreen((AbstractConfigScreen) screen); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java index 6cd6bd754..83964e65c 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java @@ -41,9 +41,11 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.level.GameType; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -207,6 +209,16 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { } @Override + @Nullable + public ResourceLocation getInputMethodId() { + return functionality.inputMethod; + } + + public void setInputMethodId(@Nullable ResourceLocation id) { + functionality.inputMethod = id; + } + + @Override public boolean doesDisableRecipeBook() { return functionality.disableRecipeBook; } @@ -600,6 +612,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { } public static class Functionality { + @ConfigEntry.Gui.Excluded @Nullable private ResourceLocation inputMethod = null; @Comment("Declares whether REI should remove the recipe book.") private boolean disableRecipeBook = false; @Comment("Declares whether mob effects should be on the left side instead of the right side.") private boolean leftSideMobEffects = false; @Comment("Declares whether subsets is enabled.") private boolean isSubsetsEnabled = false; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java index c04120eea..0fe6a4e85 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java @@ -28,6 +28,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.clothconfig2.gui.widget.DynamicElementListWidget; import me.shedaniel.rei.api.client.config.addon.ConfigAddon; import me.shedaniel.rei.api.client.config.addon.ConfigAddonRegistry; +import me.shedaniel.rei.impl.client.gui.InternalTextures; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.events.GuiEventListener; @@ -41,8 +42,6 @@ import net.minecraft.resources.ResourceLocation; import java.util.Collections; import java.util.List; -import static me.shedaniel.rei.impl.client.gui.screen.DefaultDisplayViewingScreen.CHEST_GUI_TEXTURE; - public class ConfigAddonsScreen extends Screen { private AddonsList rulesList; private final Screen parent; @@ -143,7 +142,7 @@ public class ConfigAddonsScreen extends Screen { @Override protected void renderBg(PoseStack matrices, Minecraft client, int mouseX, int mouseY) { super.renderBg(matrices, client, mouseX, mouseY); - RenderSystem.setShaderTexture(0, CHEST_GUI_TEXTURE); + RenderSystem.setShaderTexture(0, InternalTextures.CHEST_GUI_TEXTURE); blit(matrices, x + 3, y + 3, 0, 0, 14, 14); } }; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java index 9e4b311c2..d3da37ef2 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java @@ -28,6 +28,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.clothconfig2.gui.widget.DynamicElementListWidget; import me.shedaniel.rei.impl.client.entry.filtering.FilteringRule; import me.shedaniel.rei.impl.client.entry.filtering.rules.ManualFilteringRule; +import me.shedaniel.rei.impl.client.gui.InternalTextures; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.events.GuiEventListener; @@ -45,8 +46,6 @@ import java.util.List; import java.util.Objects; import java.util.function.BiFunction; -import static me.shedaniel.rei.impl.client.gui.screen.DefaultDisplayViewingScreen.CHEST_GUI_TEXTURE; - public class FilteringRulesScreen extends Screen { private final FilteringEntry entry; private RulesList rulesList; @@ -191,7 +190,7 @@ public class FilteringRulesScreen extends Screen { @Override protected void renderBg(PoseStack matrices, Minecraft client, int mouseX, int mouseY) { super.renderBg(matrices, client, mouseX, mouseY); - RenderSystem.setShaderTexture(0, CHEST_GUI_TEXTURE); + RenderSystem.setShaderTexture(0, InternalTextures.CHEST_GUI_TEXTURE); blit(matrices, x + 3, y + 3, 0, 0, 14, 14); } }; 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.ja |
