diff --git a/patches/minecraft/net/minecraft/client/gui/GuiListExtended.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiListExtended.java.patch new file mode 100644 index 000000000..042e7bfe3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiListExtended.java.patch @@ -0,0 +1,20 @@ +--- before/net/minecraft/client/gui/GuiListExtended.java ++++ after/net/minecraft/client/gui/GuiListExtended.java +@@ -59,7 +59,7 @@ + + if (i >= 0) + { +- int j = this.left + this.width / 2 - this.getListWidth() / 2 + 2; ++ int j = this.getListEntryLeft(); + int k = this.top + 4 - this.getAmountScrolled() + i * this.slotHeight + this.headerPadding; + int l = mouseX - j; + int i1 = mouseY - k; +@@ -79,7 +79,7 @@ + { + for (int i = 0; i < this.getSize(); i++) + { +- int j = this.left + this.width / 2 - this.getListWidth() / 2 + 2; ++ int j = this.getListEntryLeft(); + int k = this.top + 4 - this.getAmountScrolled() + i * this.slotHeight + this.headerPadding; + int l = x - j; + int i1 = y - k; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index 711e0af1c..b5c9df4d2 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,6 +1,17 @@ --- before/net/minecraft/client/gui/GuiSlot.java +++ after/net/minecraft/client/gui/GuiSlot.java -@@ -186,27 +186,8 @@ +@@ -110,8 +110,8 @@ + + public int getSlotIndexFromScreenCoords(int posX, int posY) + { +- int i = this.left + this.width / 2 - this.getListWidth() / 2; +- int j = this.left + this.width / 2 + this.getListWidth() / 2; ++ int i = this.getListLeft(); ++ int j = this.getListRight(); + int k = posY - this.top - this.headerPadding + (int)this.amountScrolled - 4; + int l = k / this.slotHeight; + return posX < this.getScrollBarX() && posX >= i && posX <= j && l >= 0 && k >= 0 && l < this.getSize() ? l : -1; +@@ -186,28 +186,9 @@ GlStateManager.disableFog(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); @@ -25,12 +36,80 @@ - .color(32, 32, 32, 255) - .endVertex(); - tessellator.draw(); +- int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + // Forge: background rendering moved into separate method. + this.drawContainerBackground(tessellator); - int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; ++ int k = this.getListEntryLeft(); int l = this.top + 4 - (int)this.amountScrolled; -@@ -491,5 +472,31 @@ + if (this.hasListHeader) +@@ -229,6 +210,7 @@ + GlStateManager.disableAlpha(); + GlStateManager.shadeModel(7425); + GlStateManager.disableTexture2D(); ++ if (this.drawTopBottomShadow(tessellator)) { + int i1 = 4; + bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + bufferbuilder.pos(this.left, this.top + 4, 0.0).tex(0.0, 1.0).color(0, 0, 0, 0).endVertex(); +@@ -242,12 +224,12 @@ + bufferbuilder.pos(this.right, this.bottom - 4, 0.0).tex(1.0, 0.0).color(0, 0, 0, 0).endVertex(); + bufferbuilder.pos(this.left, this.bottom - 4, 0.0).tex(0.0, 0.0).color(0, 0, 0, 0).endVertex(); + tessellator.draw(); ++ } + int j1 = this.getMaxScroll(); + + if (j1 > 0) + { +- int k1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); +- k1 = MathHelper.clamp(k1, 32, this.bottom - this.top - 8); ++ int k1 = this.getScrollThumbHeight(); + int l1 = (int)this.amountScrolled * (this.bottom - this.top - k1) / j1 + this.top; + + if (l1 < this.top) +@@ -292,8 +274,8 @@ + && this.mouseY >= this.top + && this.mouseY <= this.bottom) + { +- int i = (this.width - this.getListWidth()) / 2; +- int j = (this.width + this.getListWidth()) / 2; ++ int i = this.getListLeft(); ++ int j = this.getListRight(); + int k = this.mouseY - this.top - this.headerPadding + (int)this.amountScrolled - 4; + int l = k / this.slotHeight; + +@@ -318,8 +300,8 @@ + + if (this.mouseY >= this.top && this.mouseY <= this.bottom) + { +- int j2 = (this.width - this.getListWidth()) / 2; +- int k2 = (this.width + this.getListWidth()) / 2; ++ int j2 = this.getListLeft(); ++ int k2 = this.getListRight(); + int l2 = this.mouseY - this.top - this.headerPadding + (int)this.amountScrolled - 4; + int i1 = l2 / this.slotHeight; + +@@ -349,8 +331,7 @@ + k1 = 1; + } + +- int l1 = (int)((float)((this.bottom - this.top) * (this.bottom - this.top)) / this.getContentHeight()); +- l1 = MathHelper.clamp(l1, 32, this.bottom - this.top - 8); ++ int l1 = this.getScrollThumbHeight(); + this.scrollMultiplier = this.scrollMultiplier / ((float)(this.bottom - this.top - l1) / k1); + } + else +@@ -429,8 +410,8 @@ + + if (this.showSelectionBox && this.isSelected(j)) + { +- int i1 = this.left + (this.width / 2 - this.getListWidth() / 2); +- int j1 = this.left + this.width / 2 + this.getListWidth() / 2; ++ int i1 = this.getListLeft(); ++ int j1 = this.getListRight(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableTexture2D(); + bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); +@@ -491,5 +472,57 @@ public int getSlotHeight() { return this.slotHeight; @@ -60,5 +139,31 @@ + .color(32, 32, 32, 255) + .endVertex(); + tessellator.draw(); ++ } ++ ++ protected boolean drawTopBottomShadow(Tessellator tessellator) ++ { ++ return true; ++ } ++ ++ protected int getScrollThumbHeight() ++ { ++ int viewHeight = this.bottom - this.top; ++ return MathHelper.clamp(viewHeight * viewHeight / this.getContentHeight(), 32, viewHeight - 8); ++ } ++ ++ protected int getListLeft() ++ { ++ return this.left + this.width / 2 - this.getListWidth() / 2; ++ } ++ ++ protected int getListRight() ++ { ++ return this.left + this.width / 2 + this.getListWidth() / 2; ++ } ++ ++ protected int getListEntryLeft() ++ { ++ return this.getListLeft() + 2; } } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiTextField.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiTextField.java.patch index bdb0e09bd..778749d6c 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiTextField.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiTextField.java.patch @@ -7,7 +7,23 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; import net.minecraft.client.Minecraft; -@@ -631,6 +632,7 @@ +@@ -71,6 +72,7 @@ + } + + this.setCursorPositionEnd(); ++ this.setResponderEntryValue(this.id, this.text); + } + } + +@@ -590,6 +592,7 @@ + if (this.text.length() > length) + { + this.text = this.text.substring(0, length); ++ this.setResponderEntryValue(this.id, this.text); + } + } + +@@ -631,6 +634,7 @@ } this.isFocused = isFocusedIn; diff --git a/src/main/java/com/cleanroommc/client/modlist/LegacyModListScreen.java b/src/main/java/com/cleanroommc/client/modlist/LegacyModListScreen.java new file mode 100644 index 000000000..26db5f19c --- /dev/null +++ b/src/main/java/com/cleanroommc/client/modlist/LegacyModListScreen.java @@ -0,0 +1,7 @@ +package com.cleanroommc.client.modlist; + +import net.minecraft.client.gui.GuiScreen; + +public interface LegacyModListScreen { + GuiScreen getParent(); +} diff --git a/src/main/java/com/cleanroommc/client/modlist/data/IModData.java b/src/main/java/com/cleanroommc/client/modlist/data/IModData.java index d7371b326..b5a1077f7 100644 --- a/src/main/java/com/cleanroommc/client/modlist/data/IModData.java +++ b/src/main/java/com/cleanroommc/client/modlist/data/IModData.java @@ -10,7 +10,6 @@ import java.util.Set; ///

Experimental

-/// public interface IModData { Type getType(); diff --git a/src/main/java/com/cleanroommc/client/modlist/screen/ModListScreen.java b/src/main/java/com/cleanroommc/client/modlist/screen/ModListScreen.java index 85e02e290..5f514316b 100644 --- a/src/main/java/com/cleanroommc/client/modlist/screen/ModListScreen.java +++ b/src/main/java/com/cleanroommc/client/modlist/screen/ModListScreen.java @@ -52,7 +52,6 @@ public class ModListScreen extends GuiScreen implements DropdownMenuHandler { private static final ResourceLocation MINECRAFT_LOGO = ModListConstants.resource("textures/gui/minecraft.png"); private static final ImageInfo MISSING_BANNER_INFO = new ImageInfo(MISSING_BANNER, 120, 120); private static final ImageInfo MISSING_BACKGROUND_INFO = new ImageInfo(MISSING_BACKGROUND, 512, 256); - private static final int SCROLLBAR_WIDTH = 6; private static final Comparator SORT_ALPHABETICALLY = Comparator.comparing(o -> o.getData().getDisplayName()); private static final Comparator SORT_ALPHABETICALLY_REVERSED = SORT_ALPHABETICALLY.reversed(); private static final Comparator SORT_FAVOURITES_FIRST = Comparator.comparing(ModListEntry::getData, @@ -103,7 +102,7 @@ public class ModListScreen extends GuiScreen implements DropdownMenuHandler { public ModListScreen(GuiScreen parent) { this.parentScreen = parent; if (!loaded) { - PlatformUtils.getAllModData().forEach(data -> CACHED_MODS.put(data.getModId(), new ModData(data))); + PlatformUtils.getAllModData().forEach(data -> CACHED_MODS.put(data.getModId().toLowerCase(Locale.ENGLISH), new ModData(data))); // Override minecraft ModData minecraft = new ModData(new MinecraftModData()); minecraft.banner = new ImageInfo(MINECRAFT_LOGO, 1024, 256); @@ -505,12 +504,27 @@ public void filterAndUpdateList() { @Override protected int getScrollBarX() { - return this.right - SCROLLBAR_WIDTH; + return this.getMaxScroll() > 0 ? this.right - 6 : this.right + 1; + } + + @Override + protected int getListLeft() { + return this.left; + } + + @Override + protected int getListRight() { + return this.getMaxScroll() > 0 ? this.right - 6 : this.right; + } + + @Override + protected int getListEntryLeft() { + return this.getListLeft(); } @Override public int getListWidth() { - return this.width - SCROLLBAR_WIDTH * 2; + return this.getListRight() - this.getListLeft(); } @Override @@ -523,6 +537,11 @@ protected void drawContainerBackground(Tessellator tessellator) { super.drawContainerBackground(tessellator); } + @Override + protected boolean drawTopBottomShadow(@Nullable Tessellator tessellator) { + return false; + } + @Override public void handleMouseInput() { this.hideFavourites = Mouse.getEventDWheel() != 0; @@ -677,16 +696,16 @@ private void drawIcon(int top, int left) { @Nonnull private ItemStack getItemIcon() { - ItemStack icon = this.cachedData.itemIcon; - if (icon != null) { - return icon; + if (this.cachedData.itemIcon != null) { + return this.cachedData.itemIcon; } + // Default is grass ItemStack defaultIcon = new ItemStack(Blocks.GRASS); + this.cachedData.itemIcon = defaultIcon; for (String forcedDefaultIcon : ModListConfig.forceDefaultIconList) { if (forcedDefaultIcon.equals(this.data.getModId())) { - this.cachedData.itemIcon = defaultIcon; return defaultIcon; } } @@ -705,41 +724,38 @@ private ItemStack getItemIcon() { return itemStack; } } catch (Exception e) { - ModListConstants.LOG.warn("Failed to get customized item icon for mod '{}'", this.data.getModId(), e); + ModListConstants.LOG.warn("Failed to parse item icon '{}' for mod '{}'", itemIcon, this.data.getModId(), e); } } // If the mod has a creative tab, the mod list will attempt to use the tab's icon - icon = Arrays.stream(CreativeTabs.CREATIVE_TAB_ARRAY) - .filter(Objects::nonNull) - .map(tab -> { - try { - return tab.getIcon(); - } catch (Exception e) { - ModListConstants.LOG.warn("Failed to get creative tab icon for mod '{}'", this.data.getModId(), e); - return ItemStack.EMPTY; - } - }) - .filter(tabItem -> !tabItem.isEmpty()) - .filter(tabItem -> { - ResourceLocation resource = tabItem.getItem().getRegistryName(); - return resource != null && resource.getNamespace().equals(this.data.getModId()); - }) - .findFirst() - // If the mod doesn't specify an item to use, the mod list will attempt to get an item from the mod - .orElseGet(() -> { - return ForgeRegistries.ITEMS.getValuesCollection().stream() - .filter(Objects::nonNull) - .filter(item -> { - ResourceLocation resource = item.getRegistryName(); - return resource != null && resource.getNamespace().equals(this.data.getModId()); - }) - .map(ItemStack::new) - .findFirst() - .orElse(defaultIcon); - }); - this.cachedData.itemIcon = icon; - return icon; + for (CreativeTabs tab : CreativeTabs.CREATIVE_TAB_ARRAY) { + if (tab == null) continue; + ItemStack tabItem; + try { + tabItem = tab.getIcon(); + } catch (Exception e) { + ModListConstants.LOG.warn("Failed to get creative tab icon for mod '{}'", this.data.getModId(), e); + continue; + } + if (tabItem.isEmpty()) continue; + ResourceLocation resource = tabItem.getItem().getRegistryName(); + if (resource == null || !resource.getNamespace().equals(this.data.getModId())) continue; + this.cachedData.itemIcon = tabItem; + return tabItem; + } + + // If the mod doesn't specify an item to use, the mod list will attempt to get an item from the mod + for (Item item : ForgeRegistries.ITEMS) { + if (item == null) continue; + ResourceLocation resource = item.getRegistryName(); + if (resource == null || !resource.getNamespace().equals(this.data.getModId())) continue; + ItemStack itemStack = new ItemStack(item); + this.cachedData.itemIcon = itemStack; + return itemStack; + } + + return defaultIcon; } private String getFormattedModName(boolean favouriteIconVisible) { @@ -968,24 +984,40 @@ public void setTextFromInfo(@Nonnull IModData data) { @Override protected void drawContainerBackground(@Nullable Tessellator tessellator) { - int x = this.left; - int y = this.top; - int width = this.width; - int height = this.height; - drawRect(x, y + 1, x + 1, y + height - 1, 0x77000000); - drawRect(x + 1, y, x + width - 1, y + height, 0x77000000); - drawRect(x + width - 1, y + 1, x + width, y + height - 1, 0x77000000); + drawRect(this.left, this.top + 1, this.left + 1, this.top + this.height - 1, 0x77000000); + drawRect(this.left + 1, this.top, this.left + this.width - 1, this.top + this.height, 0x77000000); + drawRect(this.left + this.width - 1, this.top + 1, this.left + this.width, this.top + this.height - 1, 0x77000000); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } + @Override + protected boolean drawTopBottomShadow(@Nullable Tessellator tessellator) { + return false; + } + @Override protected int getScrollBarX() { return this.left + this.width - 7; } + @Override + protected int getListLeft() { + return this.left + 8; + } + + @Override + protected int getListRight() { + return this.right - 8; + } + + @Override + protected int getListEntryLeft() { + return this.getListLeft(); + } + @Override public int getListWidth() { - return this.width - 12; + return this.getListRight() - this.getListLeft(); } @Override @@ -1280,6 +1312,7 @@ public boolean has(String modId) { return this.mods.contains(modId); } + @SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean init() { if (this.file != null) { return true; @@ -1303,7 +1336,7 @@ private void load() { try { if (Files.exists(this.file)) { Files.readAllLines(this.file).forEach(s -> { - if (isSaneModId(s) && CACHED_MODS.containsKey(s)) { + if (!s.isEmpty() && CACHED_MODS.containsKey(s)) { this.mods.add(s); } }); @@ -1326,14 +1359,6 @@ private void save() { ModListConstants.LOG.warn("Failed to save mod list favourites", e); } } - - /** - * @see net.minecraftforge.fml.common.FMLModContainer#sanityCheckModId() - */ - private static boolean isSaneModId(String modId) { - return !modId.isEmpty() && modId.length() <= 64 && modId.equals(modId.toLowerCase(Locale.ENGLISH)); - } - } private static class ModData { diff --git a/src/main/java/com/cleanroommc/client/modlist/screen/widget/ModListExtended.java b/src/main/java/com/cleanroommc/client/modlist/screen/widget/ModListExtended.java index 13825f413..b0f6c29ff 100644 --- a/src/main/java/com/cleanroommc/client/modlist/screen/widget/ModListExtended.java +++ b/src/main/java/com/cleanroommc/client/modlist/screen/widget/ModListExtended.java @@ -34,6 +34,24 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { protected void overlayBackground(int startY, int endY, int startAlpha, int endAlpha) { } + @Override + protected void drawSlot(int slotIndex, int x, int y, int height, int mouseX, int mouseY, float partialTicks) { + if (y + this.slotHeight >= this.top && y <= this.bottom) { + super.drawSlot(slotIndex, x, y, height, mouseX, mouseY, partialTicks); + } + } + + @Override + protected int getScrollThumbHeight() { + int viewHeight = this.bottom - this.top; + int contentHeight = this.getContentHeight(); + if (viewHeight <= 0 || contentHeight <= 0) return 0; + + int maxThumbHeight = Math.max(1, viewHeight - 8); + int minThumbHeight = Math.min(32, maxThumbHeight); + return MathHelper.clamp(viewHeight * viewHeight / contentHeight, minThumbHeight, maxThumbHeight); + } + public final List children() { return this.entries; } diff --git a/src/main/java/com/cleanroommc/client/modlist/screen/widget/ModListTextField.java b/src/main/java/com/cleanroommc/client/modlist/screen/widget/ModListTextField.java index 8ec68474d..a74e66966 100644 --- a/src/main/java/com/cleanroommc/client/modlist/screen/widget/ModListTextField.java +++ b/src/main/java/com/cleanroommc/client/modlist/screen/widget/ModListTextField.java @@ -125,19 +125,4 @@ public void setResponder(@Nullable Consumer responder) { public void setFormatter(@Nullable BiFunction formatter) { this.formatter = formatter; } - - // Patch vanilla missing methods - @Override - public void setText(String text) { - String preText = this.getText(); - super.setText(text); - if (!preText.equals(this.getText())) this.setResponderEntryValue(this.getId(), this.getText()); - } - - @Override - public void setMaxStringLength(int length) { - String preText = this.getText(); - super.setMaxStringLength(length); - if (!preText.equals(this.getText())) this.setResponderEntryValue(this.getId(), this.getText()); - } } diff --git a/src/main/java/com/cleanroommc/common/CleanroomContainer.java b/src/main/java/com/cleanroommc/common/CleanroomContainer.java index 6d53d424b..5d424de1d 100644 --- a/src/main/java/com/cleanroommc/common/CleanroomContainer.java +++ b/src/main/java/com/cleanroommc/common/CleanroomContainer.java @@ -27,9 +27,9 @@ public CleanroomContainer() { meta.url = "https://cleanroommc.com"; meta.modProperties.put("issueTrackerUrl", "https://github.com/CleanroomMC/Cleanroom/issues"); meta.updateJSON = "https://download.cleanroommc.com/api/forge"; - meta.logoFile = "/cleanroom_banner.png"; - meta.modProperties.put("iconFile", "/cleanroom_icon.png"); - meta.modProperties.put("backgroundFile", "/cleanroom_background.png"); + meta.logoFile = "/assets/cleanroom/banner.png"; + meta.modProperties.put("iconFile", "/assets/cleanroom/icon.png"); + meta.modProperties.put("backgroundFile", "/assets/cleanroom/background.png"); } @Override diff --git a/src/main/java/com/cleanroommc/common/ConfigAnytimeContainer.java b/src/main/java/com/cleanroommc/common/ConfigAnytimeContainer.java index 0b1aa535d..7e9b8feac 100644 --- a/src/main/java/com/cleanroommc/common/ConfigAnytimeContainer.java +++ b/src/main/java/com/cleanroommc/common/ConfigAnytimeContainer.java @@ -17,7 +17,7 @@ public ConfigAnytimeContainer() { meta.description = "Allows Forge configurations to be setup at any point in time."; meta.version = ForgeEarlyConfig.CUSTOM_BUILT_IN_MOD_VERSION ? ForgeEarlyConfig.CONFIG_ANY_TIME_VERSION : "3.0"; meta.authorList.add("Rongmario"); - meta.logoFile = "/configanytime_icon.png"; + meta.logoFile = "/assets/configanytime/icon.png"; } @Override diff --git a/src/main/java/net/minecraftforge/client/ForgeClientHandler.java b/src/main/java/net/minecraftforge/client/ForgeClientHandler.java index 5bcd4b47f..bdfb1ce42 100644 --- a/src/main/java/net/minecraftforge/client/ForgeClientHandler.java +++ b/src/main/java/net/minecraftforge/client/ForgeClientHandler.java @@ -20,11 +20,12 @@ package net.minecraftforge.client; import com.cleanroommc.client.IMEHandler; +import com.cleanroommc.client.modlist.LegacyModListScreen; import com.cleanroommc.client.modlist.ModListConfig; +import com.cleanroommc.client.modlist.ModListConstants; import com.cleanroommc.client.modlist.screen.ModListScreen; import com.cleanroommc.client.windows.TaskbarApi; import com.cleanroommc.client.windows.WindowsProperties; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiScreen; @@ -42,9 +43,10 @@ import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.ForgeEarlyConfig; import net.minecraftforge.common.ForgeModContainer; +import net.minecraftforge.common.config.ConfigManager; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fml.client.GuiModList; +import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.oredict.OreDictionary; @@ -80,24 +82,31 @@ public static void registerItemHandlers(ColorHandlerEvent.Item event) @SubscribeEvent public static void onGuiOpen(GuiOpenEvent event) { - boolean canInput = false; GuiScreen gui = event.getGui(); if (gui instanceof GuiChat) { // Skip, this should be handled by Focus return; } - else if (gui != null) + + // Forge's mod list may get mixin in late phase, which leads to crash + // Use an interface to avoid this + if (ModListConfig.enable && gui instanceof LegacyModListScreen modList) { - // Vanilla GuiScreens - canInput = gui instanceof GuiScreenBook || gui instanceof GuiEditSign || guiInWhiteList(gui); - // Mod list - if (ModListConfig.enable && event.getGui() instanceof GuiModList modList) - { - event.setGui(new ModListScreen(modList.getParent())); - } + event.setGui(new ModListScreen(modList.getParent())); + } + + IMEHandler.setIME(gui != null && + (gui instanceof GuiScreenBook || gui instanceof GuiEditSign || guiInWhiteList(gui))); + } + + @SubscribeEvent + public static void onConfigChanged(OnConfigChangedEvent event) + { + if (ModListConstants.OWNER_MOD_ID.equals(event.getModID())) + { + ConfigManager.sync(ModListConfig.class); } - IMEHandler.setIME(canInput); } @SubscribeEvent(priority = EventPriority.LOWEST) diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index b138752d8..b41218043 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -19,7 +19,6 @@ package net.minecraftforge.common; -import com.cleanroommc.client.modlist.ModListConfig; import net.minecraft.util.ResourceLocation; import net.minecraft.world.biome.Biome; import static net.minecraftforge.common.config.Configuration.CATEGORY_CLIENT; @@ -509,7 +508,6 @@ public void onConfigChanged(OnConfigChangedEvent event) } } case "forge_early" -> ConfigManager.sync(ForgeEarlyConfig.class); - case "catalogue" -> ConfigManager.sync(ModListConfig.class); default -> syncConfig(false); } } diff --git a/src/main/java/net/minecraftforge/common/config/ConfigManager.java b/src/main/java/net/minecraftforge/common/config/ConfigManager.java index 4bddabca7..90364b96c 100644 --- a/src/main/java/net/minecraftforge/common/config/ConfigManager.java +++ b/src/main/java/net/minecraftforge/common/config/ConfigManager.java @@ -202,7 +202,7 @@ public static Class[] getModConfigClasses(String modid) public static boolean hasConfigForMod(String modid) { - return asm_data.containsKey(modid); + return asm_data.containsKey(modid) || MOD_CONFIG_CLASSES.containsKey(modid); } // ======================================================= diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index e605402e8..ce59dbb9b 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -19,6 +19,8 @@ package net.minecraftforge.fml.client; +import com.cleanroommc.client.modlist.LegacyModListScreen; + import java.awt.Dimension; import java.awt.image.BufferedImage; import java.io.IOException; @@ -70,7 +72,7 @@ /** * @author cpw */ -public class GuiModList extends GuiScreen +public class GuiModList extends GuiScreen implements LegacyModListScreen { private enum SortType implements Comparator { @@ -342,6 +344,7 @@ FontRenderer getFontRenderer() return fontRenderer; } + @Override public GuiScreen getParent() { return mainMenu; diff --git a/src/main/resources/cleanroom_background.png b/src/main/resources/assets/cleanroom/background.png similarity index 100% rename from src/main/resources/cleanroom_background.png rename to src/main/resources/assets/cleanroom/background.png diff --git a/src/main/resources/cleanroom_banner.png b/src/main/resources/assets/cleanroom/banner.png similarity index 100% rename from src/main/resources/cleanroom_banner.png rename to src/main/resources/assets/cleanroom/banner.png diff --git a/src/main/resources/cleanroom_icon.png b/src/main/resources/assets/cleanroom/icon.png similarity index 100% rename from src/main/resources/cleanroom_icon.png rename to src/main/resources/assets/cleanroom/icon.png diff --git a/src/main/resources/assets/cleanroom/lang/zh_cn.lang b/src/main/resources/assets/cleanroom/lang/zh_cn.lang index df68a0940..926604c93 100644 --- a/src/main/resources/assets/cleanroom/lang/zh_cn.lang +++ b/src/main/resources/assets/cleanroom/lang/zh_cn.lang @@ -42,7 +42,7 @@ cleanroom.gui.submit_bug=提交Bug cleanroom.gui.mod_id=Mod ID:%s cleanroom.config.enable=启用 -cleanroom.config.enable.tooltip=控制是否启用Cleanroom。 \n设置为否会阻止Cleanroom重定向Forge模组列表的调用。 +cleanroom.config.enable.tooltip=控制是否启用Cleanroom模组列表。 \n设置为否会阻止Cleanroom重定向Forge模组列表的调用。 cleanroom.config.library_list=库列表 cleanroom.config.library_list.tooltip=库模组的Mod ID列表。\n它们会在模组列表中显示灰色名字。 cleanroom.config.ignored_dependencies_list=忽略前置列表 diff --git a/src/main/resources/configanytime_icon.png b/src/main/resources/assets/configanytime/icon.png similarity index 100% rename from src/main/resources/configanytime_icon.png rename to src/main/resources/assets/configanytime/icon.png diff --git a/src/main/resources/assets/mixinbooter/icon.png b/src/main/resources/assets/mixinbooter/icon.png index 014608ef4..40d400e83 100644 Binary files a/src/main/resources/assets/mixinbooter/icon.png and b/src/main/resources/assets/mixinbooter/icon.png differ diff --git a/src/main/resources/mixinbooter_icon.png b/src/main/resources/mixinbooter_icon.png deleted file mode 100644 index 40d400e83..000000000 Binary files a/src/main/resources/mixinbooter_icon.png and /dev/null differ