diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-02-03 21:15:22 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-02-03 21:15:22 +0800 |
| commit | 074a627663e0150e23d47a87486afb852dd2cfdd (patch) | |
| tree | 0b030485400ed6f03c41b791018ef0c00229b80f | |
| parent | b7abefc2eca79112a2bcc4c1be0629be2f17fb91 (diff) | |
| download | RoughlyEnoughItems-2.2.0.16.tar.gz RoughlyEnoughItems-2.2.0.16.tar.bz2 RoughlyEnoughItems-2.2.0.16.zip | |
Version Checker + Mirror REI + Fix Bugsv2.2.0.16
25 files changed, 442 insertions, 70 deletions
diff --git a/build.gradle b/build.gradle index e66b77786..b455b1b17 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ apply plugin: 'org.spongepowered.mixin' apply plugin: 'java' group 'me.shedaniel' -version '2.1.0.15' +version '2.2.0.16' archivesBaseName = 'RoughlyEnoughItems' sourceCompatibility = 1.8 diff --git a/src/main/java/me/shedaniel/rei/REIMixinInit.java b/src/main/java/me/shedaniel/rei/REIMixinInit.java index 7b8eb00b6..39f3639e2 100644 --- a/src/main/java/me/shedaniel/rei/REIMixinInit.java +++ b/src/main/java/me/shedaniel/rei/REIMixinInit.java @@ -1,7 +1,5 @@ package me.shedaniel.rei; -import net.minecraft.client.Minecraft; -import org.dimdev.rift.listener.client.ClientTickable; import org.dimdev.riftloader.listener.InitializationListener; import org.spongepowered.asm.launch.MixinBootstrap; import org.spongepowered.asm.mixin.Mixins; diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index bf0268a90..b7104b301 100644 --- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -1,7 +1,6 @@ package me.shedaniel.rei; import me.shedaniel.rei.client.ClientHelper; -import me.shedaniel.rei.client.ConfigHelper; import me.shedaniel.rei.client.RecipeHelper; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -11,11 +10,6 @@ public class RoughlyEnoughItemsCore { public static final Logger LOGGER = LogManager.getFormatterLogger("REI"); private static final RecipeHelper RECIPE_HELPER = new RecipeHelper(); private static final ClientHelper CLIENT_HELPER = new ClientHelper(); - private static final ConfigHelper CONFIG_HELPER = new ConfigHelper(); - - public static ConfigHelper getConfigHelper() { - return CONFIG_HELPER; - } public static RecipeHelper getRecipeHelper() { return RECIPE_HELPER; diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelper.java b/src/main/java/me/shedaniel/rei/client/ClientHelper.java index e4347b85b..87e438ab3 100644 --- a/src/main/java/me/shedaniel/rei/client/ClientHelper.java +++ b/src/main/java/me/shedaniel/rei/client/ClientHelper.java @@ -2,7 +2,6 @@ package me.shedaniel.rei.client; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.api.IRecipeCategory; import me.shedaniel.rei.api.IRecipeDisplay; import me.shedaniel.rei.gui.ContainerGuiOverlay; @@ -95,9 +94,9 @@ public class ClientHelper { } else { ResourceLocation location = IRegistry.ITEM.getKey(cheatedStack.getItem()); String tagMessage = cheatedStack.copy().getTag() != null && !cheatedStack.copy().getTag().isEmpty() ? cheatedStack.copy().getTag().toString() : ""; - String madeUpCommand = RoughlyEnoughItemsCore.getConfigHelper().getGiveCommandPrefix() + " " + Minecraft.getInstance().player.getScoreboardName() + " " + location.toString() + tagMessage + (cheatedStack.getCount() != 1 ? " " + cheatedStack.getCount() : ""); + String madeUpCommand = ConfigHelper.getInstance().getGiveCommandPrefix() + " " + Minecraft.getInstance().player.getScoreboardName() + " " + location.toString() + tagMessage + (cheatedStack.getCount() != 1 ? " " + cheatedStack.getCount() : ""); if (madeUpCommand.length() > 256) - madeUpCommand = RoughlyEnoughItemsCore.getConfigHelper().getGiveCommandPrefix() + " " + Minecraft.getInstance().player.getScoreboardName() + " " + location.toString() + (cheatedStack.getCount() != 1 ? " " + cheatedStack.getCount() : ""); + madeUpCommand = ConfigHelper.getInstance().getGiveCommandPrefix() + " " + Minecraft.getInstance().player.getScoreboardName() + " " + location.toString() + (cheatedStack.getCount() != 1 ? " " + cheatedStack.getCount() : ""); Minecraft.getInstance().player.sendChatMessage(madeUpCommand); return true; } diff --git a/src/main/java/me/shedaniel/rei/client/ConfigHelper.java b/src/main/java/me/shedaniel/rei/client/ConfigHelper.java index d0e5de001..9b6c15596 100644 --- a/src/main/java/me/shedaniel/rei/client/ConfigHelper.java +++ b/src/main/java/me/shedaniel/rei/client/ConfigHelper.java @@ -13,8 +13,13 @@ public class ConfigHelper { private final File configFile; private REIConfig config; + private static ConfigHelper instance = new ConfigHelper(); private boolean craftableOnly; + public static ConfigHelper getInstance() { + return instance; + } + public ConfigHelper() { this.configFile = new File(RiftLoader.instance.configDir, "rei.json"); this.craftableOnly = false; @@ -105,4 +110,20 @@ public class ConfigHelper { config.sideSearchField = sideSearchField; } + public boolean checkUpdates() { + return config.checkUpdates; + } + + public void setCheckUpdates(boolean checkUpdates) { + config.checkUpdates = checkUpdates; + } + + public boolean isMirrorItemPanel() { + return config.mirrorItemPanel; + } + + public void setMirrorItemPanel(boolean mirrorItemPanel) { + config.mirrorItemPanel = mirrorItemPanel; + } + } diff --git a/src/main/java/me/shedaniel/rei/client/GuiHelper.java b/src/main/java/me/shedaniel/rei/client/GuiHelper.java index 253a51480..1f603463b 100644 --- a/src/main/java/me/shedaniel/rei/client/GuiHelper.java +++ b/src/main/java/me/shedaniel/rei/client/GuiHelper.java @@ -4,6 +4,7 @@ import com.google.common.collect.Lists; import me.shedaniel.rei.gui.ContainerGuiOverlay; import me.shedaniel.rei.gui.widget.TextFieldWidget; import me.shedaniel.rei.listeners.IMixinGuiContainer; +import me.shedaniel.rei.update.UpdateAnnouncer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; @@ -59,6 +60,7 @@ public class GuiHelper implements ClientTickable { GuiHelper.lastGuiContainer = (GuiContainer) client.currentScreen; GuiHelper.lastMixinGuiContainer = (IMixinGuiContainer) lastGuiContainer; } + UpdateAnnouncer.clientTick(client); } } diff --git a/src/main/java/me/shedaniel/rei/client/REIConfig.java b/src/main/java/me/shedaniel/rei/client/REIConfig.java index 49ccb1dec..b5b798371 100644 --- a/src/main/java/me/shedaniel/rei/client/REIConfig.java +++ b/src/main/java/me/shedaniel/rei/client/REIConfig.java @@ -12,5 +12,7 @@ public class REIConfig { public boolean enableCraftableOnlyButton = true; public boolean sideSearchField = false; public String giveCommandPrefix = "/give"; + public boolean checkUpdates = true; + public boolean mirrorItemPanel = false; } diff --git a/src/main/java/me/shedaniel/rei/gui/ContainerGuiOverlay.java b/src/main/java/me/shedaniel/rei/gui/ContainerGuiOverlay.java index ac78abbf0..e1963ea12 100644 --- a/src/main/java/me/shedaniel/rei/gui/ContainerGuiOverlay.java +++ b/src/main/java/me/shedaniel/rei/gui/ContainerGuiOverlay.java @@ -3,6 +3,7 @@ package me.shedaniel.rei.gui; import com.google.common.collect.Lists; import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.client.ClientHelper; +import me.shedaniel.rei.client.ConfigHelper; import me.shedaniel.rei.client.GuiHelper; import me.shedaniel.rei.client.KeyBindHelper; import me.shedaniel.rei.gui.widget.*; @@ -64,7 +65,7 @@ public class ContainerGuiOverlay extends GuiScreen { } }); page = MathHelper.clamp(page, 0, getTotalPage()); - widgets.add(new ButtonWidget(10, 10, 40, 20, "") { + widgets.add(new ButtonWidget(ConfigHelper.getInstance().isMirrorItemPanel() ? window.getScaledWidth() - 50 : 10, 10, 40, 20, "") { @Override public void draw(int int_1, int int_2, float float_1) { this.text = getCheatModeText(); @@ -76,7 +77,7 @@ public class ContainerGuiOverlay extends GuiScreen { ClientHelper.setCheating(!ClientHelper.isCheating()); } }); - widgets.add(new ButtonWidget(10, 35, 40, 20, I18n.format("text.rei.config")) { + widgets.add(new ButtonWidget(ConfigHelper.getInstance().isMirrorItemPanel() ? window.getScaledWidth() - 50 : 10, 35, 40, 20, I18n.format("text.rei.config")) { @Override public void onPressed(int button, double mouseX, double mouseY) { ClientHelper.openConfigWindow(GuiHelper.getLastGuiContainer()); @@ -108,11 +109,11 @@ public class ContainerGuiOverlay extends GuiScreen { GuiHelper.searchField.setBounds(getTextFieldArea()); this.widgets.add(GuiHelper.searchField); GuiHelper.searchField.setText(searchTerm); - if (RoughlyEnoughItemsCore.getConfigHelper().showCraftableOnlyButton()) + if (ConfigHelper.getInstance().showCraftableOnlyButton()) this.widgets.add(new CraftableToggleButtonWidget(getCraftableToggleArea()) { @Override public void onPressed(int button, double mouseX, double mouseY) { - RoughlyEnoughItemsCore.getConfigHelper().toggleCraftableOnly(); + ConfigHelper.getInstance().toggleCraftableOnly(); itemListOverlay.updateList(page, searchTerm); } }); @@ -122,8 +123,8 @@ public class ContainerGuiOverlay extends GuiScreen { } private Rectangle getTextFieldArea() { - int widthRemoved = RoughlyEnoughItemsCore.getConfigHelper().showCraftableOnlyButton() ? 22 : 0; - if (RoughlyEnoughItemsCore.getConfigHelper().sideSearchField()) + int widthRemoved = ConfigHelper.getInstance().showCraftableOnlyButton() ? 22 : 0; + if (ConfigHelper.getInstance().sideSearchField()) return new Rectangle(rectangle.x + 2, window.getScaledHeight() - 22, rectangle.width - 6 - widthRemoved, 18); if (Minecraft.getInstance().currentScreen instanceof RecipeViewingWidgetGui) { RecipeViewingWidgetGui widget = (RecipeViewingWidgetGui) Minecraft.getInstance().currentScreen; @@ -144,7 +145,7 @@ public class ContainerGuiOverlay extends GuiScreen { } private Rectangle getItemListArea() { - return new Rectangle(rectangle.x + 2, rectangle.y + 24, rectangle.width - 4, rectangle.height - (RoughlyEnoughItemsCore.getConfigHelper().sideSearchField() ? 27 + 22 : 27)); + return new Rectangle(rectangle.x + 2, rectangle.y + 24, rectangle.width - 4, rectangle.height - (ConfigHelper.getInstance().sideSearchField() ? 27 + 22 : 27)); } public Rectangle getRectangle() { @@ -155,7 +156,7 @@ public class ContainerGuiOverlay extends GuiScreen { List<ItemStack> currentStacks = ClientHelper.getInventoryItemsTypes(); if (getLeft() != lastLeft) onInitialized(); - else if (RoughlyEnoughItemsCore.getConfigHelper().craftableOnly() && (!hasSameListContent(new LinkedList<>(GuiHelper.inventoryStacks), currentStacks) || (currentStacks.size() != GuiHelper.inventoryStacks.size()))) { + else if (ConfigHelper.getInstance().craftableOnly() && (!hasSameListContent(new LinkedList<>(GuiHelper.inventoryStacks), currentStacks) || (currentStacks.size() != GuiHelper.inventoryStacks.size()))) { GuiHelper.inventoryStacks = ClientHelper.getInventoryItemsTypes(); itemListOverlay.updateList(page, searchTerm); } @@ -202,14 +203,22 @@ public class ContainerGuiOverlay extends GuiScreen { } private Rectangle calculateBoundary() { - int startX = GuiHelper.getLastMixinGuiContainer().getContainerLeft() + GuiHelper.getLastMixinGuiContainer().getContainerWidth() + 10; - int width = window.getScaledWidth() - startX; + if (!ConfigHelper.getInstance().isMirrorItemPanel()) { + int startX = GuiHelper.getLastMixinGuiContainer().getContainerLeft() + GuiHelper.getLastMixinGuiContainer().getContainerWidth() + 10; + int width = window.getScaledWidth() - startX; + if (Minecraft.getInstance().currentScreen instanceof RecipeViewingWidgetGui) { + RecipeViewingWidgetGui widget = (RecipeViewingWidgetGui) Minecraft.getInstance().currentScreen; + startX = widget.getBounds().x + widget.getBounds().width + 10; + width = window.getScaledWidth() - startX; + } + return new Rectangle(startX, 0, width, window.getScaledHeight()); + } + int width = GuiHelper.getLastMixinGuiContainer().getContainerLeft() - 6; if (Minecraft.getInstance().currentScreen instanceof RecipeViewingWidgetGui) { RecipeViewingWidgetGui widget = (RecipeViewingWidgetGui) Minecraft.getInstance().currentScreen; - startX = widget.getBounds().x + widget.getBounds().width + 10; - width = window.getScaledWidth() - startX; + width = widget.getBounds().x - 6; } - return new Rectangle(startX, 0, width, window.getScaledHeight()); + return new Rectangle(4, 0, width, window.getScaledHeight()); } private int getLeft() { @@ -226,6 +235,8 @@ public class ContainerGuiOverlay extends GuiScreen { @Override public boolean mouseScrolled(double amount) { + if (!GuiHelper.isOverlayVisible()) + return false; if (rectangle.contains(ClientHelper.getMouseLocation())) { if (amount > 0 && buttonLeft.enabled) buttonLeft.onPressed(0, 0, 0); @@ -243,6 +254,12 @@ public class ContainerGuiOverlay extends GuiScreen { @Override public boolean keyPressed(int int_1, int int_2, int int_3) { + if (KeyBindHelper.HIDE.matchesKey(int_1, int_2)) { + GuiHelper.toggleOverlayVisible(); + return true; + } + if (!GuiHelper.isOverlayVisible()) + return false; for(IGuiEventListener listener : children) if (listener.keyPressed(int_1, int_2, int_3)) return true; @@ -270,19 +287,24 @@ public class ContainerGuiOverlay extends GuiScreen { else if (KeyBindHelper.USAGE.matchesKey(int_1, int_2)) return ClientHelper.executeUsageKeyBind(this, itemStack); } - if (KeyBindHelper.HIDE.matchesKey(int_1, int_2)) { - GuiHelper.toggleOverlayVisible(); - return true; - } return false; } @Override public boolean charTyped(char char_1, int int_1) { + if (!GuiHelper.isOverlayVisible()) + return false; for(IGuiEventListener listener : children) if (listener.charTyped(char_1, int_1)) return true; return super.charTyped(char_1, int_1); } + @Override + public boolean mouseClicked(double double_1, double double_2, int int_1) { + if (!GuiHelper.isOverlayVisible()) + return false; + return super.mouseClicked(double_1, double_2, int_1); + } + } diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ConfigWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/ConfigWidget.java index 1b5e01052..9519a949a 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/ConfigWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/ConfigWidget.java @@ -1,7 +1,7 @@ package me.shedaniel.rei.gui.widget; import com.google.common.collect.Lists; -import me.shedaniel.rei.RoughlyEnoughItemsCore; +import me.shedaniel.rei.client.ConfigHelper; import me.shedaniel.rei.client.REIItemListOrdering; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; @@ -43,9 +43,9 @@ public class ConfigWidget extends GuiScreen { @Override public void onPressed(int button, double mouseX, double mouseY) { if (button == 0) - RoughlyEnoughItemsCore.getConfigHelper().setSideSearchField(!RoughlyEnoughItemsCore.getConfigHelper().sideSearchField()); + ConfigHelper.getInstance().setSideSearchField(!ConfigHelper.getInstance().sideSearchField()); try { - RoughlyEnoughItemsCore.getConfigHelper().saveConfig(); + ConfigHelper.getInstance().saveConfig(); } catch (IOException e) { e.printStackTrace(); } @@ -53,8 +53,8 @@ public class ConfigWidget extends GuiScreen { @Override public void draw(int mouseX, int mouseY, float partialTicks) { - text = getTrueFalseText(RoughlyEnoughItemsCore.getConfigHelper().sideSearchField()); - String t = I18n.format("text.rei.centre_searchbox"); + text = getTrueFalseText(ConfigHelper.getInstance().sideSearchField()); + String t = I18n.format("text.rei.side_searchbox"); int width = fontRenderer.getStringWidth(t); fontRenderer.drawStringWithShadow(t, this.x - width - 10, this.y + (this.height - 8) / 2, -1); super.draw(mouseX, mouseY, partialTicks); @@ -64,9 +64,9 @@ public class ConfigWidget extends GuiScreen { @Override public void onPressed(int button, double mouseX, double mouseY) { if (button == 0) - RoughlyEnoughItemsCore.getConfigHelper().setShowCraftableOnlyButton(!RoughlyEnoughItemsCore.getConfigHelper().showCraftableOnlyButton()); + ConfigHelper.getInstance().setShowCraftableOnlyButton(!ConfigHelper.getInstance().showCraftableOnlyButton()); try { - RoughlyEnoughItemsCore.getConfigHelper().saveConfig(); + ConfigHelper.getInstance().saveConfig(); } catch (IOException e) { e.printStackTrace(); } @@ -74,7 +74,7 @@ public class ConfigWidget extends GuiScreen { @Override public void draw(int mouseX, int mouseY, float partialTicks) { - text = getTrueFalseText(RoughlyEnoughItemsCore.getConfigHelper().showCraftableOnlyButton()); + text = getTrueFalseText(ConfigHelper.getInstance().showCraftableOnlyButton()); String t = I18n.format("text.rei.enable_craftable_only"); int width = fontRenderer.getStringWidth(t); fontRenderer.drawStringWithShadow(t, this.x - width - 10, this.y + (this.height - 8) / 2, -1); @@ -84,14 +84,14 @@ public class ConfigWidget extends GuiScreen { widgets.add(new ButtonWidget(window.getScaledWidth() / 2 - 90, 90, 150, 20, "") { @Override public void onPressed(int button, double mouseX, double mouseY) { - int index = Arrays.asList(REIItemListOrdering.values()).indexOf(RoughlyEnoughItemsCore.getConfigHelper().getItemListOrdering()) + 1; + int index = Arrays.asList(REIItemListOrdering.values()).indexOf(ConfigHelper.getInstance().getItemListOrdering()) + 1; if (index >= REIItemListOrdering.values().length) { index = 0; - RoughlyEnoughItemsCore.getConfigHelper().setAscending(!RoughlyEnoughItemsCore.getConfigHelper().isAscending()); + ConfigHelper.getInstance().setAscending(!ConfigHelper.getInstance().isAscending()); } - RoughlyEnoughItemsCore.getConfigHelper().setItemListOrdering(REIItemListOrdering.values()[index]); + ConfigHelper.getInstance().setItemListOrdering(REIItemListOrdering.values()[index]); try { - RoughlyEnoughItemsCore.getConfigHelper().saveConfig(); + ConfigHelper.getInstance().saveConfig(); } catch (IOException e) { e.printStackTrace(); } @@ -100,12 +100,54 @@ public class ConfigWidget extends GuiScreen { @Override public void draw(int int_1, int int_2, float float_1) { RenderHelper.disableStandardItemLighting(); - this.text = I18n.format("text.rei.list_ordering_button", I18n.format(RoughlyEnoughItemsCore.getConfigHelper().getItemListOrdering().getNameTranslationKey()), I18n.format(RoughlyEnoughItemsCore.getConfigHelper().isAscending() ? "ordering.rei.ascending" : "ordering.rei.descending")); + this.text = I18n.format("text.rei.list_ordering_button", I18n.format(ConfigHelper.getInstance().getItemListOrdering().getNameTranslationKey()), I18n.format(ConfigHelper.getInstance().isAscending() ? "ordering.rei.ascending" : "ordering.rei.descending")); String t = I18n.format("text.rei.list_ordering") + ": "; - drawString(Minecraft.getInstance().fontRenderer, t, parent.width / 2 - 95 - Minecraft.getInstance().fontRenderer.getStringWidth(t), 90 + 6, -1); + fontRenderer.drawStringWithShadow(t, parent.width / 2 - 95 - Minecraft.getInstance().fontRenderer.getStringWidth(t), 90 + 6, -1); super.draw(int_1, int_2, float_1); } }); + widgets.add(new ButtonWidget(window.getScaledWidth() / 2 - 20, 120, 40, 20, "") { + @Override + public void onPressed(int button, double mouseX, double mouseY) { + if (button == 0) + ConfigHelper.getInstance().setMirrorItemPanel(!ConfigHelper.getInstance().isMirrorItemPanel()); + try { + ConfigHelper.getInstance().saveConfig(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void draw(int mouseX, int mouseY, float partialTicks) { + text = getTrueFalseText(ConfigHelper.getInstance().isMirrorItemPanel()); + String t = I18n.format("text.rei.mirror_rei"); + int width = fontRenderer.getStringWidth(t); + fontRenderer.drawStringWithShadow(t, this.x - width - 10, this.y + (this.height - 8) / 2, -1); + super.draw(mouseX, mouseY, partialTicks); + } + }); + widgets.add(new ButtonWidget(window.getScaledWidth() / 2 - 20, 150, 40, 20, "") { + @Override + public void onPressed(int button, double mouseX, double mouseY) { + if (button == 0) + ConfigHelper.getInstance().setCheckUpdates(!ConfigHelper.getInstance().checkUpdates()); + try { + ConfigHelper.getInstance().saveConfig(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void draw(int mouseX, int mouseY, float partialTicks) { + text = getTrueFalseText(ConfigHelper.getInstance().checkUpdates()); + String t = I18n.format("text.rei.check_updates"); + int width = fontRenderer.getStringWidth(t); + fontRenderer.drawStringWithShadow(t, this.x - width - 10, this.y + (this.height - 8) / 2, -1); + super.draw(mouseX, mouseY, partialTicks); + } + }); } private String getTrueFalseText(boolean showCraftableOnlyButton) { diff --git a/src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java index 035d5cac6..93086e661 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java @@ -1,7 +1,7 @@ package me.shedaniel.rei.gui.widget; -import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.client.ClientHelper; +import me.shedaniel.rei.client.ConfigHelper; import me.shedaniel.rei.client.GuiHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; @@ -42,14 +42,14 @@ public abstract class CraftableToggleButtonWidget extends ButtonWidget { Minecraft.getInstance().getTextureManager().bindTexture(CHEST_GUI_TEXTURE); GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.zLevel = 100f; - this.drawTexturedModalRect(x, y, (56 + (RoughlyEnoughItemsCore.getConfigHelper().craftableOnly() ? 0 : 20)), 202, 20, 20); + this.drawTexturedModalRect(x, y, (56 + (ConfigHelper.getInstance().craftableOnly() ? 0 : 20)), 202, 20, 20); this.zLevel = 0f; if (getBounds().contains(mouseX, mouseY)) drawTooltip(); } private void drawTooltip() { - GuiHelper.getLastOverlay().addTooltip(new QueuedTooltip(ClientHelper.getMouseLocation(), Arrays.asList(I18n.format(RoughlyEnoughItemsCore.getConfigHelper().craftableOnly() ? "text.rei.showing_craftable" : "text.rei.showing_all")))); + GuiHelper.getLastOverlay().addTooltip(new QueuedTooltip(ClientHelper.getMouseLocation(), Arrays.asList(I18n.format(ConfigHelper.getInstance().craftableOnly() ? "text.rei.showing_craftable" : "text.rei.showing_all")))); } } diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ItemListOverlay.java b/src/main/java/me/shedaniel/rei/gui/widget/ItemListOverlay.java index d2c7ef467..a413add52 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/ItemListOverlay.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/ItemListOverlay.java @@ -103,7 +103,7 @@ public class ItemListOverlay extends Gui implements IWidget { List<ItemStack> os = new LinkedList<>(ol), stacks = Lists.newArrayList(), finalStacks = Lists.newArrayList(); List<ItemGroup> itemGroups = new LinkedList<>(Arrays.asList(ItemGroup.GROUPS)); itemGroups.add(null); - REIItemListOrdering ordering = RoughlyEnoughItemsCore.getConfigHelper().getItemListOrdering(); + REIItemListOrdering ordering = ConfigHelper.getInstance().getItemListOrdering(); if (ordering != REIItemListOrdering.REGISTRY) Collections.sort(os, (itemStack, t1) -> { if (ordering.equals(REIItemListOrdering.NAME)) @@ -112,7 +112,7 @@ public class ItemListOverlay extends Gui implements IWidget { return itemGroups.indexOf(itemStack.getItem().getGroup()) - itemGroups.indexOf(t1.getItem().getGroup()); return 0; }); - if (!RoughlyEnoughItemsCore.getConfigHelper().isAscending()) + if (!ConfigHelper.getInstance().isAscending()) Collections.reverse(os); String[] splitSearchTerm = StringUtils.splitByWholeSeparatorPreserveAllTokens(searchTerm, "|"); Arrays.stream(splitSearchTerm).forEachOrdered(s -> { @@ -135,14 +135,14 @@ public class ItemListOverlay extends Gui implements IWidget { }); if (splitSearchTerm.length == 0) stacks.addAll(os); - List<ItemStack> workingItems = RoughlyEnoughItemsCore.getConfigHelper().craftableOnly() && inventoryItems.size() > 0 ? new ArrayList<>() : new LinkedList<>(ol); - if (RoughlyEnoughItemsCore.getConfigHelper().craftableOnly()) { + List<ItemStack> workingItems = ConfigHelper.getInstance().craftableOnly() && inventoryItems.size() > 0 ? new ArrayList<>() : new LinkedList<>(ol); + if (ConfigHelper.getInstance().craftableOnly()) { RecipeHelper.getInstance().findCraftableByItems(inventoryItems).forEach(workingItems::add); workingItems.addAll(inventoryItems); } final List<ItemStack> finalWorkingItems = workingItems; finalStacks.addAll(stacks.stream().filter(itemStack -> { - if (!RoughlyEnoughItemsCore.getConfigHelper().craftableOnly()) + if (!ConfigHelper.getInstance().craftableOnly()) return true; for(ItemStack workingItem : finalWorkingItems) if (itemStack.isItemEqual(workingItem)) diff --git a/src/main/java/me/shedaniel/rei/gui/widget/RecipeViewingWidgetGui.java b/src/main/java/me/shedaniel/rei/gui/widget/RecipeViewingWidgetGui.java index a1b810b98..22bc5d03c 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/RecipeViewingWidgetGui.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/RecipeViewingWidgetGui.java @@ -178,7 +178,7 @@ public class RecipeViewingWidgetGui extends GuiScreen { SpeedCraftAreaSupplier supplier = RecipeHelper.getInstance().getSpeedCraftButtonArea(selectedCategory); final SpeedCraftFunctional functional = getSpeedCraftFunctionalByCategory(GuiHelper.getLastGuiContainer(), selectedCategory); if (page * getRecipesPerPage() < categoriesMap.get(selectedCategory).size()) { - final Supplier<IRecipeDisplay> topDisplaySupplier = () -> categoriesMap.get(selectedCategory).get(page * getRecipesPerPage()); + final Supplier<IRecipeDisplay> topDisplaySupplier = () -> categoriesMap.get(selectedCategory).get(page * getRecipesPerPage()); final Rectangle topBounds = new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 40, 150, selectedCategory.usesFullPage() ? 140 : 66); widgets.addAll(selectedCategory.setupDisplay(topDisplaySupplier, topBounds)); if (supplier != null) diff --git a/src/main/java/me/shedaniel/rei/listeners/IMixinGuiContainer.java b/src/main/java/me/shedaniel/rei/listeners/IMixinGuiContainer.java index 167772205..84c57a1eb 100644 --- a/src/main/java/me/shedaniel/rei/listeners/IMixinGuiContainer.java +++ b/src/main/java/me/shedaniel/rei/listeners/IMixinGuiContainer.java @@ -1,7 +1,6 @@ package me.shedaniel.rei.listeners; import me.shedaniel.rei.gui.ContainerGuiOverlay; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultBrewingCategory.java b/src/main/java/me/shedaniel/rei/plugin/DefaultBrewingCategory.java index d51fb0798..541c6476c 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultBrewingCategory.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultBrewingCategory.java @@ -4,7 +4,6 @@ import me.shedaniel.rei.api.IRecipeCategory; import me.shedaniel.rei.gui.widget.IWidget; import me.shedaniel.rei.gui.widget.ItemSlotWidget; import me.shedaniel.rei.gui.widget.RecipeBaseWidget; |
