From c78a022162a575e18e8ca8e18d92518c7cb6b2f8 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 18 Jul 2019 15:48:43 +0800 Subject: v2.10.0 --- .../hammercore/client/utils/Scissors.java | 52 +++ src/main/java/me/shedaniel/rei/MixinStart.java | 2 + .../me/shedaniel/rei/RoughlyEnoughItemsClient.java | 75 +++ .../me/shedaniel/rei/RoughlyEnoughItemsCore.java | 73 +-- .../rei/api/AbstractInventoryScreenHooks.java | 16 + .../me/shedaniel/rei/api/AutoCraftingHandler.java | 25 + .../me/shedaniel/rei/api/BaseBoundsHandler.java | 32 ++ .../me/shedaniel/rei/api/ButtonAreaSupplier.java | 16 + .../java/me/shedaniel/rei/api/ClientHelper.java | 149 ++++++ .../java/me/shedaniel/rei/api/ConfigManager.java | 28 ++ .../me/shedaniel/rei/api/ContainerScreenHooks.java | 25 + .../java/me/shedaniel/rei/api/DisplayHelper.java | 139 ++++++ .../java/me/shedaniel/rei/api/DisplaySettings.java | 15 - .../rei/api/DisplayVisibilityHandler.java | 33 ++ .../me/shedaniel/rei/api/GuiEventHandlerHooks.java | 11 + .../me/shedaniel/rei/api/GuiTextFieldHooks.java | 7 + src/main/java/me/shedaniel/rei/api/Identifier.java | 29 +- .../java/me/shedaniel/rei/api/Identifiers.java | 15 + .../java/me/shedaniel/rei/api/ItemRegistry.java | 44 ++ .../java/me/shedaniel/rei/api/KeyBindingHooks.java | 11 + .../me/shedaniel/rei/api/LiveRecipeGenerator.java | 21 + .../java/me/shedaniel/rei/api/PluginDisabler.java | 36 ++ .../java/me/shedaniel/rei/api/PluginFunction.java | 11 +- src/main/java/me/shedaniel/rei/api/REIPlugin.java | 19 - .../java/me/shedaniel/rei/api/REIPluginEntry.java | 71 +++ .../rei/api/RecipeBookButtonWidgetHooks.java | 15 + .../me/shedaniel/rei/api/RecipeBookGuiHooks.java | 22 + .../java/me/shedaniel/rei/api/RecipeCategory.java | 122 +++-- .../java/me/shedaniel/rei/api/RecipeDisplay.java | 35 +- .../java/me/shedaniel/rei/api/RecipeHelper.java | 186 +++++++- .../java/me/shedaniel/rei/api/RelativePoint.java | 28 -- src/main/java/me/shedaniel/rei/api/Renderer.java | 104 +++++ .../java/me/shedaniel/rei/api/ScreenHooks.java | 14 + .../me/shedaniel/rei/api/SpeedCraftFunctional.java | 13 - src/main/java/me/shedaniel/rei/api/TabGetter.java | 5 - .../rei/client/BaseBoundsHandlerImpl.java | 115 +++++ .../java/me/shedaniel/rei/client/ClientHelper.java | 146 ------ .../me/shedaniel/rei/client/ClientHelperImpl.java | 247 ++++++++++ .../me/shedaniel/rei/client/ConfigManager.java | 112 ----- .../me/shedaniel/rei/client/ConfigManagerImpl.java | 127 +++++ .../java/me/shedaniel/rei/client/ConfigObject.java | 77 ++- .../me/shedaniel/rei/client/DisplayHelperImpl.java | 91 ++++ .../me/shedaniel/rei/client/ItemListOrdering.java | 17 - .../me/shedaniel/rei/client/ItemRegistryImpl.java | 12 +- .../shedaniel/rei/client/KeyBindingRegistry.java | 41 -- .../me/shedaniel/rei/client/KeybindRegistry.java | 43 ++ .../shedaniel/rei/client/PluginDisablerImpl.java | 5 + .../me/shedaniel/rei/client/RecipeHelperImpl.java | 320 +++++++++++-- .../java/me/shedaniel/rei/client/ScreenHelper.java | 51 +- .../me/shedaniel/rei/client/SearchArgument.java | 60 ++- src/main/java/me/shedaniel/rei/client/Weather.java | 20 +- .../shedaniel/rei/gui/ContainerScreenOverlay.java | 472 +++++++++++-------- .../shedaniel/rei/gui/PreRecipeViewingScreen.java | 137 ++++++ .../me/shedaniel/rei/gui/RecipeViewingScreen.java | 320 ++++++++----- .../rei/gui/VillagerRecipeViewingScreen.java | 425 +++++++++++++++++ .../me/shedaniel/rei/gui/config/ConfigEntry.java | 155 ------- .../rei/gui/config/ConfigEntryListWidget.java | 35 -- .../me/shedaniel/rei/gui/config/ConfigScreen.java | 375 --------------- .../shedaniel/rei/gui/config/ItemCheatingMode.java | 11 + .../shedaniel/rei/gui/config/ItemListOrdering.java | 24 + .../rei/gui/config/ItemListOrderingConfig.java | 43 ++ .../shedaniel/rei/gui/config/RecipeScreenType.java | 21 + .../me/shedaniel/rei/gui/credits/CreditsEntry.java | 22 - .../rei/gui/credits/CreditsEntryListWidget.java | 68 ++- .../shedaniel/rei/gui/credits/CreditsScreen.java | 76 ++- .../shedaniel/rei/gui/renderers/EmptyRenderer.java | 19 + .../rei/gui/renderers/ItemStackRenderer.java | 74 +++ .../rei/gui/renderers/RecipeRenderer.java | 18 + .../rei/gui/renderers/SimpleRecipeRenderer.java | 119 +++++ .../rei/gui/widget/AutoCraftingButtonWidget.java | 68 +++ .../me/shedaniel/rei/gui/widget/ButtonWidget.java | 116 ++--- .../rei/gui/widget/CategoryBaseWidget.java | 26 ++ .../rei/gui/widget/ClickableLabelWidget.java | 56 ++- .../gui/widget/CraftableToggleButtonWidget.java | 43 +- .../rei/gui/widget/DetailedButtonWidget.java | 46 ++ .../shedaniel/rei/gui/widget/DraggableWidget.java | 24 +- .../rei/gui/widget/HighlightableWidget.java | 21 - .../java/me/shedaniel/rei/gui/widget/IWidget.java | 41 -- .../shedaniel/rei/gui/widget/ItemListOverlay.java | 342 ++++++++------ .../shedaniel/rei/gui/widget/ItemSlotWidget.java | 151 ------ .../me/shedaniel/rei/gui/widget/LabelWidget.java | 30 +- .../me/shedaniel/rei/gui/widget/QueuedTooltip.java | 38 +- .../shedaniel/rei/gui/widget/RecipeBaseWidget.java | 94 ++-- .../rei/gui/widget/RecipeChoosePageWidget.java | 61 +-- .../rei/gui/widget/SearchFieldWidget.java | 73 +++ .../shedaniel/rei/gui/widget/SlotBaseWidget.java | 33 ++ .../me/shedaniel/rei/gui/widget/SlotWidget.java | 225 +++++++++ .../rei/gui/widget/SpeedCraftingButtonWidget.java | 43 -- .../me/shedaniel/rei/gui/widget/TabWidget.java | 82 ++-- .../shedaniel/rei/gui/widget/TextFieldWidget.java | 93 ++-- .../java/me/shedaniel/rei/gui/widget/Widget.java | 30 ++ .../shedaniel/rei/gui/widget/WidgetWithBounds.java | 26 ++ .../rei/listeners/ContainerScreenHooks.java | 17 - .../shedaniel/rei/listeners/KeyBindingHooks.java | 11 - .../me/shedaniel/rei/mixin/GhostSlotsHook.java | 14 - .../rei/mixin/MixinBrewingRecipeRegistry.java | 16 +- .../rei/mixin/MixinClientPlayNetworkHandler.java | 15 +- .../shedaniel/rei/mixin/MixinContainerScreen.java | 108 ----- .../rei/mixin/MixinCraftingTableScreen.java | 41 -- .../mixin/MixinCreativePlayerInventoryScreen.java | 66 --- .../me/shedaniel/rei/mixin/MixinGameRenderer.java | 30 ++ .../shedaniel/rei/mixin/MixinGuiButtonImage.java | 20 + .../me/shedaniel/rei/mixin/MixinGuiContainer.java | 45 ++ .../shedaniel/rei/mixin/MixinGuiEventHandler.java | 29 ++ .../me/shedaniel/rei/mixin/MixinGuiRecipeBook.java | 36 ++ .../me/shedaniel/rei/mixin/MixinGuiTextField.java | 20 + .../rei/mixin/MixinInventoryEffectRenderer.java | 16 + .../me/shedaniel/rei/mixin/MixinKeyBinding.java | 8 +- .../shedaniel/rei/mixin/MixinKeyboardListener.java | 72 +++ .../me/shedaniel/rei/mixin/MixinMouseHelper.java | 53 +++ .../rei/mixin/MixinPlayerInventoryScreen.java | 41 -- .../java/me/shedaniel/rei/mixin/MixinScreen.java | 75 ++- .../me/shedaniel/rei/mixin/MixinTabGetter.java | 19 - .../me/shedaniel/rei/network/CreateItemPacket.java | 26 +- .../me/shedaniel/rei/network/DeleteItemPacket.java | 8 +- .../me/shedaniel/rei/plugin/BrewingRecipe.java | 18 - .../rei/plugin/DefaultAutoCraftingPlugin.java | 40 ++ .../rei/plugin/DefaultBrewingCategory.java | 98 ---- .../rei/plugin/DefaultBrewingDisplay.java | 60 --- .../rei/plugin/DefaultCraftingCategory.java | 102 ---- .../rei/plugin/DefaultCraftingDisplay.java | 22 - .../shedaniel/rei/plugin/DefaultCustomDisplay.java | 70 --- .../me/shedaniel/rei/plugin/DefaultPlugin.java | 202 +++++--- .../plugin/DefaultPotionEffectExclusionZones.java | 44 ++ .../plugin/DefaultRecipeBookExclusionZones.java | 34 ++ .../shedaniel/rei/plugin/DefaultShapedDisplay.java | 57 --- .../rei/plugin/DefaultShapelessDisplay.java | 60 --- .../rei/plugin/DefaultSmeltingCategory.java | 71 --- .../rei/plugin/DefaultSmeltingDisplay.java | 63 --- .../autocrafting/AutoCraftingTableBookHandler.java | 39 ++ .../autocrafting/AutoFurnaceBookHandler.java | 39 ++ .../autocrafting/AutoInventoryBookHandler.java | 39 ++ .../rei/plugin/brewing/BrewingRecipe.java | 23 + .../rei/plugin/brewing/DefaultBrewingCategory.java | 105 +++++ .../rei/plugin/brewing/DefaultBrewingDisplay.java | 60 +++ .../plugin/crafting/DefaultCraftingCategory.java | 108 +++++ .../plugin/crafting/DefaultCraftingDisplay.java | 32 ++ .../rei/plugin/crafting/DefaultCustomDisplay.java | 85 ++++ .../rei/plugin/crafting/DefaultShapedDisplay.java | 67 +++ .../plugin/crafting/DefaultShapelessDisplay.java | 71 +++ .../plugin/smelting/DefaultSmeltingCategory.java | 84 ++++ .../plugin/smelting/DefaultSmeltingDisplay.java | 68 +++ .../shedaniel/rei/utils/ClothScreenRegistry.java | 156 +++++++ .../shedaniel/rei/utils/RiftModListRegistry.java | 13 - .../reiclothconfig2/api/AbstractConfigEntry.java | 44 ++ .../api/AbstractConfigListEntry.java | 39 ++ .../reiclothconfig2/api/ConfigBuilder.java | 77 +++ .../reiclothconfig2/api/ConfigCategory.java | 16 + .../reiclothconfig2/api/ConfigEntryBuilder.java | 51 ++ .../shedaniel/reiclothconfig2/api/MouseUtils.java | 23 + .../reiclothconfig2/api/QueuedTooltip.java | 43 ++ .../reiclothconfig2/api/RunSixtyTimesEverySec.java | 22 + .../reiclothconfig2/gui/ClothConfigScreen.java | 463 ++++++++++++++++++ .../reiclothconfig2/gui/ClothConfigTabButton.java | 51 ++ .../gui/ClothRequiresRestartScreen.java | 19 + .../reiclothconfig2/gui/entries/BaseListCell.java | 15 + .../reiclothconfig2/gui/entries/BaseListEntry.java | 221 +++++++++ .../gui/entries/BooleanListEntry.java | 113 +++++ .../gui/entries/DoubleListEntry.java | 114 +++++ .../gui/entries/DoubleListListEntry.java | 147 ++++++ .../reiclothconfig2/gui/entries/EnumListEntry.java | 135 ++++++ .../gui/entries/FloatListEntry.java | 113 +++++ .../gui/entries/FloatListListEntry.java | 146 ++++++ .../gui/entries/IntegerListEntry.java | 114 +++++ .../gui/entries/IntegerListListEntry.java | 146 ++++++ .../gui/entries/IntegerSliderEntry.java | 201 ++++++++ .../reiclothconfig2/gui/entries/LongListEntry.java | 113 +++++ .../gui/entries/LongListListEntry.java | 146 ++++++ .../gui/entries/LongSliderEntry.java | 201 ++++++++ .../gui/entries/StringListEntry.java | 49 ++ .../gui/entries/StringListListEntry.java | 97 ++++ .../gui/entries/SubCategoryListEntry.java | 146 ++++++ .../gui/entries/TextFieldListEntry.java | 115 +++++ .../reiclothconfig2/gui/entries/TextListEntry.java | 76 +++ .../gui/entries/TooltipListEntry.java | 51 ++ .../gui/widget/DynamicElementListWidget.java | 121 +++++ .../gui/widget/DynamicEntryListWidget.java | 515 +++++++++++++++++++++ .../DynamicSmoothScrollingEntryListWidget.java | 161 +++++++ .../reiclothconfig2/impl/ConfigBuilderImpl.java | 208 +++++++++ .../reiclothconfig2/impl/ConfigCategoryImpl.java | 40 ++ .../impl/ConfigEntryBuilderImpl.java | 119 +++++ .../impl/RunSixtyTimesEverySecImpl.java | 24 + .../impl/builders/BooleanToggleBuilder.java | 74 +++ .../impl/builders/DoubleFieldBuilder.java | 86 ++++ .../impl/builders/DoubleListBuilder.java | 103 +++++ .../impl/builders/EnumSelectorBuilder.java | 74 +++ .../impl/builders/FieldBuilder.java | 44 ++ .../impl/builders/FloatFieldBuilder.java | 86 ++++ .../impl/builders/FloatListBuilder.java | 103 +++++ .../impl/builders/IntFieldBuilder.java | 86 ++++ .../impl/builders/IntListBuilder.java | 103 +++++ .../impl/builders/IntSliderBuilder.java | 81 ++++ .../impl/builders/LongFieldBuilder.java | 86 ++++ .../impl/builders/LongListBuilder.java | 103 +++++ .../impl/builders/LongSliderBuilder.java | 71 +++ .../impl/builders/StringListBuilder.java | 78 ++++ .../impl/builders/SubCategoryBuilder.java | 168 +++++++ .../impl/builders/TextDescriptionBuilder.java | 49 ++ .../impl/builders/TextFieldBuilder.java | 62 +++ 199 files changed, 12618 insertions(+), 3209 deletions(-) create mode 100644 src/main/java/com/zeitheron/hammercore/client/utils/Scissors.java create mode 100644 src/main/java/me/shedaniel/rei/RoughlyEnoughItemsClient.java create mode 100644 src/main/java/me/shedaniel/rei/api/AbstractInventoryScreenHooks.java create mode 100644 src/main/java/me/shedaniel/rei/api/AutoCraftingHandler.java create mode 100644 src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java create mode 100644 src/main/java/me/shedaniel/rei/api/ClientHelper.java create mode 100644 src/main/java/me/shedaniel/rei/api/ContainerScreenHooks.java create mode 100644 src/main/java/me/shedaniel/rei/api/DisplayHelper.java delete mode 100644 src/main/java/me/shedaniel/rei/api/DisplaySettings.java create mode 100644 src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java create mode 100644 src/main/java/me/shedaniel/rei/api/GuiEventHandlerHooks.java create mode 100644 src/main/java/me/shedaniel/rei/api/GuiTextFieldHooks.java create mode 100644 src/main/java/me/shedaniel/rei/api/Identifiers.java create mode 100644 src/main/java/me/shedaniel/rei/api/KeyBindingHooks.java create mode 100644 src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java delete mode 100644 src/main/java/me/shedaniel/rei/api/REIPlugin.java create mode 100644 src/main/java/me/shedaniel/rei/api/REIPluginEntry.java create mode 100644 src/main/java/me/shedaniel/rei/api/RecipeBookButtonWidgetHooks.java create mode 100644 src/main/java/me/shedaniel/rei/api/RecipeBookGuiHooks.java delete mode 100644 src/main/java/me/shedaniel/rei/api/RelativePoint.java create mode 100644 src/main/java/me/shedaniel/rei/api/Renderer.java create mode 100644 src/main/java/me/shedaniel/rei/api/ScreenHooks.java delete mode 100644 src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java delete mode 100644 src/main/java/me/shedaniel/rei/api/TabGetter.java create mode 100644 src/main/java/me/shedaniel/rei/client/BaseBoundsHandlerImpl.java delete mode 100644 src/main/java/me/shedaniel/rei/client/ClientHelper.java create mode 100644 src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java delete mode 100644 src/main/java/me/shedaniel/rei/client/ConfigManager.java create mode 100644 src/main/java/me/shedaniel/rei/client/ConfigManagerImpl.java create mode 100644 src/main/java/me/shedaniel/rei/client/DisplayHelperImpl.java delete mode 100644 src/main/java/me/shedaniel/rei/client/ItemListOrdering.java delete mode 100644 src/main/java/me/shedaniel/rei/client/KeyBindingRegistry.java create mode 100644 src/main/java/me/shedaniel/rei/client/KeybindRegistry.java create mode 100644 src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java create mode 100644 src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java delete mode 100644 src/main/java/me/shedaniel/rei/gui/config/ConfigEntry.java delete mode 100644 src/main/java/me/shedaniel/rei/gui/config/ConfigEntryListWidget.java delete mode 100644 src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java create mode 100644 src/main/java/me/shedaniel/rei/gui/config/ItemCheatingMode.java create mode 100644 src/main/java/me/shedaniel/rei/gui/config/ItemListOrdering.java create mode 100644 src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingConfig.java create mode 100644 src/main/java/me/shedaniel/rei/gui/config/RecipeScreenType.java delete mode 100644 src/main/java/me/shedaniel/rei/gui/credits/CreditsEntry.java create mode 100644 src/main/java/me/shedaniel/rei/gui/renderers/EmptyRenderer.java create mode 100644 src/main/java/me/shedaniel/rei/gui/renderers/ItemStackRenderer.java create mode 100644 src/main/java/me/shedaniel/rei/gui/renderers/RecipeRenderer.java create mode 100644 src/main/java/me/shedaniel/rei/gui/renderers/SimpleRecipeRenderer.java create mode 100644 src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java create mode 100644 src/main/java/me/shedaniel/rei/gui/widget/CategoryBaseWidget.java create mode 100644 src/main/java/me/shedaniel/rei/gui/widget/DetailedButtonWidget.java delete mode 100644 src/main/java/me/shedaniel/rei/gui/widget/HighlightableWidget.java delete mode 100644 src/main/java/me/shedaniel/rei/gui/widget/IWidget.java delete mode 100644 src/main/java/me/shedaniel/rei/gui/widget/ItemSlotWidget.java create mode 100644 src/main/java/me/shedaniel/rei/gui/widget/SearchFieldWidget.java create mode 100644 src/main/java/me/shedaniel/rei/gui/widget/SlotBaseWidget.java create mode 100644 src/main/java/me/shedaniel/rei/gui/widget/SlotWidget.java delete mode 100644 src/main/java/me/shedaniel/rei/gui/widget/SpeedCraftingButtonWidget.java create mode 100644 src/main/java/me/shedaniel/rei/gui/widget/Widget.java create mode 100644 src/main/java/me/shedaniel/rei/gui/widget/WidgetWithBounds.java delete mode 100644 src/main/java/me/shedaniel/rei/listeners/ContainerScreenHooks.java delete mode 100644 src/main/java/me/shedaniel/rei/listeners/KeyBindingHooks.java delete mode 100644 src/main/java/me/shedaniel/rei/mixin/GhostSlotsHook.java delete mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinContainerScreen.java delete mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinCraftingTableScreen.java delete mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinCreativePlayerInventoryScreen.java create mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinGameRenderer.java create mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinGuiButtonImage.java create mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinGuiContainer.java create mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinGuiEventHandler.java create mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinGuiRecipeBook.java create mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinGuiTextField.java create mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinInventoryEffectRenderer.java create mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinKeyboardListener.java create mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinMouseHelper.java delete mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinPlayerInventoryScreen.java delete mode 100644 src/main/java/me/shedaniel/rei/mixin/MixinTabGetter.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/BrewingRecipe.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultBrewingCategory.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultBrewingDisplay.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultCraftingCategory.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultCraftingDisplay.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultShapedDisplay.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultShapelessDisplay.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingCategory.java delete mode 100644 src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingDisplay.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/autocrafting/AutoCraftingTableBookHandler.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/autocrafting/AutoFurnaceBookHandler.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/autocrafting/AutoInventoryBookHandler.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingCategory.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingCategory.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingDisplay.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCustomDisplay.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapelessDisplay.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/smelting/DefaultSmeltingCategory.java create mode 100644 src/main/java/me/shedaniel/rei/plugin/smelting/DefaultSmeltingDisplay.java create mode 100644 src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java delete mode 100644 src/main/java/me/shedaniel/rei/utils/RiftModListRegistry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/api/AbstractConfigEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/api/AbstractConfigListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/api/ConfigBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/api/ConfigCategory.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/api/ConfigEntryBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/api/MouseUtils.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/api/QueuedTooltip.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/api/RunSixtyTimesEverySec.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/ClothConfigScreen.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/ClothConfigTabButton.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/ClothRequiresRestartScreen.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/BaseListCell.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/BaseListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/BooleanListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/DoubleListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/DoubleListListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/EnumListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/FloatListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/FloatListListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/IntegerListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/IntegerListListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/IntegerSliderEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/LongListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/LongListListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/LongSliderEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/StringListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/StringListListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/SubCategoryListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/TextFieldListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/TextListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/entries/TooltipListEntry.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/widget/DynamicElementListWidget.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/widget/DynamicEntryListWidget.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/gui/widget/DynamicSmoothScrollingEntryListWidget.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/ConfigBuilderImpl.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/ConfigCategoryImpl.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/ConfigEntryBuilderImpl.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/RunSixtyTimesEverySecImpl.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/BooleanToggleBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/DoubleFieldBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/DoubleListBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/EnumSelectorBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/FieldBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/FloatFieldBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/FloatListBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/IntFieldBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/IntListBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/IntSliderBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/LongFieldBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/LongListBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/LongSliderBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/StringListBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/SubCategoryBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/TextDescriptionBuilder.java create mode 100644 src/main/java/me/shedaniel/reiclothconfig2/impl/builders/TextFieldBuilder.java (limited to 'src/main/java') diff --git a/src/main/java/com/zeitheron/hammercore/client/utils/Scissors.java b/src/main/java/com/zeitheron/hammercore/client/utils/Scissors.java new file mode 100644 index 000000000..1693b316c --- /dev/null +++ b/src/main/java/com/zeitheron/hammercore/client/utils/Scissors.java @@ -0,0 +1,52 @@ +package com.zeitheron.hammercore.client.utils; + +import net.minecraft.client.MainWindow; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +/** + * This is originally the part of Hammer Lib, repacked in REI with permission. + * Adapted GL scissor for minecraft pixel resolution and adjusts (0;0) as left-top corner. + * + * @author Zeitheron + */ +public class Scissors { + /** + * Starts the scissor test + */ + public static void begin() { + GL11.glEnable(GL11.GL_SCISSOR_TEST); + } + + /** + * Setup the scissor bounds + * + * @param x the top left x coordinates + * @param y the top left y coordinates + * @param width the width of the bounds + * @param height the height of the bounds + */ + public static void scissor(int x, int y, int width, int height) { + MainWindow window = Minecraft.getInstance().mainWindow; + + int sw = window.getWidth(); + int sh = window.getHeight(); + float dw = window.getScaledWidth(); + float dh = window.getScaledHeight(); + + x = Math.round(sw * (x / dw)); + y = Math.round(sh * (y / dh)); + + width = Math.round(sw * (width / dw)); + height = Math.round(sh * (height / dh)); + + GL11.glScissor(x, sh - height - y, width, height); + } + + /** + * Stops the scissor test + */ + public static void end() { + GL11.glDisable(GL11.GL_SCISSOR_TEST); + } +} \ No newline at end of file diff --git a/src/main/java/me/shedaniel/rei/MixinStart.java b/src/main/java/me/shedaniel/rei/MixinStart.java index 071725212..880f8b7cc 100644 --- a/src/main/java/me/shedaniel/rei/MixinStart.java +++ b/src/main/java/me/shedaniel/rei/MixinStart.java @@ -5,9 +5,11 @@ import org.spongepowered.asm.launch.MixinBootstrap; import org.spongepowered.asm.mixin.Mixins; public class MixinStart implements InitializationListener { + @Override public void onInitialization() { MixinBootstrap.init(); Mixins.addConfiguration("roughlyenoughitems.client.json"); } + } diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsClient.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsClient.java new file mode 100644 index 000000000..8d80b659e --- /dev/null +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsClient.java @@ -0,0 +1,75 @@ +package me.shedaniel.rei; + +import com.google.common.collect.Maps; +import me.shedaniel.rei.api.ConfigManager; +import me.shedaniel.rei.api.Identifier; +import me.shedaniel.rei.api.PluginDisabler; +import me.shedaniel.rei.api.REIPluginEntry; +import me.shedaniel.rei.client.ConfigManagerImpl; +import me.shedaniel.rei.client.PluginDisablerImpl; +import me.shedaniel.rei.plugin.DefaultAutoCraftingPlugin; +import me.shedaniel.rei.plugin.DefaultPlugin; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.dimdev.riftloader.RiftLoader; +import org.dimdev.riftloader.listener.InitializationListener; + +import java.lang.reflect.InvocationTargetException; +import java.util.Map; + +public class RoughlyEnoughItemsClient implements InitializationListener { + + public static final Logger LOGGER = LogManager.getFormatterLogger("REI"); + static final Map plugins = Maps.newHashMap(); + private static final PluginDisabler PLUGIN_DISABLER = new PluginDisablerImpl(); + private static final ConfigManager configManager = new ConfigManagerImpl(); + + public static PluginDisabler getPluginDisabler() { + return PLUGIN_DISABLER; + } + + public static ConfigManager getConfigManager() { + return configManager; + } + + /** + * Registers a REI plugin + * + * @param identifier the identifier of the plugin + * @param plugin the plugin instance + * @return the plugin itself + * @deprecated Check REI wiki + */ + @Deprecated + public static REIPluginEntry registerPlugin(REIPluginEntry plugin) { + plugins.put(plugin.getPluginIdentifier(), plugin); + LOGGER.info("[REI] Registered plugin %s from %s", plugin.getPluginIdentifier().toString(), plugin.getClass().getSimpleName()); + plugin.onFirstLoad(getPluginDisabler()); + return plugin; + } + + @Override + public void onInitialization() { + DefaultPlugin defaultPlugin = new DefaultPlugin(); + registerPlugin(defaultPlugin); + DefaultAutoCraftingPlugin defaultAutoCraftingPlugin = new DefaultAutoCraftingPlugin(); + registerPlugin(defaultAutoCraftingPlugin); + LOGGER.warn("[REI] Plugins are NOT loaded automatically in the Rift version of REI!"); + if (RiftLoader.instance.getMods().stream().map(modInfo -> modInfo.id).anyMatch(s -> s.equalsIgnoreCase("riftmodlist"))) { + try { + Class.forName("me.shedaniel.api.ConfigRegistry").getDeclaredMethod("registerConfig",String.class,Runnable.class).invoke(null, "roughlyenoughitems", new Runnable() { + @Override + public void run() { + try { + Class.forName("me.shedaniel.rei.utils.ClothScreenRegistry").getDeclaredMethod("openConfigScreen").invoke(null); + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(); + } + } + }); + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(); + } + } + } +} diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index c1548d2ce..66b7ace35 100644 --- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -1,83 +1,56 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + package me.shedaniel.rei; -import com.google.common.collect.Maps; import me.shedaniel.rei.api.*; -import me.shedaniel.rei.client.ConfigManager; +import me.shedaniel.rei.client.DisplayHelperImpl; import me.shedaniel.rei.client.ItemRegistryImpl; -import me.shedaniel.rei.client.PluginDisablerImpl; import me.shedaniel.rei.client.RecipeHelperImpl; -import me.shedaniel.rei.plugin.DefaultPlugin; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.dimdev.riftloader.RiftLoader; -import org.dimdev.riftloader.listener.InitializationListener; -import java.lang.reflect.InvocationTargetException; import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.Optional; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; -public class RoughlyEnoughItemsCore implements InitializationListener { +public class RoughlyEnoughItemsCore { - public static final Logger LOGGER = LogManager.getFormatterLogger("REI"); - public static final Identifier DELETE_ITEMS_PACKET = new Identifier("roughlyenoughitems", "delete_item"); - public static final Identifier CREATE_ITEMS_PACKET = new Identifier("roughlyenoughitems", "create_item"); + public static final Logger LOGGER; + public static final ExecutorService SYNC_RECIPES = Executors.newSingleThreadScheduledExecutor(r -> new Thread(r, "REI-SyncRecipes")); private static final RecipeHelper RECIPE_HELPER = new RecipeHelperImpl(); - private static final PluginDisabler PLUGIN_DISABLER = new PluginDisablerImpl(); private static final ItemRegistry ITEM_REGISTRY = new ItemRegistryImpl(); - private static final Map plugins = Maps.newHashMap(); - private static ConfigManager configManager; + private static final DisplayHelper DISPLAY_HELPER = new DisplayHelperImpl(); - public static RecipeHelper getRecipeHelper() { - return RECIPE_HELPER; + static { + LOGGER = LogManager.getFormatterLogger("REI"); } - public static me.shedaniel.rei.api.ConfigManager getConfigManager() { - return configManager; + public static RecipeHelper getRecipeHelper() { + return RECIPE_HELPER; } public static ItemRegistry getItemRegisterer() { return ITEM_REGISTRY; } - public static PluginDisabler getPluginDisabler() { - return PLUGIN_DISABLER; + public static DisplayHelper getDisplayHelper() { + return DISPLAY_HELPER; } - public static REIPlugin registerPlugin(Identifier identifier, REIPlugin plugin) { - plugins.put(identifier, plugin); - RoughlyEnoughItemsCore.LOGGER.info("[REI] Registered plugin %s from %s", identifier.toString(), plugin.getClass().getSimpleName()); - plugin.onFirstLoad(getPluginDisabler()); - return plugin; + public static List getPlugins() { + return new LinkedList<>(RoughlyEnoughItemsClient.plugins.values()); } - public static List getPlugins() { - return new LinkedList<>(plugins.values()); - } - - public static Optional getPluginIdentifier(REIPlugin plugin) { - for(Identifier identifier : plugins.keySet()) - if (identifier != null && plugins.get(identifier).equals(plugin)) + public static Optional getPluginIdentifier(REIPluginEntry plugin) { + for(Identifier identifier : RoughlyEnoughItemsClient.plugins.keySet()) + if (identifier != null && RoughlyEnoughItemsClient.plugins.get(identifier).equals(plugin)) return Optional.of(identifier); return Optional.empty(); } - @Override - public void onInitialization() { - configManager = new ConfigManager(); - - // TODO: Load 3rd party mods - RoughlyEnoughItemsCore.LOGGER.warn("[REI] REI Addons need to be registered themselves! An automatic way might come in the future."); - registerPlugin(new Identifier("roughlyenoughitems", "default_plugin"), new DefaultPlugin()); - - if (RiftLoader.instance.getMods().stream().map(modInfo -> modInfo.id).anyMatch(s -> s.equalsIgnoreCase("riftmodlist"))) { - try { - Class.forName("me.shedaniel.rei.utils.RiftModListRegistry").getDeclaredMethod("register").invoke(null); - } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); - } - } - } - } diff --git a/src/main/java/me/shedaniel/rei/api/AbstractInventoryScreenHooks.java b/src/main/java/me/shedaniel/rei/api/AbstractInventoryScreenHooks.java new file mode 100644 index 000000000..8384c90af --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/AbstractInventoryScreenHooks.java @@ -0,0 +1,16 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + +package me.shedaniel.rei.api; + +import net.minecraft.client.renderer.InventoryEffectRenderer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +public interface AbstractInventoryScreenHooks { + + boolean rei_doesOffsetGuiForEffects(); + +} diff --git a/src/main/java/me/shedaniel/rei/api/AutoCraftingHandler.java b/src/main/java/me/shedaniel/rei/api/AutoCraftingHandler.java new file mode 100644 index 000000000..e858af9b2 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/AutoCraftingHandler.java @@ -0,0 +1,25 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + +package me.shedaniel.rei.api; + +import me.shedaniel.rei.gui.ContainerScreenOverlay; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; + +import java.util.function.Supplier; + +public interface AutoCraftingHandler { + + default double getPriority() { + return 0d; + } + + boolean handle(Supplier displaySupplier, Minecraft minecraft, GuiScreen recipeViewingScreen, GuiContainer parentScreen, ContainerScreenOverlay overlay); + + boolean canHandle(Supplier displaySupplier, Minecraft minecraft, GuiScreen recipeViewingScreen, GuiContainer parentScreen, ContainerScreenOverlay overlay); + +} diff --git a/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java new file mode 100644 index 000000000..c6fcbc902 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java @@ -0,0 +1,32 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + +package me.shedaniel.rei.api; + +import net.minecraft.client.gui.GuiScreen; + +import java.awt.*; +import java.util.List; +import java.util.function.Function; + +public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler { + /** + * Gets the exclusion zones by the screen class + * + * @param currentScreenClass the current screen class + * @param isOnRightSide whether the user has set the overlay to the right + * @return the list of exclusion zones + */ + List getCurrentExclusionZones(Class currentScreenClass, boolean isOnRightSide); + + /** + * Register an exclusion zone + * + * @param screenClass the screen + * @param supplier the exclusion zone supplier, isOnRightSide -> the list of exclusion zones + */ + void registerExclusionZones(Class screenClass, Function> supplier); + +} diff --git a/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java b/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java index 07125643c..01cdff416 100644 --- a/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java +++ b/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java @@ -1,11 +1,27 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + package me.shedaniel.rei.api; import java.awt.*; public interface ButtonAreaSupplier { + /** + * Declares the button bounds + * + * @param bounds the bounds of the recipe display + * @return the bounds of the button + */ Rectangle get(Rectangle bounds); + /** + * Declares the button text + * + * @return the text of the button + */ default String getButtonText() { return "+"; } diff --git a/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/src/main/java/me/shedaniel/rei/api/ClientHelper.java new file mode 100644 index 000000000..665be085c --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/ClientHelper.java @@ -0,0 +1,149 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + +package me.shedaniel.rei.api; + +import me.shedaniel.rei.client.ClientHelperImpl; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import java.util.List; +import java.util.Map; + +public interface ClientHelper { + /** + * @return the api instance of {@link ClientHelperImpl} + */ + static ClientHelper getInstance() { + return ClientHelperImpl.instance; + } + + /** + * Checks if cheating is enabled + * + * @return whether cheating is enabled + */ + boolean isCheating(); + + /** + * Sets current cheating mode + * Should save the config in {@link ConfigManager}. + * + * @param cheating the new cheating mode + */ + void setCheating(boolean cheating); + + List getInventoryItemsTypes(); + + /** + * Opens a recipe viewing screen: + * Opens {@link me.shedaniel.rei.gui.PreRecipeViewingScreen} if not set + * Opens {@link me.shedaniel.rei.gui.RecipeViewingScreen} if set to default + * Opens {@link me.shedaniel.rei.gui.VillagerRecipeViewingScreen} if set to villager + * + * @param map the map of recipes + */ + void openRecipeViewingScreen(Map, List> map); + + /** + * Tries to cheat items using either packets or commands. + * + * @param stack the stack to cheat in + * @return whether it failed + */ + boolean tryCheatingStack(ItemStack stack); + + /** + * Finds recipe for the item and opens the recipe screen. + * + * @param stack the stack to find recipe for + * @return whether the stack has any recipes to show + */ + boolean executeRecipeKeyBind(ItemStack stack); + + /** + * Finds usage for the item and opens the recipe screen. + * + * @param stack the stack to find usage for + * @return whether the stack has any usages to show + */ + boolean executeUsageKeyBind(ItemStack stack); + + KeyBinding getFocusSearchFieldKeyBinding(); + + /** + * Gets the mod from an item + * + * @param item the item to find + * @return the mod name + */ + String getModFromItem(Item item); + + /** + * Tries to delete the player's cursor item + */ + void sendDeletePacket(); + + /** + * Gets the formatted mod from an item + * + * @param item the item to find + * @return the mod name with blue and italic formatting + */ + String getFormattedModFromItem(Item item); + + /** + * Gets the formatted mod from an identifier + * + * @param identifier the identifier to find + * @return the mod name with blue and italic formatting + */ + String getFormattedModFromIdentifier(Identifier identifier); + + /** + * Gets the mod from an identifier + * + * @param identifier the identifier to find + * @return the mod name + */ + String getModFromIdentifier(Identifier identifier); + + /** + * @return the recipe keybind, defaulted R + */ + KeyBinding getRecipeKeyBinding(); + + /** + * @return the usage keybind, defaulted U + */ + KeyBinding getUsageKeyBinding(); + + /** + * @return the hide keybind, defaulted O + */ + KeyBinding getHideKeyBinding(); + + /** + * @return the previous page keybind, defaulted not set + */ + KeyBinding getPreviousPageKeyBinding(); + + /** + * @return the next page keybind, defaulted not set + */ + KeyBinding getNextPageKeyBinding(); + + /** + * Finds all recipes and open them in a recipe screen. + * + * @return whether there are any recipes to show + */ + boolean executeViewAllRecipesKeyBind(); + + boolean executeViewAllRecipesFromCategory(Identifier category); + + boolean executeViewAllRecipesFromCategories(List categories); +} diff --git a/src/main/java/me/shedaniel/rei/api/ConfigManager.java b/src/main/java/me/shedaniel/rei/api/ConfigManager.java index 2e951f103..2654bac2b 100644 --- a/src/main/java/me/shedaniel/rei/api/ConfigManager.java +++ b/src/main/java/me/shedaniel/rei/api/ConfigManager.java @@ -1,3 +1,8 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + package me.shedaniel.rei.api; import me.shedaniel.rei.client.ConfigObject; @@ -6,14 +11,37 @@ import java.io.IOException; public interface ConfigManager { + /** + * Saves the config. + * + * @throws IOException when error + */ void saveConfig() throws IOException; + /** + * Loads the config from the json file, creates the file if not found. + * + * @throws IOException when error + */ void loadConfig() throws IOException; + /** + * Gets the config instance + * + * @return the config instance + */ ConfigObject getConfig(); + /** + * Gets if craftable only filter is enabled + * + * @return whether craftable only filter is enabled + */ boolean isCraftableOnlyEnabled(); + /** + * Toggles the craftable only filter + */ void toggleCraftableOnly(); } diff --git a/src/main/java/me/shedaniel/rei/api/ContainerScreenHooks.java b/src/main/java/me/shedaniel/rei/api/ContainerScreenHooks.java new file mode 100644 index 000000000..e681090a6 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/ContainerScreenHooks.java @@ -0,0 +1,25 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + +package me.shedaniel.rei.api; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.Slot; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +public interface ContainerScreenHooks { + + int rei_getContainerLeft(); + + int rei_getContainerTop(); + + int rei_getContainerWidth(); + + int rei_getContainerHeight(); + + Slot rei_getHoveredSlot(); + +} diff --git a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java new file mode 100644 index 000000000..e1e25cd20 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java @@ -0,0 +1,139 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + +package me.shedaniel.rei.api; + +import me.shedaniel.rei.RoughlyEnoughItemsClient; +import net.minecraft.util.EnumActionResult; + +import java.awt.*; +import java.util.List; + +import static net.minecraft.util.EnumActionResult.PASS; + +public interface DisplayHelper { + + /** + * Gets the sorted version of all responsible bounds handlers + * + * @param screenClass the class for checking responsible bounds handlers + * @return the sorted list of responsible bounds handlers + * @see DisplayHelper#getResponsibleBoundsHandler(Class) for the unsorted version + */ + List> getSortedBoundsHandlers(Class screenClass); + + /** + * Gets all registered bounds handlers + * + * @return the list of registered bounds handlers + */ + List> getAllBoundsHandlers(); + + /** + * Gets all responsible bounds handlers + * + * @param screenClass the class for checking responsible bounds handlers + * @return the the list of responsible bounds handlers + * @see DisplayHelper#getSortedBoundsHandlers(Class) for the sorted version + */ + DisplayBoundsHandler getResponsibleBoundsHandler(Class screenClass); + + /** + * Registers a bounds handler + * + * @param handler the handler to register + */ + void registerBoundsHandler(DisplayBoundsHandler handler); + + /** + * Gets the base bounds handler api for exclusion zones + * + * @return the base bounds handler + */ + BaseBoundsHandler getBaseBoundsHandler(); + + public static interface DisplayBoundsHandler { + /** + * Gets the base supported class for the bounds handler + * + * @return the base class + */ + Class getBaseSupportedClass(); + + /** + * Gets the left bounds of the overlay + * + * @param screen the current screen + * @return the left bounds + */ + Rectangle getLeftBounds(T screen); + + /** + * Gets the right bounds of the overlay + * + * @param screen the current screen + * @return the right bounds + */ + Rectangle getRightBounds(T screen); + + /** + * Checks if item slot can fit the screen + * + * @param isOnRightSide whether the user has set the overlay to the right + * @param left the left x coordinates of the stack + * @param top the top y coordinates for the stack + * @param screen the current screen + * @param fullBounds the current bounds + * @return whether the item slot can fit + * @see BaseBoundsHandler#registerExclusionZones(Class, BaseBoundsHandler.ExclusionZoneSupplier) for easier api + */ + default EnumActionResult canItemSlotWidgetFit(boolean isOnRightSide, int left, int top, T screen, Rectangle fullBounds) { + return PASS; + } + + /** + * Checks if mouse is inside the overlay + * + * @param isOnRightSide whether the user has set the overlay to the right + * @param mouseX mouse's x coordinates + * @param mouseY mouse's y coordinates + * @return whether mouse is inside the overlay + */ + default EnumActionResult isInZone(boolean isOnRightSide, double mouseX, double mouseY) { + return PASS; + } + + /** + * Gets the item list bounds by the overlay bounds + * + * @param rectangle the overlay bounds + * @return the item list bounds + */ + default Rectangle getItemListArea(Rectangle rectangle) { + return new Rectangle(rectangle.x + 2, rectangle.y + 24, rectangle.width - 4, rectangle.height - (RoughlyEnoughItemsClient.getConfigManager().getConfig().sideSearchField ? 27 + 22 : 27)); + } + + /** + * Checks if REI should recalculate the overlay bounds + * + * @param isOnRightSide whether the user has set the overlay to the right + * @param rectangle the current overlay bounds + * @return whether REI should recalculate the overlay bounds + */ + default boolean shouldRecalculateArea(boolean isOnRightSide, Rectangle rectangle) { + return false; + } + + /** + * Gets the priority of the handler, the higher it is, the earlier it is called. + * + * @return the priority in float + */ + default float getPriority() { + return 0f; + } + } + +} diff --git a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java b/src/main/java/me/shedaniel/rei/api/DisplaySettings.java deleted file mode 100644 index 334d6cc6f..000000000 --- a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java +++ /dev/null @@ -1,15 +0,0 @@ -package me.shedaniel.rei.api; - -public interface DisplaySettings { - - int getDisplayHeight(RecipeCategory category); - - int getDisplayWidth(RecipeCategory category, T display); - - int getMaximumRecipePerPage(RecipeCategory category); - - default int getFixedRecipesPerPage() { - return -1; - } - -} diff --git a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java new file mode 100644 index 000000000..086928864 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java @@ -0,0 +1,33 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + +package me.shedaniel.rei.api; + +import net.minecraft.util.EnumActionResult; + +public interface DisplayVisibilityHandler { + + /** + * Gets the priority of the handler + * + * @return the priority + */ + default float getPriority() { + return 0f; + } + + /** + * Handles the visibility of the display. + * {@link EnumActionResult#PASS} to pass the handling to another handler + * {@link EnumActionResult#SUCCESS} to always display it + * {@link EnumActionResult#FAIL} to never display it + * + * @param category the category of the display + * @param display the display of the recipe + * @return the visibility + */ + EnumActionResult handleDisplay(RecipeCategory category, RecipeDisplay display); + +} diff --git a/src/main/java/me/shedaniel/rei/api/GuiEventHandlerHooks.java b/src/main/java/me/shedaniel/rei/api/GuiEventHandlerHooks.java new file mode 100644 index 000000000..b691a87fc --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/GuiEventHandlerHooks.java @@ -0,0 +1,11 @@ +package me.shedaniel.rei.api; + +import net.minecraft.client.gui.IGuiEventListener; + +public interface GuiEventHandlerHooks { + + void rei_setFocused(IGuiEventListener listener); + + void rei_setDragging(boolean dragging); + +} diff --git a/src/main/java/me/shedaniel/rei/api/GuiTextFieldHooks.java b/src/main/java/me/shedaniel/rei/api/GuiTextFieldHooks.java new file mode 100644 index 000000000..61b819d76 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/GuiTextFieldHooks.java @@ -0,0 +1,7 @@ +package me.shedaniel.rei.api; + +public interface GuiTextFieldHooks { + + void rei_setWidth(int width); + +} diff --git a/src/main/java/me/shedaniel/rei/api/Identifier.java b/src/main/java/me/shedaniel/rei/api/Identifier.java index 0096237a5..f731301ca 100644 --- a/src/main/java/me/shedaniel/rei/api/Identifier.java +++ b/src/main/java/me/shedaniel/rei/api/Identifier.java @@ -5,6 +5,8 @@ import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import net.minecraft.util.JsonUtils; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.ResourceLocationException; import net.minecraft.util.text.TextComponentTranslation; import javax.annotation.Nullable; @@ -22,11 +24,11 @@ public class Identifier implements Comparable { if (!this.namespace.chars().allMatch((p_195825_0_) -> { return p_195825_0_ == 95 || p_195825_0_ == 45 || p_195825_0_ >= 97 && p_195825_0_ <= 122 || p_195825_0_ >= 48 && p_195825_0_ <= 57 || p_195825_0_ == 46; })) { - throw new IdentifierException("Non [a-z0-9_.-] character in namespace of location: " + this.namespace + ':' + this.path); + throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + this.namespace + ':' + this.path); } else if (!this.path.chars().allMatch((p_195827_0_) -> { return p_195827_0_ == 95 || p_195827_0_ == 45 || p_195827_0_ >= 97 && p_195827_0_ <= 122 || p_195827_0_ >= 48 && p_195827_0_ <= 57 || p_195827_0_ == 47 || p_195827_0_ == 46; })) { - throw new IdentifierException("Non [a-z0-9/._-] character in path of location: " + this.namespace + ':' + this.path); + throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + this.namespace + ':' + this.path); } } @@ -34,8 +36,8 @@ public class Identifier implements Comparable { this(decompose(resourceName, ':')); } - public Identifier(String namespace, String path) { - this(new String[]{namespace, path}); + public Identifier(String namespaceIn, String pathIn) { + this(new String[]{namespaceIn, pathIn}); } public static Identifier of(String p_195828_0_, char p_195828_1_) { @@ -43,10 +45,10 @@ public class Identifier implements Comparable { } @Nullable - public static Identifier makeIdentifier(String string) { + public static Identifier makeResourceLocation(String string) { try { return new Identifier(string); - } catch (IdentifierException var2) { + } catch (ResourceLocationException var2) { return null; } } @@ -77,7 +79,7 @@ public class Identifier implements Comparable { try { return new Identifier(s); - } catch (IdentifierException var4) { + } catch (ResourceLocationException var4) { reader.setCursor(i); throw field_200118_c.createWithContext(reader); } @@ -125,7 +127,8 @@ public class Identifier implements Comparable { } public static class Serializer implements JsonDeserializer, JsonSerializer { - public Identifier deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException { + public Identifier deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) + throws JsonParseException { return new Identifier(JsonUtils.getString(p_deserialize_1_, "location")); } @@ -133,14 +136,4 @@ public class Identifier implements Comparable { return new JsonPrimitive(p_serialize_1_.toString()); } } - - public static class IdentifierException extends RuntimeException { - public IdentifierException(String p_i48222_1_) { - super(p_i48222_1_); - } - - public IdentifierException(String p_i49530_1_, Throwable p_i49530_2_) { - super(p_i49530_1_, p_i49530_2_); - } - } } diff --git a/src/main/java/me/shedaniel/rei/api/Identifiers.java b/src/main/java/me/shedaniel/rei/api/Identifiers.java new file mode 100644 index 000000000..6d05cd1a0 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/Identifiers.java @@ -0,0 +1,15 @@ +package me.shedaniel.rei.api; + +import net.minecraft.util.ResourceLocation; + +public class Identifiers { + + public static Identifier of(ResourceLocation location) { + return new Identifier(location.toString()); + } + + public static ResourceLocation of(Identifier identifier) { + return new ResourceLocation(identifier.toString()); + } + +} diff --git a/src/main/java/me/shedaniel/rei/api/ItemRegistry.java b/src/main/java/me/shedaniel/rei/api/ItemRegistry.java index fa6d8f6e6..2dbd806b5 100644 --- a/src/main/java/me/shedaniel/rei/api/ItemRegistry.java +++ b/src/main/java/me/shedaniel/rei/api/ItemRegistry.java @@ -1,3 +1,8 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + package me.shedaniel.rei.api; import net.minecraft.item.Item; @@ -7,27 +12,66 @@ import java.util.List; public interface ItemRegistry { + /** + * Gets the current unmodifiable item list + * + * @return an unmodifiable item list + */ List getItemList(); + /** + * Gets the current modifiable item list + * + * @return an modifiable item list + */ @Deprecated List getModifiableItemList(); + /** + * Gets all possible stacks from an item + * + * @param item the item to find + * @return the array of possible stacks + */ ItemStack[] getAllStacksFromItem(Item item); + /** + * Registers an new stack to the item list + * + * @param afterItem the stack to put after + * @param stack the stack to register + */ void registerItemStack(Item afterItem, ItemStack stack); + /** + * Registers multiple stacks to the item list + * + * @param afterItem the stack to put after + * @param stacks the stacks to register + */ default void registerItemStack(Item afterItem, ItemStack... stacks) { for(ItemStack stack : stacks) if (stack != null && !stack.isEmpty()) registerItemStack(afterItem, stack); } + /** + * Registers multiple stacks to the item list + * + * @param stacks the stacks to register + */ default void registerItemStack(ItemStack... stacks) { for(ItemStack stack : stacks) if (stack != null && !stack.isEmpty()) registerItemStack(null, stack); } + /** + * Checks if a stack is already registered + * + * @param stack the stack to check + * @return whether the stack has been registered + */ default boolean alreadyContain(ItemStack stack) { return getItemList().stream().anyMatch(stack1 -> ItemStack.areItemStacksEqual(stack, stack1)); } diff --git a/src/main/java/me/shedaniel/rei/api/KeyBindingHooks.java b/src/main/java/me/shedaniel/rei/api/KeyBindingHooks.java new file mode 100644 index 000000000..435a242ed --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/KeyBindingHooks.java @@ -0,0 +1,11 @@ +package me.shedaniel.rei.api; + +public interface KeyBindingHooks { + + public boolean rei_addCategory(String keyBindingCategory, int id); + + public boolean rei_addCategory(String keyBindingCategory); + + public boolean rei_hasCategory(String keyCategory); + +} \ No newline at end of file diff --git a/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java b/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java new file mode 100644 index 000000000..bc1ab739a --- /dev/null +++ b/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java @@ -0,0 +1,21 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + +package me.shedaniel.rei.api; + +import net.minecraft.item.ItemStack; + +import java.util.List; +import java.util.Optional; + +public interface LiveRecipeGenerator { + + Identifier getCategoryIdentifier(); + + Optional> getRecipeFor(ItemStack stack); + + Optional> getUsageFor(ItemStack stack); + +} diff --git a/src/main/java/me/shedaniel/rei/api/PluginDisabler.java b/src/main/java/me/shedaniel/rei/api/PluginDisabler.java index 410ea8b70..d1f7ea314 100644 --- a/src/main/java/me/shedaniel/rei/api/PluginDisabler.java +++ b/src/main/java/me/shedaniel/rei/api/PluginDisabler.java @@ -1,21 +1,57 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + package me.shedaniel.rei.api; public interface PluginDisabler { + /