From 23c820ea583052744232e84a6c99114223c43a69 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Thu, 25 Mar 2021 02:50:16 +0800 Subject: Refactor MenuInfo, split client and server apis, new dual PluginManager system, remove @NotNull Signed-off-by: shedaniel --- .../java/me/shedaniel/rei/api/ClientHelper.java | 168 ---------- .../main/java/me/shedaniel/rei/api/REIHelper.java | 80 ----- .../main/java/me/shedaniel/rei/api/REIOverlay.java | 39 --- .../me/shedaniel/rei/api/client/ClientHelper.java | 168 ++++++++++ .../me/shedaniel/rei/api/client/REIHelper.java | 81 +++++ .../me/shedaniel/rei/api/client/REIOverlay.java | 39 +++ .../rei/api/client/config/ConfigManager.java | 79 +++++ .../rei/api/client/config/ConfigObject.java | 180 +++++++++++ .../rei/api/client/favorites/FavoriteEntry.java | 105 +++++++ .../api/client/favorites/FavoriteEntryType.java | 76 +++++ .../api/client/favorites/FavoriteMenuEntry.java | 46 +++ .../rei/api/client/favorites/package-info.java | 27 ++ .../client/gui/AbstractContainerEventHandler.java | 59 ++++ .../rei/api/client/gui/AbstractRenderer.java | 38 +++ .../rei/api/client/gui/DisplayRenderer.java | 43 +++ .../rei/api/client/gui/DrawableConsumer.java | 34 ++ .../me/shedaniel/rei/api/client/gui/Renderer.java | 43 +++ .../rei/api/client/gui/SimpleDisplayRenderer.java | 152 +++++++++ .../rei/api/client/gui/config/AppearanceTheme.java | 42 +++ .../client/gui/config/ConfigButtonPosition.java | 42 +++ .../client/gui/config/DisplayPanelLocation.java | 47 +++ .../api/client/gui/config/DisplayScreenType.java | 44 +++ .../api/client/gui/config/EntryPanelOrdering.java | 40 +++ .../gui/config/EntryPanelOrderingConfig.java | 64 ++++ .../api/client/gui/config/ItemCheatingMode.java | 41 +++ .../api/client/gui/config/ItemCheatingStyle.java | 42 +++ .../api/client/gui/config/RecipeBorderType.java | 62 ++++ .../api/client/gui/config/SearchFieldLocation.java | 42 +++ .../rei/api/client/gui/config/SearchMode.java | 43 +++ .../client/gui/config/SyntaxHighlightingMode.java | 43 +++ .../rei/api/client/gui/drag/DraggableStack.java | 40 +++ .../client/gui/drag/DraggableStackProvider.java | 44 +++ .../api/client/gui/drag/DraggableStackVisitor.java | 46 +++ .../rei/api/client/gui/drag/DraggingContext.java | 73 +++++ .../rei/api/client/gui/widgets/Arrow.java | 82 +++++ .../rei/api/client/gui/widgets/BaseWidget.java | 50 +++ .../rei/api/client/gui/widgets/BurningFire.java | 82 +++++ .../rei/api/client/gui/widgets/Button.java | 188 ++++++++++++ .../rei/api/client/gui/widgets/DelegateWidget.java | 88 ++++++ .../rei/api/client/gui/widgets/Label.java | 289 +++++++++++++++++ .../rei/api/client/gui/widgets/Panel.java | 70 +++++ .../shedaniel/rei/api/client/gui/widgets/Slot.java | 147 +++++++++ .../rei/api/client/gui/widgets/TextField.java | 60 ++++ .../rei/api/client/gui/widgets/Tooltip.java | 64 ++++ .../rei/api/client/gui/widgets/Widget.java | 82 +++++ .../api/client/gui/widgets/WidgetWithBounds.java | 35 +++ .../rei/api/client/gui/widgets/Widgets.java | 304 ++++++++++++++++++ .../entry/renderer/AbstractEntryRenderer.java | 29 ++ .../entry/renderer/BatchEntryRenderer.java | 61 ++++ .../ingredient/entry/renderer/EntryRenderer.java | 49 +++ .../entry/type/BuiltinClientEntryTypes.java | 36 +++ .../ingredient/util/ClientEntryIngredients.java | 35 +++ .../client/ingredient/util/ClientEntryStacks.java | 40 +++ .../rei/api/client/plugins/REIClientPlugin.java | 109 +++++++ .../api/client/registry/category/ButtonArea.java | 53 ++++ .../client/registry/category/CategoryRegistry.java | 174 +++++++++++ .../client/registry/display/DisplayCategory.java | 126 ++++++++ .../client/registry/display/DisplayRegistry.java | 159 ++++++++++ .../registry/display/LiveDisplayGenerator.java | 45 +++ .../registry/display/TransferDisplayCategory.java | 40 +++ .../visibility/DisplayVisibilityPredicate.java | 57 ++++ .../api/client/registry/entry/EntryRegistry.java | 157 ++++++++++ .../rei/api/client/registry/screen/ClickArea.java | 68 ++++ .../registry/screen/DisplayBoundsProvider.java | 34 ++ .../api/client/registry/screen/ExclusionZones.java | 55 ++++ .../registry/screen/ExclusionZonesProvider.java | 33 ++ .../registry/screen/FocusedStackProvider.java | 46 +++ .../api/client/registry/screen/OverlayDecider.java | 75 +++++ .../api/client/registry/screen/ScreenRegistry.java | 159 ++++++++++ .../client/registry/screen/SimpleClickArea.java | 44 +++ .../client/registry/transfer/TransferHandler.java | 296 ++++++++++++++++++ .../registry/transfer/TransferHandlerRegistry.java | 36 +++ .../rei/api/client/search/SearchFilter.java | 65 ++++ .../rei/api/client/search/SearchProvider.java | 43 +++ .../rei/api/client/subsets/SubsetsRegistry.java | 64 ++++ .../rei/api/client/view/ViewSearchBuilder.java | 81 +++++ .../me/shedaniel/rei/api/client/view/Views.java | 75 +++++ .../api/common/category/CategoryIdentifier.java | 53 ++++ .../shedaniel/rei/api/common/display/Display.java | 68 ++++ .../rei/api/common/display/DisplaySerializer.java | 41 +++ .../common/display/DisplaySerializerRegistry.java | 69 +++++ .../common/display/SimpleDisplaySerializer.java | 39 +++ .../rei/api/common/display/SimpleMenuDisplay.java | 30 ++ .../rei/api/common/display/basic/BasicDisplay.java | 172 +++++++++++ .../rei/api/common/fluid/FluidSupportProvider.java | 54 ++++ .../rei/api/common/ingredient/EntryIngredient.java | 64 ++++ .../rei/api/common/ingredient/EntryStack.java | 228 ++++++++++++++ .../common/ingredient/entry/EntrySerializer.java | 42 +++ .../entry/comparison/ComparisonContext.java | 49 +++ .../entry/comparison/ItemComparator.java | 67 ++++ .../entry/comparison/ItemComparatorRegistry.java | 63 ++++ .../ingredient/entry/type/BuiltinEntryTypes.java | 35 +++ .../ingredient/entry/type/EntryDefinition.java | 71 +++++ .../common/ingredient/entry/type/EntryType.java | 44 +++ .../ingredient/entry/type/EntryTypeBridge.java | 35 +++ .../ingredient/entry/type/EntryTypeRegistry.java | 99 ++++++ .../ingredient/entry/type/VanillaEntryTypes.java | 35 +++ .../common/ingredient/util/EntryIngredients.java | 173 +++++++++++ .../api/common/ingredient/util/EntryStacks.java | 207 +++++++++++++ .../rei/api/common/plugins/PluginManager.java | 76 +++++ .../rei/api/common/plugins/PluginView.java | 63 ++++ .../rei/api/common/plugins/REIPlugin.java | 99 ++++++ .../rei/api/common/plugins/REIPluginProvider.java | 37 +++ .../rei/api/common/plugins/REIServerPlugin.java | 33 ++ .../rei/api/common/registry/ParentReloadable.java | 48 +++ .../api/common/registry/RecipeManagerContext.java | 63 ++++ .../rei/api/common/registry/Reloadable.java | 49 +++ .../rei/api/common/transfer/RecipeFinder.java | 340 ++++++++++++++++++++ .../api/common/transfer/RecipeFinderPopulator.java | 33 ++ .../rei/api/common/transfer/info/MenuInfo.java | 93 ++++++ .../api/common/transfer/info/MenuInfoContext.java | 39 +++ .../api/common/transfer/info/MenuInfoRegistry.java | 44 +++ .../transfer/info/MenuSerializationContext.java | 45 +++ .../transfer/info/MenuTransferException.java | 43 +++ .../transfer/info/clean/InputCleanHandler.java | 60 ++++ .../common/transfer/info/simple/DumpHandler.java | 59 ++++ .../transfer/info/simple/SimpleGridMenuInfo.java | 69 +++++ .../info/simple/SimplePlayerInventoryMenuInfo.java | 87 ++++++ .../info/stack/ContainerStackAccessor.java | 55 ++++ .../transfer/info/stack/SlotStackAccessor.java | 53 ++++ .../common/transfer/info/stack/StackAccessor.java | 44 +++ .../rei/api/common/util/CollectionUtils.java | 324 ++++++++++++++++++++ .../rei/api/common/util/FormattingUtils.java | 50 +++ .../rei/api/common/util/Identifiable.java | 38 +++ .../api/common/util/ImmutableTextComponent.java | 107 +++++++ .../rei/api/common/util/TextRepresentable.java | 39 +++ .../me/shedaniel/rei/api/config/ConfigManager.java | 80 ----- .../me/shedaniel/rei/api/config/ConfigObject.java | 178 ----------- .../shedaniel/rei/api/favorites/FavoriteEntry.java | 110 ------- .../rei/api/favorites/FavoriteEntryType.java | 76 ----- .../rei/api/favorites/FavoriteMenuEntry.java | 46 --- .../shedaniel/rei/api/favorites/package-info.java | 27 -- .../rei/api/fluid/FluidSupportProvider.java | 56 ---- .../rei/api/gui/AbstractContainerEventHandler.java | 36 --- .../me/shedaniel/rei/api/gui/AbstractRenderer.java | 38 --- .../me/shedaniel/rei/api/gui/DisplayRenderer.java | 43 --- .../me/shedaniel/rei/api/gui/DrawableConsumer.java | 35 --- .../java/me/shedaniel/rei/api/gui/Renderer.java | 43 --- .../rei/api/gui/SimpleDisplayRenderer.java | 152 --------- .../rei/api/gui/config/AppearanceTheme.java | 44 --- .../rei/api/gui/config/ConfigButtonPosition.java | 44 --- .../rei/api/gui/config/DisplayPanelLocation.java | 49 --- .../rei/api/gui/config/DisplayScreenType.java | 44 --- .../rei/api/gui/config/EntryPanelOrdering.java | 40 --- .../api/gui/config/EntryPanelOrderingConfig.java | 64 ---- .../rei/api/gui/config/ItemCheatingMode.java | 41 --- .../rei/api/gui/config/ItemCheatingStyle.java | 44 --- .../rei/api/gui/config/RecipeBorderType.java | 62 ---- .../rei/api/gui/config/SearchFieldLocation.java | 42 --- .../shedaniel/rei/api/gui/config/SearchMode.java | 44 --- .../rei/api/gui/config/SyntaxHighlightingMode.java | 43 --- .../shedaniel/rei/api/gui/drag/DraggableStack.java | 40 --- .../rei/api/gui/drag/DraggableStackProvider.java | 44 --- .../rei/api/gui/drag/DraggableStackVisitor.java | 46 --- .../rei/api/gui/drag/DraggingContext.java | 73 ----- .../me/shedaniel/rei/api/gui/widgets/Arrow.java | 87 ------ .../shedaniel/rei/api/gui/widgets/BaseWidget.java | 52 ---- .../shedaniel/rei/api/gui/widgets/BurningFire.java | 87 ------ .../me/shedaniel/rei/api/gui/widgets/Button.java | 186 ----------- .../rei/api/gui/widgets/DelegateWidget.java | 89 ------ .../me/shedaniel/rei/api/gui/widgets/Label.java | 323 ------------------- .../me/shedaniel/rei/api/gui/widgets/Panel.java | 77 ----- .../me/shedaniel/rei/api/gui/widgets/Slot.java | 167 ---------- .../shedaniel/rei/api/gui/widgets/TextField.java | 60 ---- .../me/shedaniel/rei/api/gui/widgets/Tooltip.java | 69 ----- .../me/shedaniel/rei/api/gui/widgets/Widget.java | 82 ----- .../rei/api/gui/widgets/WidgetWithBounds.java | 35 --- .../me/shedaniel/rei/api/gui/widgets/Widgets.java | 324 -------------------- .../rei/api/ingredient/EntryIngredient.java | 51 --- .../shedaniel/rei/api/ingredient/EntryStack.java | 206 ------------- .../rei/api/ingredient/entry/EntrySerializer.java | 37 --- .../entry/comparison/ComparisonContext.java | 49 --- .../entry/comparison/ItemComparator.java | 67 ---- .../entry/comparison/ItemComparatorRegistry.java | 62 ---- .../entry/renderer/AbstractEntryRenderer.java | 29 -- .../entry/renderer/BatchEntryRenderer.java | 61 ---- .../ingredient/entry/renderer/EntryRenderer.java | 49 --- .../ingredient/entry/type/BuiltinEntryTypes.java | 39 --- .../api/ingredient/entry/type/EntryDefinition.java | 68 ---- .../rei/api/ingredient/entry/type/EntryType.java | 48 --- .../api/ingredient/entry/type/EntryTypeBridge.java | 36 --- .../ingredient/entry/type/EntryTypeRegistry.java | 98 ------ .../ingredient/entry/type/VanillaEntryTypes.java | 35 --- .../rei/api/ingredient/util/EntryIngredients.java | 157 ---------- .../rei/api/ingredient/util/EntryStacks.java | 213 ------------- .../shedaniel/rei/api/plugins/BuiltinPlugin.java | 70 ----- .../shedaniel/rei/api/plugins/PluginManager.java | 55 ---- .../me/shedaniel/rei/api/plugins/REIPlugin.java | 164 ---------- .../shedaniel/rei/api/registry/DisplayerQuery.java | 27 -- .../rei/api/registry/ParentReloadable.java | 46 --- .../rei/api/registry/RecipeManagerContext.java | 43 --- .../me/shedaniel/rei/api/registry/Reloadable.java | 49 --- .../rei/api/registry/category/ButtonArea.java | 53 ---- .../api/registry/category/CategoryRegistry.java | 157 ---------- .../rei/api/registry/display/Display.java | 67 ---- .../rei/api/registry/display/DisplayCategory.java | 116 ------- .../rei/api/registry/display/DisplayRegistry.java | 159 ---------- .../api/registry/display/LiveDisplayGenerator.java | 45 --- .../rei/api/registry/display/TransferDisplay.java | 45 --- .../registry/display/TransferDisplayCategory.java | 37 --- .../visibility/DisplayVisibilityPredicate.java | 58 ---- .../rei/api/registry/entry/EntryRegistry.java | 156 ---------- .../rei/api/registry/screen/ClickArea.java | 68 ---- .../api/registry/screen/DisplayBoundsProvider.java | 34 -- .../rei/api/registry/screen/ExclusionZones.java | 55 ---- .../registry/screen/ExclusionZonesProvider.java | 10 - .../api/registry/screen/FocusedStackProvider.java | 48 --- .../rei/api/registry/screen/OverlayDecider.java | 76 ----- .../rei/api/registry/screen/ScreenRegistry.java | 159 ---------- .../rei/api/registry/screen/SimpleClickArea.java | 46 --- .../rei/api/registry/transfer/TransferHandler.java | 297 ------------------ .../registry/transfer/TransferHandlerRegistry.java | 35 --- .../me/shedaniel/rei/api/search/SearchFilter.java | 42 --- .../shedaniel/rei/api/search/SearchProvider.java | 19 -- .../shedaniel/rei/api/server/ContainerContext.java | 39 --- .../me/shedaniel/rei/api/server/ContainerInfo.java | 118 ------- .../rei/api/server/ContainerInfoHandler.java | 56 ---- .../me/shedaniel/rei/api/server/DumpHandler.java | 58 ---- .../shedaniel/rei/api/server/GridCleanHandler.java | 50 --- .../rei/api/server/GridStacksProvider.java | 31 -- .../rei/api/server/InventoryStackAccessor.java | 52 ---- .../me/shedaniel/rei/api/server/RecipeFinder.java | 341 --------------------- .../rei/api/server/RecipeFinderPopulator.java | 35 --- .../rei/api/server/RecipeGridAligner.java | 44 --- .../rei/api/server/SlotStackAccessor.java | 50 --- .../me/shedaniel/rei/api/server/StackAccessor.java | 34 -- .../shedaniel/rei/api/subsets/SubsetsRegistry.java | 63 ---- .../me/shedaniel/rei/api/util/CollectionUtils.java | 316 ------------------- .../me/shedaniel/rei/api/util/FormattingUtils.java | 48 --- .../me/shedaniel/rei/api/util/Identifiable.java | 35 --- .../rei/api/util/ImmutableLiteralText.java | 98 ------ .../shedaniel/rei/api/util/TextRepresentable.java | 42 --- .../shedaniel/rei/api/view/ViewSearchBuilder.java | 84 ----- .../main/java/me/shedaniel/rei/api/view/Views.java | 73 ----- .../me/shedaniel/rei/impl/ClientInternals.java | 160 ++++++++++ .../main/java/me/shedaniel/rei/impl/Internals.java | 134 ++------ 236 files changed, 9820 insertions(+), 8929 deletions(-) delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ClientHelper.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/REIHelper.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/REIOverlay.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/ClientHelper.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/REIHelper.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/REIOverlay.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/config/ConfigManager.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteMenuEntry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/favorites/package-info.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/AbstractContainerEventHandler.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/AbstractRenderer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/DisplayRenderer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/DrawableConsumer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/Renderer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/SimpleDisplayRenderer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/AppearanceTheme.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/ConfigButtonPosition.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/DisplayPanelLocation.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/DisplayScreenType.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/EntryPanelOrdering.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/EntryPanelOrderingConfig.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/ItemCheatingMode.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/ItemCheatingStyle.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/RecipeBorderType.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/SearchFieldLocation.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/SearchMode.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/config/SyntaxHighlightingMode.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStack.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackProvider.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggableStackVisitor.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/drag/DraggingContext.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Arrow.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/BaseWidget.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/BurningFire.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Button.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/DelegateWidget.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Label.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Panel.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Slot.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/TextField.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Tooltip.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/WidgetWithBounds.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widgets.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/ingredient/entry/renderer/AbstractEntryRenderer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/ingredient/entry/renderer/BatchEntryRenderer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/ingredient/entry/renderer/EntryRenderer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/ingredient/entry/type/BuiltinClientEntryTypes.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/ingredient/util/ClientEntryIngredients.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/ingredient/util/ClientEntryStacks.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/plugins/REIClientPlugin.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/category/ButtonArea.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/category/CategoryRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/display/DisplayCategory.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/display/DisplayRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/display/LiveDisplayGenerator.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/display/TransferDisplayCategory.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/display/visibility/DisplayVisibilityPredicate.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/entry/EntryRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/screen/ClickArea.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/screen/DisplayBoundsProvider.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/screen/ExclusionZones.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/screen/ExclusionZonesProvider.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/screen/FocusedStackProvider.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/screen/OverlayDecider.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/screen/ScreenRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/screen/SimpleClickArea.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandlerRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/search/SearchFilter.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/search/SearchProvider.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/subsets/SubsetsRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/view/ViewSearchBuilder.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/client/view/Views.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/category/CategoryIdentifier.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/display/Display.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/display/DisplaySerializer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/display/DisplaySerializerRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/display/SimpleDisplaySerializer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/display/SimpleMenuDisplay.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/display/basic/BasicDisplay.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/fluid/FluidSupportProvider.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/EntryIngredient.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/EntryStack.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/EntrySerializer.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/comparison/ComparisonContext.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/comparison/ItemComparator.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/comparison/ItemComparatorRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/type/BuiltinEntryTypes.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/type/EntryDefinition.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/type/EntryType.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/type/EntryTypeBridge.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/type/EntryTypeRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/entry/type/VanillaEntryTypes.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/util/EntryIngredients.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/ingredient/util/EntryStacks.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/plugins/PluginManager.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/plugins/PluginView.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPlugin.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/plugins/REIPluginProvider.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/plugins/REIServerPlugin.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/registry/ParentReloadable.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/registry/RecipeManagerContext.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/registry/Reloadable.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/RecipeFinder.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/RecipeFinderPopulator.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfo.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfoContext.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfoRegistry.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuSerializationContext.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuTransferException.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/clean/InputCleanHandler.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/simple/DumpHandler.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/simple/SimpleGridMenuInfo.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/simple/SimplePlayerInventoryMenuInfo.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/stack/ContainerStackAccessor.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/stack/SlotStackAccessor.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/transfer/info/stack/StackAccessor.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/util/CollectionUtils.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/util/FormattingUtils.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/util/Identifiable.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/util/ImmutableTextComponent.java create mode 100644 api/src/main/java/me/shedaniel/rei/api/common/util/TextRepresentable.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/config/ConfigManager.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/config/ConfigObject.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/favorites/FavoriteEntry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/favorites/FavoriteEntryType.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/favorites/FavoriteMenuEntry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/favorites/package-info.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/fluid/FluidSupportProvider.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/AbstractContainerEventHandler.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/AbstractRenderer.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/DisplayRenderer.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/DrawableConsumer.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/Renderer.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/SimpleDisplayRenderer.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/AppearanceTheme.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/ConfigButtonPosition.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/DisplayPanelLocation.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/DisplayScreenType.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/EntryPanelOrdering.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/EntryPanelOrderingConfig.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/ItemCheatingMode.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/ItemCheatingStyle.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/RecipeBorderType.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/SearchFieldLocation.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/SearchMode.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/config/SyntaxHighlightingMode.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStack.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackProvider.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackVisitor.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggingContext.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/Arrow.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/BaseWidget.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/BurningFire.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/Button.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/DelegateWidget.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/Label.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/Panel.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/Slot.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/TextField.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/Tooltip.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widget.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/WidgetWithBounds.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/gui/widgets/Widgets.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/EntryIngredient.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/EntryStack.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/EntrySerializer.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/comparison/ComparisonContext.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/comparison/ItemComparator.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/comparison/ItemComparatorRegistry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/renderer/AbstractEntryRenderer.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/renderer/BatchEntryRenderer.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/renderer/EntryRenderer.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/type/BuiltinEntryTypes.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/type/EntryDefinition.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/type/EntryType.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/type/EntryTypeBridge.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/type/EntryTypeRegistry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/entry/type/VanillaEntryTypes.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/util/EntryIngredients.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/ingredient/util/EntryStacks.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/plugins/BuiltinPlugin.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/plugins/PluginManager.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/plugins/REIPlugin.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/DisplayerQuery.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/ParentReloadable.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/RecipeManagerContext.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/Reloadable.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/category/ButtonArea.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/category/CategoryRegistry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/display/Display.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/display/DisplayCategory.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/display/DisplayRegistry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/display/LiveDisplayGenerator.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/display/TransferDisplay.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/display/TransferDisplayCategory.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/display/visibility/DisplayVisibilityPredicate.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/entry/EntryRegistry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/screen/ClickArea.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/screen/DisplayBoundsProvider.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/screen/ExclusionZones.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/screen/ExclusionZonesProvider.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/screen/FocusedStackProvider.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/screen/OverlayDecider.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/screen/ScreenRegistry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/screen/SimpleClickArea.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/transfer/TransferHandler.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/registry/transfer/TransferHandlerRegistry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/search/SearchFilter.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/search/SearchProvider.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/ContainerContext.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/ContainerInfo.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/ContainerInfoHandler.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/DumpHandler.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/GridCleanHandler.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/GridStacksProvider.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/InventoryStackAccessor.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/RecipeFinder.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/RecipeFinderPopulator.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/RecipeGridAligner.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/SlotStackAccessor.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/server/StackAccessor.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/subsets/SubsetsRegistry.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/util/CollectionUtils.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/util/FormattingUtils.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/util/Identifiable.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/util/ImmutableLiteralText.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/util/TextRepresentable.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/view/ViewSearchBuilder.java delete mode 100644 api/src/main/java/me/shedaniel/rei/api/view/Views.java create mode 100644 api/src/main/java/me/shedaniel/rei/impl/ClientInternals.java (limited to 'api/src/main/java/me') diff --git a/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java deleted file mode 100644 index 1250d381a..000000000 --- a/api/src/main/java/me/shedaniel/rei/api/ClientHelper.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020 shedaniel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package me.shedaniel.rei.api; - -import me.shedaniel.rei.api.config.ConfigManager; -import me.shedaniel.rei.api.ingredient.EntryStack; -import me.shedaniel.rei.api.util.FormattingUtils; -import me.shedaniel.rei.api.view.ViewSearchBuilder; -import me.shedaniel.rei.impl.Internals; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.ChatFormatting; -import net.minecraft.client.gui.chat.NarratorChatListener; -import net.minecraft.core.Registry; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; - -import java.util.List; - -@Environment(EnvType.CLIENT) -public interface ClientHelper { - /** - * @return the instance of {@link me.shedaniel.rei.api.ClientHelper} - */ - static ClientHelper getInstance() { - return Internals.getClientHelper(); - } - - /** - * Returns whether cheating is enabled - * - * @return whether cheating is enabled - */ - boolean isCheating(); - - /** - * Sets current cheating mode - * Automatically calls {@link ConfigManager#saveConfig()}. - * - * @param cheating the new cheating mode - */ - void setCheating(boolean cheating); - - /** - * Tries to cheat stack using either packets or commands. - * - * @param stack the stack to cheat in - * @return whether it failed - */ - boolean tryCheatingEntry(EntryStack stack); - - /** - * Gets the mod from an item - * - * @param item the item to find - * @return the mod name - */ - default String getModFromItem(Item item) { - if (item.equals(Items.AIR)) - return ""; - return getModFromIdentifier(Registry.ITEM.getKey(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 - */ - default Component getFormattedModFromItem(Item item) { - String mod = getModFromItem(item); - if (mod.isEmpty()) - return NarratorChatListener.NO_TITLE; - return new TextComponent(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); - } - - /** - * Gets the formatted mod from an identifier - * - * @param identifier the identifier to find - * @return the mod name with blue and italic formatting - */ - default Component getFormattedModFromIdentifier(ResourceLocation identifier) { - String mod = getModFromIdentifier(identifier); - if (mod.isEmpty()) - return NarratorChatListener.NO_TITLE; - return new TextComponent(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); - } - - /** - * Gets the mod from a modid - * - * @param modid the modid of the mod - * @return the mod name with blue and italic formatting - */ - default Component getFormattedModFromModId(String modid) { - String mod = getModFromModId(modid); - if (mod.isEmpty()) - return NarratorChatListener.NO_TITLE; - return new TextComponent(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); - } - - default List appendModIdToTooltips(List components, String modId) { - final String modName = ClientHelper.getInstance().getModFromModId(modId); - boolean alreadyHasMod = false; - for (Component s : components) - if (FormattingUtils.stripFormatting(s.getString()).equalsIgnoreCase(modName)) { - alreadyHasMod = true; - break; - } - if (!alreadyHasMod) - components.add(ClientHelper.getInstance().getFormattedModFromModId(modId)); - return components; - } - - /** - * Gets the mod from an identifier - * - * @param identifier the identifier to find - * @return the mod name - */ - default String getModFromIdentifier(ResourceLocation identifier) { - if (identifier == null) - return ""; - return getModFromModId(identifier.getNamespace()); - } - - /** - * Gets the mod from a modid - * - * @param modId the modid of the mod - * @return the mod name - */ - String getModFromModId(String modId); - - boolean openView(ViewSearchBuilder builder); - - boolean canUseMovePackets(); -} diff --git a/api/src/main/java/me/shedaniel/rei/api/REIHelper.java b/api/src/main/java/me/shedaniel/rei/api/REIHelper.java deleted file mode 100644 index 2911dab04..000000000 --- a/api/src/main/java/me/shedaniel/rei/api/REIHelper.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020 shedaniel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package me.shedaniel.rei.api; - -import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.gui.config.SearchFieldLocation; -import me.shedaniel.rei.api.gui.widgets.TextField; -import me.shedaniel.rei.api.gui.widgets.Tooltip; -import me.shedaniel.rei.api.plugins.PluginManager; -import me.shedaniel.rei.api.registry.Reloadable; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; -import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; - -@Environment(EnvType.CLIENT) -public interface REIHelper extends Reloadable { - /** - * @return the instance of {@link REIHelper} - */ - static REIHelper getInstance() { - return PluginManager.getInstance().get(REIHelper.class); - } - - boolean isOverlayVisible(); - - void toggleOverlayVisible(); - - default Optional getOverlay() { - return getOverlay(false); - } - - Optional getOverlay(boolean reset); - - @Nullable - AbstractContainerScreen getPreviousContainerScreen(); - - @Nullable - Screen getPreviousScreen(); - - boolean isDarkThemeEnabled(); - - @Nullable - TextField getSearchTextField(); - - void queueTooltip(@Nullable Tooltip tooltip); - - ResourceLocation getDefaultDisplayTexture(); - - SearchFieldLocation getContextualSearchFieldLocation(); - - Rectangle calculateEntryListArea(); - - Rectangle calculateFavoritesListArea(); -} diff --git a/api/src/main/java/me/shedaniel/rei/api/REIOverlay.java b/api/src/main/java/me/shedaniel/rei/api/REIOverlay.java deleted file mode 100644 index fd1f2dbea..000000000 --- a/api/src/main/java/me/shedaniel/rei/api/REIOverlay.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020 shedaniel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package me.shedaniel.rei.api; - -import me.shedaniel.rei.api.gui.drag.DraggingContext; -import me.shedaniel.rei.api.gui.widgets.WidgetWithBounds; -import org.jetbrains.annotations.ApiStatus; - -public abstract class REIOverlay extends WidgetWithBounds { - @ApiStatus.Internal - public abstract void closeOverlayMenu(); - - public abstract void queueReloadOverlay(); - - public abstract DraggingContext getDraggingContext(); - - public abstract boolean isNotInExclusionZones(double mouseX, double mouseY); -} diff --git a/api/src/main/java/me/shedaniel/rei/api/client/ClientHelper.java b/api/src/main/java/me/shedaniel/rei/api/client/ClientHelper.java new file mode 100644 index 000000000..4193fbc22 --- /dev/null +++ b/api/src/main/java/me/shedaniel/rei/api/client/ClientHelper.java @@ -0,0 +1,168 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.shedaniel.rei.api.client; + +import me.shedaniel.rei.api.client.config.ConfigManager; +import me.shedaniel.rei.api.client.view.ViewSearchBuilder; +import me.shedaniel.rei.api.common.ingredient.EntryStack; +import me.shedaniel.rei.api.common.util.FormattingUtils; +import me.shedaniel.rei.impl.ClientInternals; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.chat.NarratorChatListener; +import net.minecraft.core.Registry; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; + +import java.util.List; + +@Environment(EnvType.CLIENT) +public interface ClientHelper { + /** + * @return the instance of {@link ClientHelper} + */ + static ClientHelper getInstance() { + return ClientInternals.getClientHelper(); + } + + /** + * Returns whether cheating is enabled + * + * @return whether cheating is enabled + */ + boolean isCheating(); + + /** + * Sets current cheating mode + * Automatically calls {@link ConfigManager#saveConfig()}. + * + * @param cheating the new cheating mode + */ + void setCheating(boolean cheating); + + /** + * Tries to cheat stack using either packets or commands. + * + * @param stack the stack to cheat in + * @return whether it failed + */ + boolean tryCheatingEntry(EntryStack stack); + + /** + * Gets the mod from an item + * + * @param item the item to find + * @return the mod name + */ + default String getModFromItem(Item item) { + if (item.equals(Items.AIR)) + return ""; + return getModFromIdentifier(Registry.ITEM.getKey(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 + */ + default Component getFormattedModFromItem(Item item) { + String mod = getModFromItem(item); + if (mod.isEmpty()) + return NarratorChatListener.NO_TITLE; + return new TextComponent(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); + } + + /** + * Gets the formatted mod from an identifier + * + * @param identifier the identifier to find + * @return the mod name with blue and italic formatting + */ + default Component getFormattedModFromIdentifier(ResourceLocation identifier) { + String mod = getModFromIdentifier(identifier); + if (mod.isEmpty()) + return NarratorChatListener.NO_TITLE; + return new TextComponent(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); + } + + /** + * Gets the mod from a modid + * + * @param modid the modid of the mod + * @return the mod name with blue and italic formatting + */ + default Component getFormattedModFromModId(String modid) { + String mod = getModFromModId(modid); + if (mod.isEmpty()) + return NarratorChatListener.NO_TITLE; + return new TextComponent(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); + } + + default List appendModIdToTooltips(List components, String modId) { + final String modName = ClientHelper.getInstance().getModFromModId(modId); + boolean alreadyHasMod = false; + for (Component s : components) + if (FormattingUtils.stripFormatting(s.getString()).equalsIgnoreCase(modName)) { + alreadyHasMod = true; + break; + } + if (!alreadyHasMod) + components.add(ClientHelper.getInstance().getFormattedModFromModId(modId)); + return components; + } + + /** + * Gets the mod from an identifier + * + * @param identifier the identifier to find + * @return the mod name + */ + default String getModFromIdentifier(ResourceLocation identifier) { + if (identifier == null) + return ""; + return getModFromModId(identifier.getNamespace()); + } + + /** + * Gets the mod from a modid + * + * @param modId the modid of the mod + * @return the mod name + */ + String getModFromModId(String modId); + + boolean openView(ViewSearchBuilder builder); + + boolean canUseMovePackets(); +} diff --git a/api/src/main/java/me/shedaniel/rei/api/client/REIHelper.java b/api/src/main/java/me/shedaniel/rei/api/client/REIHelper.java new file mode 100644 index 000000000..9cc776a55 --- /dev/null +++ b/api/src/main/java/me/shedaniel/rei/api/client/REIHelper.java @@ -0,0 +1,81 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.shedaniel.rei.api.client; + +import me.shedaniel.math.Rectangle; +import me.shedaniel.rei.api.client.gui.config.SearchFieldLocation; +import me.shedaniel.rei.api.client.gui.widgets.TextField; +import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.plugins.REIClientPlugin; +import me.shedaniel.rei.api.common.plugins.PluginManager; +import me.shedaniel.rei.api.common.registry.Reloadable; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; + +import java.util.Optional; + +@Environment(EnvType.CLIENT) +public interface REIHelper extends Reloadable { + /** + * @return the instance of {@link REIHelper} + */ + static REIHelper getInstance() { + return PluginManager.getClientInstance().get(REIHelper.class); + } + + boolean isOverlayVisible(); + + void toggleOverlayVisible(); + + default Optional getOverlay() { + return getOverlay(false); + } + + Optional getOverlay(boolean reset); + + @Nullable + AbstractContainerScreen getPreviousContainerScreen(); + + @Nullable + Screen getPreviousScreen(); + + boolean isDarkThemeEnabled(); + + @Nullable + TextField getSearchTextField(); + + void queueTooltip(@Nullable Tooltip tooltip); + + ResourceLocation getDefaultDisplayTexture(); + + SearchFieldLocation getContextualSearchFieldLocation(); + + Rectangle calculateEntryListArea(); + + Rectangle calculateFavoritesListArea(); +} diff --git a/api/src/main/java/me/shedaniel/rei/api/client/REIOverlay.java b/api/src/main/java/me/shedaniel/rei/api/client/REIOverlay.java new file mode 100644 index 000000000..b585c2642 --- /dev/null +++ b/api/src/main/java/me/shedaniel/rei/api/client/REIOverlay.java @@ -0,0 +1,39 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.shedaniel.rei.api.client; + +import me.shedaniel.rei.api.client.gui.drag.DraggingContext; +import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; +import org.jetbrains.annotations.ApiStatus; + +public abstract class REIOverlay extends WidgetWithBounds { + @ApiStatus.Internal + public abstract void closeOverlayMenu(); + + public abstract void queueReloadOverlay(); + + public abstract DraggingContext getDraggingContext(); + + public abstract boolean isNotInExclusionZones(double mouseX, double mouseY); +} diff --git a/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigManager.java b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigManager.java new file mode 100644 index 000000000..db6baac9d --- /dev/null +++ b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigManager.java @@ -0,0 +1,79 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.shedaniel.rei.api.client.config; + +import me.shedaniel.rei.api.client.plugins.REIClientPlugin; +import me.shedaniel.rei.api.common.plugins.PluginManager; +import me.shedaniel.rei.api.common.registry.Reloadable; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; + +@Environment(EnvType.CLIENT) +public interface ConfigManager extends Reloadable { + /** + * @return the instance of {@link ConfigManager} + */ + static ConfigManager getInstance() { + return PluginManager.getClientInstance().get(ConfigManager.class); + } + + /** + * Saves the config. + */ + void saveConfig(); + + /** + * Gets if craftable only filter is enabled + * + * @return whether craftable only filter is enabled + */ + boolean isCraftableOnlyEnabled(); + + /** + * Toggles the craftable only filter + */ + void toggleCraftableOnly(); + + /** + * Opens the config screen + * + * @param parent the screen shown before + */ + default void openConfigScreen(Screen parent) { + Minecraft.getInstance().setScreen(getConfigScreen(parent)); + } + + /** + * Gets the config screen + * + * @param parent the screen shown before + * @return the config screen + */ + Screen getConfigScreen(Screen parent); + + ConfigObject getConfig(); + +} diff --git a/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java new file mode 100644 index 000000000..db654e089 --- /dev/null +++ b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java @@ -0,0 +1,180 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,