From 0ebb0220488b4e1c8adbb14b318efa549fa2ad26 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 18 Apr 2019 00:31:32 +0800 Subject: Update to pre3 --- .../java/me/shedaniel/rei/api/ItemRegistry.java | 1 - .../java/me/shedaniel/rei/client/ConfigObject.java | 4 +- .../me/shedaniel/rei/client/ItemRegistryImpl.java | 1 - .../shedaniel/rei/gui/ContainerScreenOverlay.java | 4 +- .../rei/gui/credits/CreditsEntryListWidget.java | 2 +- .../me/shedaniel/rei/gui/widget/QueuedTooltip.java | 8 ++++ .../shedaniel/rei/gui/widget/RecipeBaseWidget.java | 3 +- .../me/shedaniel/rei/utils/ClientWeatherUtils.java | 23 ----------- .../shedaniel/rei/utils/ClothScreenRegistry.java | 44 ++++++++-------------- 9 files changed, 32 insertions(+), 58 deletions(-) delete mode 100644 src/main/java/me/shedaniel/rei/utils/ClientWeatherUtils.java (limited to 'src/main/java/me') diff --git a/src/main/java/me/shedaniel/rei/api/ItemRegistry.java b/src/main/java/me/shedaniel/rei/api/ItemRegistry.java index 690ca74da..1b3b0218b 100644 --- a/src/main/java/me/shedaniel/rei/api/ItemRegistry.java +++ b/src/main/java/me/shedaniel/rei/api/ItemRegistry.java @@ -9,7 +9,6 @@ public interface ItemRegistry { List getItemList(); - @Deprecated List getModifiableItemList(); ItemStack[] getAllStacksFromItem(Item item); diff --git a/src/main/java/me/shedaniel/rei/client/ConfigObject.java b/src/main/java/me/shedaniel/rei/client/ConfigObject.java index 1d07f4ef3..7ecf00660 100644 --- a/src/main/java/me/shedaniel/rei/client/ConfigObject.java +++ b/src/main/java/me/shedaniel/rei/client/ConfigObject.java @@ -54,7 +54,9 @@ public class ConfigObject { public ItemCheatingMode itemCheatingMode = ItemCheatingMode.REI_LIKE; - @Comment("The location of choose page dialog") + public boolean lightGrayRecipeBorder = false; + + @Comment("The location of choose page dialog, will automatically be set to your last location so there is no need to change this.") public RelativePoint choosePageDialogPoint = new RelativePoint(.5, .5); } diff --git a/src/main/java/me/shedaniel/rei/client/ItemRegistryImpl.java b/src/main/java/me/shedaniel/rei/client/ItemRegistryImpl.java index f61c3d063..648dfff98 100644 --- a/src/main/java/me/shedaniel/rei/client/ItemRegistryImpl.java +++ b/src/main/java/me/shedaniel/rei/client/ItemRegistryImpl.java @@ -21,7 +21,6 @@ public class ItemRegistryImpl implements ItemRegistry { return Collections.unmodifiableList(itemList); } - @Deprecated @Override public List getModifiableItemList() { return itemList; diff --git a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java index 22b3a5dba..51a14e246 100644 --- a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java +++ b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java @@ -285,7 +285,7 @@ public class ContainerScreenOverlay extends AbstractParentElement implements Dra } private GameMode getCurrentGameMode() { - return MinecraftClient.getInstance().getNetworkHandler().getScoreboardEntry(MinecraftClient.getInstance().player.getGameProfile().getId()).getGameMode(); + return MinecraftClient.getInstance().getNetworkHandler().getPlayerListEntry(MinecraftClient.getInstance().player.getGameProfile().getId()).getGameMode(); } private Rectangle getTextFieldArea() { @@ -333,7 +333,7 @@ public class ContainerScreenOverlay extends AbstractParentElement implements Dra ScreenHelper.searchField.laterRender(mouseX, mouseY, delta); Screen currentScreen = MinecraftClient.getInstance().currentScreen; if (!(currentScreen instanceof RecipeViewingScreen) || !((RecipeViewingScreen) currentScreen).choosePageActivated) - QUEUED_TOOLTIPS.stream().filter(Objects::nonNull).forEach(queuedTooltip -> renderTooltip(queuedTooltip.getText(), queuedTooltip.getLocation().x, queuedTooltip.getLocation().y)); + QUEUED_TOOLTIPS.stream().filter(Objects::nonNull).forEach(queuedTooltip -> renderTooltip(queuedTooltip.getText(), queuedTooltip.getX(), queuedTooltip.getY())); QUEUED_TOOLTIPS.clear(); } diff --git a/src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java b/src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java index 451f05128..3145b2d44 100644 --- a/src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/credits/CreditsEntryListWidget.java @@ -33,7 +33,7 @@ public class CreditsEntryListWidget extends AlwaysSelectedItemListWidget { + public static class CreditsItem extends AlwaysSelectedItemListWidget.Item { private String text; public CreditsItem(TextComponent textComponent) { diff --git a/src/main/java/me/shedaniel/rei/gui/widget/QueuedTooltip.java b/src/main/java/me/shedaniel/rei/gui/widget/QueuedTooltip.java index 1dd466316..8d8300c00 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/QueuedTooltip.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/QueuedTooltip.java @@ -38,6 +38,14 @@ public class QueuedTooltip { return location; } + public int getX() { + return getLocation().x; + } + + public int getY() { + return getLocation().y; + } + public List getText() { return text; } diff --git a/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java index 5d4341fdb..57dbd5e89 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java @@ -1,6 +1,7 @@ package me.shedaniel.rei.gui.widget; import com.mojang.blaze3d.platform.GlStateManager; +import me.shedaniel.rei.RoughlyEnoughItemsCore; import net.minecraft.client.render.GuiLighting; import net.minecraft.util.Identifier; @@ -64,7 +65,7 @@ public class RecipeBaseWidget extends HighlightableWidget { } protected int getTextureOffset() { - return 0; + return RoughlyEnoughItemsCore.getConfigManager().getConfig().lightGrayRecipeBorder ? 0 : 66; } diff --git a/src/main/java/me/shedaniel/rei/utils/ClientWeatherUtils.java b/src/main/java/me/shedaniel/rei/utils/ClientWeatherUtils.java deleted file mode 100644 index 77db8837c..000000000 --- a/src/main/java/me/shedaniel/rei/utils/ClientWeatherUtils.java +++ /dev/null @@ -1,23 +0,0 @@ -package me.shedaniel.rei.utils; - -public class ClientWeatherUtils { - - private float rain = 0f, thunder = 0f; - - public float getRain() { - return rain; - } - - public void setRain(float rain) { - this.rain = rain; - } - - public float getThunder() { - return thunder; - } - - public void setThunder(float thunder) { - this.thunder = thunder; - } - -} diff --git a/src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java b/src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java index 85d1866db..f72ca31b0 100644 --- a/src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java +++ b/src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java @@ -6,6 +6,7 @@ import me.shedaniel.cloth.gui.entries.BooleanListEntry; import me.shedaniel.cloth.gui.entries.EnumListEntry; import me.shedaniel.cloth.gui.entries.IntegerSliderEntry; import me.shedaniel.cloth.gui.entries.StringListEntry; +import me.shedaniel.cloth.hooks.ScreenHooks; import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.api.ItemCheatingMode; import me.shedaniel.rei.gui.config.ItemListOrderingConfig; @@ -23,32 +24,13 @@ import java.util.Map; public class ClothScreenRegistry { public static void openConfigScreen(Screen parent) { - ConfigScreenBuilder builder = new ClothConfigScreen.Builder(parent, "text.rei.config.title", savedConfig -> { + ConfigScreenBuilder builder = ConfigScreenBuilder.create(parent, "text.rei.config.title", savedConfig -> { try { RoughlyEnoughItemsCore.getConfigManager().saveConfig(); } catch (IOException e) { e.printStackTrace(); } - }) { - @Override - public ClothConfigScreen build() { - return new ClothConfigScreen(this.getParentScreen(), this.getTitle(), this.getDataMap(), this.doesConfirmSave(), this.shouldProcessErrors()) { - public void onSave(Map>> o) { - if (getOnSave() != null) { - getOnSave().accept(new SelfSavedConfig(o)); - } - } - - @Override - protected void init() { - super.init(); - ButtonWidget w; - buttons.add(0, w = new ButtonWidget(6, 6, 60, 20, I18n.translate("text.rei.credits"), widget -> MinecraftClient.getInstance().openScreen(new CreditsScreen(MinecraftClient.getInstance().currentScreen)))); - children.add(0, w); - } - }; - } - }; + }); builder.addCategory("text.rei.config.general").addOption(new BooleanListEntry("text.rei.config.cheating", RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating = bool)); ConfigScreenBuilder.CategoryBuilder appearance = builder.addCategory("text.rei.config.appearance"); appearance.addOption(new BooleanListEntry("text.rei.config.side_search_box", RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField = bool)); @@ -63,22 +45,28 @@ public class ClothScreenRegistry { } }); appearance.addOption(new IntegerSliderEntry("text.rei.config.max_recipes_per_page", 2, 99, RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage, "text.cloth-config.reset_value", () -> 3, i -> RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage = i)); - appearance.addOption(new EnumListEntry<>("text.rei.config.item_cheating_mode", ItemCheatingMode.class, RoughlyEnoughItemsCore.getConfigManager().getConfig().itemCheatingMode, "text.cloth-config.reset_value", () -> ItemCheatingMode.REI_LIKE, i -> RoughlyEnoughItemsCore.getConfigManager().getConfig().itemCheatingMode = i, anEnum -> { - return I18n.translate("text.rei.config.item_cheating_mode." + anEnum.name().toLowerCase()); + appearance.addOption(new BooleanListEntry("text.rei.config.light_gray_recipe_border", RoughlyEnoughItemsCore.getConfigManager().getConfig().lightGrayRecipeBorder, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().lightGrayRecipeBorder = bool)); + appearance.addOption(new BooleanListEntry("text.rei.config.prefer_visible_recipes", RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes = bool)); + ConfigScreenBuilder.CategoryBuilder action = builder.addCategory("text.rei.config.action"); + action.addOption(new EnumListEntry<>("text.rei.config.item_cheating_mode", ItemCheatingMode.class, RoughlyEnoughItemsCore.getConfigManager().getConfig().itemCheatingMode, "text.cloth-config.reset_value", () -> ItemCheatingMode.REI_LIKE, i -> RoughlyEnoughItemsCore.getConfigManager().getConfig().itemCheatingMode = i, e -> { + return I18n.translate("text.rei.config.item_cheating_mode." + e.name().toLowerCase()); })); + action.addOption(new StringListEntry("text.rei.give_command", RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand, "text.cloth-config.reset_value", () -> "/give {player_name} {item_identifier}{nbt} {count}", s -> RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand = s)); + action.addOption(new StringListEntry("text.rei.gamemode_command", RoughlyEnoughItemsCore.getConfigManager().getConfig().gamemodeCommand, "text.cloth-config.reset_value", () -> "/gamemode {gamemode}", s -> RoughlyEnoughItemsCore.getConfigManager().getConfig().gamemodeCommand = s)); + action.addOption(new StringListEntry("text.rei.weather_command", RoughlyEnoughItemsCore.getConfigManager().getConfig().weatherCommand, "text.cloth-config.reset_value", () -> "/weather {weather}", s -> RoughlyEnoughItemsCore.getConfigManager().getConfig().weatherCommand = s)); ConfigScreenBuilder.CategoryBuilder modules = builder.addCategory("text.rei.config.modules"); modules.addOption(new BooleanListEntry("text.rei.config.enable_craftable_only", RoughlyEnoughItemsCore.getConfigManager().getConfig().enableCraftableOnlyButton, "text.cloth-config.reset_value", () -> true, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().enableCraftableOnlyButton = bool)); modules.addOption(new BooleanListEntry("text.rei.config.enable_util_buttons", RoughlyEnoughItemsCore.getConfigManager().getConfig().showUtilsButtons, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().showUtilsButtons = bool)); modules.addOption(new BooleanListEntry("text.rei.config.disable_recipe_book", RoughlyEnoughItemsCore.getConfigManager().getConfig().disableRecipeBook, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().disableRecipeBook = bool)); ConfigScreenBuilder.CategoryBuilder advanced = builder.addCategory("text.rei.config.advanced"); - advanced.addOption(new StringListEntry("text.rei.give_command", RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand, "text.cloth-config.reset_value", () -> "/give {player_name} {item_identifier}{nbt} {count}", s -> RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand = s)); - advanced.addOption(new StringListEntry("text.rei.gamemode_command", RoughlyEnoughItemsCore.getConfigManager().getConfig().gamemodeCommand, "text.cloth-config.reset_value", () -> "/gamemode {gamemode}", s -> RoughlyEnoughItemsCore.getConfigManager().getConfig().gamemodeCommand = s)); - advanced.addOption(new StringListEntry("text.rei.weather_command", RoughlyEnoughItemsCore.getConfigManager().getConfig().weatherCommand, "text.cloth-config.reset_value", () -> "/weather {weather}", s -> RoughlyEnoughItemsCore.getConfigManager().getConfig().weatherCommand = s)); - advanced.addOption(new BooleanListEntry("text.rei.config.prefer_visible_recipes", RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes = bool)); advanced.addOption(new BooleanListEntry("text.rei.config.enable_legacy_speedcraft_support", RoughlyEnoughItemsCore.getConfigManager().getConfig().enableLegacySpeedCraftSupport, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().enableLegacySpeedCraftSupport = bool)); ConfigScreenBuilder.CategoryBuilder aprilFools = builder.addCategory("text.rei.config.april_fools"); aprilFools.addOption(new BooleanListEntry("text.rei.config.april_fools.2019", RoughlyEnoughItemsCore.getConfigManager().getConfig().aprilFoolsFish2019, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().aprilFoolsFish2019 = bool)); - MinecraftClient.getInstance().openScreen(builder.build()); + MinecraftClient.getInstance().openScreen(builder.build(screen -> { + ButtonWidget w = new ButtonWidget(6, 6, 60, 20, I18n.translate("text.rei.credits"), widget -> MinecraftClient.getInstance().openScreen(new CreditsScreen(MinecraftClient.getInstance().currentScreen))); + ((ScreenHooks) screen).cloth_getButtonWidgets().add(0, w); + ((ScreenHooks) screen).cloth_getChildren().add(0, w); + })); } private static class SelfSavedConfig extends ClothConfigScreen.Builder.SavedConfig { -- cgit