diff --git a/.gitignore b/.gitignore index c2fb66e1e33..3b2f04a46c0 100644 --- a/.gitignore +++ b/.gitignore @@ -74,6 +74,7 @@ local.properties /classes/ /out/ /build/ +.run/ # Linux *~ diff --git a/dependencies.gradle b/dependencies.gradle index 6a45ca2165f..2f7bced09b6 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -40,9 +40,10 @@ dependencies { // Published dependencies api("codechicken:codechickenlib:3.2.3.358") - api("com.cleanroommc:modularui:2.5.0-rc4") { transitive = false } + api("com.cleanroommc:modularui:3.0.3") { transitive = false } api("com.cleanroommc:groovyscript:1.2.0-hotfix1") { transitive = false } - api("curse.maven:inventory-bogosorter-632327:4951607-deobf-4951608-sources-4951609") + api("curse.maven:inventory-bogosorter-632327:7102721-deobf-6717233-sources-6717234") + api("curse.maven:key-binding-patch-928895:5951859") api("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.700") api("appeng:ae2-uel:v0.56.4") { transitive = false } api rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31 diff --git a/src/main/java/gregtech/api/cover/CoverWithUI.java b/src/main/java/gregtech/api/cover/CoverWithUI.java index 6c288e08137..8802f23fc2f 100644 --- a/src/main/java/gregtech/api/cover/CoverWithUI.java +++ b/src/main/java/gregtech/api/cover/CoverWithUI.java @@ -21,6 +21,7 @@ import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; import com.cleanroommc.modularui.screen.ModularScreen; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.utils.MouseData; @@ -65,7 +66,7 @@ default GTGuiTheme getUITheme() { } @Override - default ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { + default ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { return null; } diff --git a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java index 6633e96bb8b..f1444152f5f 100644 --- a/src/main/java/gregtech/api/items/gui/ItemUIFactory.java +++ b/src/main/java/gregtech/api/items/gui/ItemUIFactory.java @@ -13,6 +13,7 @@ import com.cleanroommc.modularui.factory.HandGuiData; import com.cleanroommc.modularui.screen.ModularPanel; import com.cleanroommc.modularui.screen.ModularScreen; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import org.jetbrains.annotations.ApiStatus; @@ -39,7 +40,7 @@ default GTGuiTheme getUITheme() { } @Override - default ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager) { + default ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { return null; } } diff --git a/src/main/java/gregtech/api/items/toolitem/IGTTool.java b/src/main/java/gregtech/api/items/toolitem/IGTTool.java index 679b22118b3..d37e8ec3643 100644 --- a/src/main/java/gregtech/api/items/toolitem/IGTTool.java +++ b/src/main/java/gregtech/api/items/toolitem/IGTTool.java @@ -72,11 +72,11 @@ import com.cleanroommc.modularui.factory.HandGuiData; import com.cleanroommc.modularui.factory.ItemGuiFactory; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.value.sync.IntSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.widgets.ButtonWidget; -import com.cleanroommc.modularui.widgets.TextWidget; import com.cleanroommc.modularui.widgets.layout.Flow; import com.enderio.core.common.interfaces.IOverlayRenderAware; import com.google.common.collect.HashMultimap; @@ -947,7 +947,7 @@ default void playSound(EntityPlayer player) { } @Override - default ModularPanel buildUI(HandGuiData guiData, PanelSyncManager manager) { + default ModularPanel buildUI(HandGuiData guiData, PanelSyncManager manager, UISettings settings) { final var usedStack = guiData.getUsedItemStack(); final var behaviorsTag = getBehaviorsTag(usedStack); final var defaultDefinition = getMaxAoEDefinition(usedStack); @@ -1006,14 +1006,15 @@ default Flow createColumn(IntSyncValue syncValue, String lang, boolean shouldDou return Flow.column() .coverChildren() - .child(new TextWidget(IKey.lang("item.gt.tool.aoe." + lang)) + .child(IKey.lang("item.gt.tool.aoe." + lang) + .asWidget() .marginBottom(5)) .child(Flow.row() .coverChildren() .marginBottom(5) .child(increaseButton) .child(decreaseButton)) - .child(new TextWidget(display) + .child(display.asWidget() .alignment(Alignment.Center) .widthRel(1f)); } diff --git a/src/main/java/gregtech/api/items/toolitem/ItemGTToolbelt.java b/src/main/java/gregtech/api/items/toolitem/ItemGTToolbelt.java index 6d28d550b2f..6f0fd069c92 100644 --- a/src/main/java/gregtech/api/items/toolitem/ItemGTToolbelt.java +++ b/src/main/java/gregtech/api/items/toolitem/ItemGTToolbelt.java @@ -51,10 +51,11 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.factory.HandGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import com.cleanroommc.modularui.widgets.slot.SlotGroup; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; @@ -106,12 +107,12 @@ public ItemStack getToolInSlot(@NotNull ItemStack toolbelt, int slot) { } @Override - public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { final var usedStack = guiData.getUsedItemStack(); final var handler = getHandler(usedStack); final var selected = handler.getSelectedStack(); if (!selected.isEmpty() && selected.getItem() instanceof ItemUIFactory factory) { - return factory.buildUI(guiData, guiSyncManager); + return factory.buildUI(guiData, guiSyncManager, settings); } int heightBonus = (handler.getSlots() / 9) * 18; diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index e4d93026f8f..e3ca9cab534 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -94,6 +94,7 @@ import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; import com.cleanroommc.modularui.screen.ModularScreen; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.google.common.base.Preconditions; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -493,7 +494,7 @@ public GTGuiTheme getUITheme() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) { return null; } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java index 1f31dce42a0..165e2ca69df 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java @@ -25,6 +25,7 @@ import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import org.jetbrains.annotations.NotNull; @@ -394,7 +395,7 @@ protected MultiblockUIFactory createUIFactory() { } @Override - public final ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { + public final ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) { if (uiFactory == null) uiFactory = createUIFactory(); return this.uiFactory.buildUI(guiData, panelSyncManager); } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java b/src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java index 495a80a8aa8..e158a76d0d0 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java @@ -247,7 +247,7 @@ public MultiblockUIFactory addScreenChildren(ScreenFunction function) { this.screenFunction.addWidgets(panel, panelSyncManager); } - var playerInv = SlotGroupWidget.playerInventory(0); + var playerInv = SlotGroupWidget.playerInventory(false); if (disableButtons) { playerInv.alignX(0.5f); } else { diff --git a/src/main/java/gregtech/api/mui/GTGuiTextures.java b/src/main/java/gregtech/api/mui/GTGuiTextures.java index d1a46722ba4..ce808aa0c18 100644 --- a/src/main/java/gregtech/api/mui/GTGuiTextures.java +++ b/src/main/java/gregtech/api/mui/GTGuiTextures.java @@ -4,11 +4,13 @@ import com.cleanroommc.modularui.api.drawable.IDrawable; import com.cleanroommc.modularui.api.drawable.IKey; +import com.cleanroommc.modularui.drawable.ColorType; import com.cleanroommc.modularui.drawable.UITexture; import com.cleanroommc.modularui.screen.viewport.GuiContext; import com.cleanroommc.modularui.theme.WidgetTheme; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * GT MUI textures.
@@ -58,11 +60,9 @@ private static String id(String path) { public static final UITexture GREGTECH_LOGO_XMAS = fullImage("textures/gui/icon/gregtech_logo_xmas.png"); public static final UITexture GREGTECH_LOGO_DARK = fullImage("textures/gui/icon/gregtech_logo_dark.png"); public static final IDrawable GREGTECH_LOGO_BLINKING_YELLOW = animated( - "textures/gui/icon/gregtech_logo_blinking_yellow.png", - 17, 34, false, 60); + "textures/gui/icon/gregtech_logo_blinking_yellow.png", 17, 34, 60); public static final IDrawable GREGTECH_LOGO_BLINKING_RED = animated( - "textures/gui/icon/gregtech_logo_blinking_red.png", - 17, 34, false, 36); + "textures/gui/icon/gregtech_logo_blinking_red.png", 17, 34, 36); public static final UITexture INDICATOR_NO_ENERGY = fullImage("textures/gui/base/indicator_no_energy.png"); public static final UITexture INDICATOR_NO_STEAM_BRONZE = fullImage( @@ -209,18 +209,18 @@ private static String id(String path) { "textures/gui/widget/hpca/damaged_computation_component.png"); public static final UITexture[] BUTTON_BLACKLIST = slice("textures/gui/widget/button_blacklist.png", - 16, 32, 16, 16, true); + 16, 32, 16, 16, ColorType.DEFAULT); public static final UITexture[] BUTTON_IGNORE_DAMAGE = slice("textures/gui/widget/button_filter_damage.png", - 16, 32, 16, 16, true); + 16, 32, 16, 16, ColorType.DEFAULT); public static final UITexture[] BUTTON_IGNORE_NBT = slice("textures/gui/widget/button_filter_nbt.png", - 16, 32, 16, 16, true); + 16, 32, 16, 16, ColorType.DEFAULT); public static final UITexture[] BUTTON_CASE_SENSITIVE = slice( "textures/gui/widget/ore_filter/button_case_sensitive.png", - 16, 32, 16, 16, true); + 16, 32, 16, 16, ColorType.DEFAULT); public static final UITexture[] BUTTON_MATCH_ALL = slice("textures/gui/widget/ore_filter/button_match_all.png", - 16, 32, 16, 16, true); + 16, 32, 16, 16, ColorType.DEFAULT); public static final UITexture BUTTON_LOCK = fullImage("textures/gui/widget/button_lock.png"); public static final UITexture OREDICT_ERROR = fullImage("textures/gui/widget/ore_filter/error.png"); @@ -235,34 +235,34 @@ private static String id(String path) { public static final IDrawable MINUS = IKey.str("-").asIcon().marginLeft(1); public static final UITexture[] MANUAL_IO_OVERLAY_IN = slice("textures/gui/overlay/manual_io_overlay_in.png", - 18, 18 * 3, 18, 18, true); + 18, 18 * 3, 18, 18, ColorType.DEFAULT); public static final UITexture[] MANUAL_IO_OVERLAY_OUT = slice("textures/gui/overlay/manual_io_overlay_out.png", - 18, 18 * 3, 18, 18, true); + 18, 18 * 3, 18, 18, ColorType.DEFAULT); public static final UITexture[] CONVEYOR_MODE_OVERLAY = slice("textures/gui/overlay/conveyor_mode_overlay.png", - 18, 18 * 2, 18, 18, true); + 18, 18 * 2, 18, 18, ColorType.DEFAULT); public static final UITexture[] TRANSFER_MODE_OVERLAY = slice("textures/gui/overlay/transfer_mode_overlay.png", - 18, 18 * 3, 18, 18, true); + 18, 18 * 3, 18, 18, ColorType.DEFAULT); public static final UITexture[] FLUID_TRANSFER_MODE_OVERLAY = slice( "textures/gui/overlay/fluid_transfer_mode_overlay.png", - 18, 18 * 3, 18, 18, true); + 18, 18 * 3, 18, 18, ColorType.DEFAULT); public static final UITexture[] DISTRIBUTION_MODE_OVERLAY = slice( "textures/gui/widget/button_distribution_mode.png", - 16, 48, 16, 16, true); + 16, 48, 16, 16, ColorType.DEFAULT); public static final UITexture[] VOIDING_MODE_OVERLAY = slice( "textures/gui/overlay/voiding_mode_overlay.png", - 16, 32, 16, 16, true); + 16, 32, 16, 16, ColorType.DEFAULT); public static final UITexture[] FILTER_MODE_OVERLAY = slice( "textures/gui/overlay/filter_mode_overlay.png", - 16, 48, 16, 16, true); + 16, 48, 16, 16, ColorType.DEFAULT); public static final UITexture[] PRIVATE_MODE_BUTTON = slice( "textures/gui/widget/button_public_private.png", - 18, 36, 18, 18, true); + 18, 36, 18, 18, ColorType.DEFAULT); public static final UITexture MENU_OVERLAY = fullImage("textures/gui/overlay/menu_overlay.png"); @@ -286,111 +286,170 @@ private static String id(String path) { // todo bronze/steel/primitive fluid slots? // SLOT OVERLAYS - public static final UITexture ATOMIC_OVERLAY_1 = fullImage("textures/gui/overlay/atomic_overlay_1.png", true); - public static final UITexture ATOMIC_OVERLAY_2 = fullImage("textures/gui/overlay/atomic_overlay_2.png", true); - public static final UITexture ARROW_INPUT_OVERLAY = fullImage("textures/gui/overlay/arrow_input_overlay.png", true); + public static final UITexture ATOMIC_OVERLAY_1 = fullImage("textures/gui/overlay/atomic_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture ATOMIC_OVERLAY_2 = fullImage("textures/gui/overlay/atomic_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture ARROW_INPUT_OVERLAY = fullImage("textures/gui/overlay/arrow_input_overlay.png", + ColorType.DEFAULT); public static final UITexture ARROW_OUTPUT_OVERLAY = fullImage("textures/gui/overlay/arrow_output_overlay.png", - true); - public static final UITexture BATTERY_OVERLAY = fullImage("textures/gui/overlay/battery_overlay.png", true); - public static final UITexture BEAKER_OVERLAY_1 = fullImage("textures/gui/overlay/beaker_overlay_1.png", true); - public static final UITexture BEAKER_OVERLAY_2 = fullImage("textures/gui/overlay/beaker_overlay_2.png", true); - public static final UITexture BEAKER_OVERLAY_3 = fullImage("textures/gui/overlay/beaker_overlay_3.png", true); - public static final UITexture BEAKER_OVERLAY_4 = fullImage("textures/gui/overlay/beaker_overlay_4.png", true); - public static final UITexture BENDER_OVERLAY = fullImage("textures/gui/overlay/bender_overlay.png", true); - public static final UITexture BOX_OVERLAY = fullImage("textures/gui/overlay/box_overlay.png", true); - public static final UITexture BOXED_OVERLAY = fullImage("textures/gui/overlay/boxed_overlay.png", true); - public static final UITexture BREWER_OVERLAY = fullImage("textures/gui/overlay/brewer_overlay.png", true); - public static final UITexture CANNER_OVERLAY = fullImage("textures/gui/overlay/canner_overlay.png", true); - public static final UITexture CHARGER_OVERLAY = fullImage("textures/gui/overlay/charger_slot_overlay.png", true); - public static final UITexture CANISTER_OVERLAY = fullImage("textures/gui/overlay/canister_overlay.png", true); + ColorType.DEFAULT); + public static final UITexture BATTERY_OVERLAY = fullImage("textures/gui/overlay/battery_overlay.png", + ColorType.DEFAULT); + public static final UITexture BEAKER_OVERLAY_1 = fullImage("textures/gui/overlay/beaker_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture BEAKER_OVERLAY_2 = fullImage("textures/gui/overlay/beaker_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture BEAKER_OVERLAY_3 = fullImage("textures/gui/overlay/beaker_overlay_3.png", + ColorType.DEFAULT); + public static final UITexture BEAKER_OVERLAY_4 = fullImage("textures/gui/overlay/beaker_overlay_4.png", + ColorType.DEFAULT); + public static final UITexture BENDER_OVERLAY = fullImage("textures/gui/overlay/bender_overlay.png", + ColorType.DEFAULT); + public static final UITexture BOX_OVERLAY = fullImage("textures/gui/overlay/box_overlay.png", ColorType.DEFAULT); + public static final UITexture BOXED_OVERLAY = fullImage("textures/gui/overlay/boxed_overlay.png", + ColorType.DEFAULT); + public static final UITexture BREWER_OVERLAY = fullImage("textures/gui/overlay/brewer_overlay.png", + ColorType.DEFAULT); + public static final UITexture CANNER_OVERLAY = fullImage("textures/gui/overlay/canner_overlay.png", + ColorType.DEFAULT); + public static final UITexture CHARGER_OVERLAY = fullImage("textures/gui/overlay/charger_slot_overlay.png", + ColorType.DEFAULT); + public static final UITexture CANISTER_OVERLAY = fullImage("textures/gui/overlay/canister_overlay.png", + ColorType.DEFAULT); public static final UITexture CANISTER_OVERLAY_BRONZE = fullImage( "textures/gui/overlay/canister_overlay_bronze.png"); public static final UITexture CANISTER_OVERLAY_STEEL = fullImage("textures/gui/overlay/canister_overlay_steel.png"); - public static final UITexture CENTRIFUGE_OVERLAY = fullImage("textures/gui/overlay/centrifuge_overlay.png", true); - public static final UITexture CIRCUIT_OVERLAY = fullImage("textures/gui/overlay/circuit_overlay.png", true); + public static final UITexture CENTRIFUGE_OVERLAY = fullImage("textures/gui/overlay/centrifuge_overlay.png", + ColorType.DEFAULT); + public static final UITexture CIRCUIT_OVERLAY = fullImage("textures/gui/overlay/circuit_overlay.png", + ColorType.DEFAULT); public static final UITexture COAL_OVERLAY_BRONZE = fullImage("textures/gui/overlay/coal_overlay_bronze.png"); public static final UITexture COAL_OVERLAY_STEEL = fullImage("textures/gui/overlay/coal_overlay_steel.png"); - public static final UITexture COMPRESSOR_OVERLAY = fullImage("textures/gui/overlay/compressor_overlay.png", true); + public static final UITexture COMPRESSOR_OVERLAY = fullImage("textures/gui/overlay/compressor_overlay.png", + ColorType.DEFAULT); public static final UITexture COMPRESSOR_OVERLAY_BRONZE = fullImage( "textures/gui/overlay/compressor_overlay_bronze.png"); public static final UITexture COMPRESSOR_OVERLAY_STEEL = fullImage( "textures/gui/overlay/compressor_overlay_steel.png"); - public static final UITexture CRACKING_OVERLAY_1 = fullImage("textures/gui/overlay/cracking_overlay_1.png", true); - public static final UITexture CRACKING_OVERLAY_2 = fullImage("textures/gui/overlay/cracking_overlay_2.png", true); - public static final UITexture CRUSHED_ORE_OVERLAY = fullImage("textures/gui/overlay/crushed_ore_overlay.png", true); + public static final UITexture CRACKING_OVERLAY_1 = fullImage("textures/gui/overlay/cracking_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture CRACKING_OVERLAY_2 = fullImage("textures/gui/overlay/cracking_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture CRUSHED_ORE_OVERLAY = fullImage("textures/gui/overlay/crushed_ore_overlay.png", + ColorType.DEFAULT); public static final UITexture CRUSHED_ORE_OVERLAY_BRONZE = fullImage( "textures/gui/overlay/crushed_ore_overlay_bronze.png"); public static final UITexture CRUSHED_ORE_OVERLAY_STEEL = fullImage( "textures/gui/overlay/crushed_ore_overlay_steel.png"); - public static final UITexture CRYSTAL_OVERLAY = fullImage("textures/gui/overlay/crystal_overlay.png", true); - public static final UITexture CUTTER_OVERLAY = fullImage("textures/gui/overlay/cutter_overlay.png", true); + public static final UITexture CRYSTAL_OVERLAY = fullImage("textures/gui/overlay/crystal_overlay.png", + ColorType.DEFAULT); + public static final UITexture CUTTER_OVERLAY = fullImage("textures/gui/overlay/cutter_overlay.png", + ColorType.DEFAULT); public static final UITexture DARK_CANISTER_OVERLAY = fullImage("textures/gui/overlay/dark_canister_overlay.png", - true); - public static final UITexture DUST_OVERLAY = fullImage("textures/gui/overlay/dust_overlay.png", true); + ColorType.DEFAULT); + public static final UITexture DUST_OVERLAY = fullImage("textures/gui/overlay/dust_overlay.png", ColorType.DEFAULT); public static final UITexture DUST_OVERLAY_BRONZE = fullImage("textures/gui/overlay/dust_overlay_bronze.png"); public static final UITexture DUST_OVERLAY_STEEL = fullImage("textures/gui/overlay/dust_overlay_steel.png"); - public static final UITexture EXTRACTOR_OVERLAY = fullImage("textures/gui/overlay/extractor_overlay.png", true); + public static final UITexture EXTRACTOR_OVERLAY = fullImage("textures/gui/overlay/extractor_overlay.png", + ColorType.DEFAULT); public static final UITexture EXTRACTOR_OVERLAY_BRONZE = fullImage( "textures/gui/overlay/extractor_overlay_bronze.png"); public static final UITexture EXTRACTOR_OVERLAY_STEEL = fullImage( "textures/gui/overlay/extractor_overlay_steel.png"); - public static final UITexture FILTER_SLOT_OVERLAY = fullImage("textures/gui/overlay/filter_slot_overlay.png", true); + public static final UITexture FILTER_SLOT_OVERLAY = fullImage("textures/gui/overlay/filter_slot_overlay.png", + ColorType.DEFAULT); public static final UITexture FILTER_SETTINGS_OVERLAY = fullImage( "textures/gui/overlay/filter_settings_overlay.png"); - public static final UITexture FURNACE_OVERLAY_1 = fullImage("textures/gui/overlay/furnace_overlay_1.png", true); - public static final UITexture FURNACE_OVERLAY_2 = fullImage("textures/gui/overlay/furnace_overlay_2.png", true); + public static final UITexture FURNACE_OVERLAY_1 = fullImage("textures/gui/overlay/furnace_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture FURNACE_OVERLAY_2 = fullImage("textures/gui/overlay/furnace_overlay_2.png", + ColorType.DEFAULT); public static final UITexture FURNACE_OVERLAY_BRONZE = fullImage("textures/gui/overlay/furnace_overlay_bronze.png"); public static final UITexture FURNACE_OVERLAY_STEEL = fullImage("textures/gui/overlay/furnace_overlay_steel.png"); - public static final UITexture HAMMER_OVERLAY = fullImage("textures/gui/overlay/hammer_overlay.png", true); + public static final UITexture HAMMER_OVERLAY = fullImage("textures/gui/overlay/hammer_overlay.png", + ColorType.DEFAULT); public static final UITexture HAMMER_OVERLAY_BRONZE = fullImage("textures/gui/overlay/hammer_overlay_bronze.png"); public static final UITexture HAMMER_OVERLAY_STEEL = fullImage("textures/gui/overlay/hammer_overlay_steel.png"); - public static final UITexture HEATING_OVERLAY_1 = fullImage("textures/gui/overlay/heating_overlay_1.png", true); - public static final UITexture HEATING_OVERLAY_2 = fullImage("textures/gui/overlay/heating_overlay_2.png", true); - public static final UITexture IMPLOSION_OVERLAY_1 = fullImage("textures/gui/overlay/implosion_overlay_1.png", true); - public static final UITexture IMPLOSION_OVERLAY_2 = fullImage("textures/gui/overlay/implosion_overlay_2.png", true); - public static final UITexture IN_SLOT_OVERLAY = fullImage("textures/gui/overlay/in_slot_overlay.png", true); + public static final UITexture HEATING_OVERLAY_1 = fullImage("textures/gui/overlay/heating_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture HEATING_OVERLAY_2 = fullImage("textures/gui/overlay/heating_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture IMPLOSION_OVERLAY_1 = fullImage("textures/gui/overlay/implosion_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture IMPLOSION_OVERLAY_2 = fullImage("textures/gui/overlay/implosion_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture IN_SLOT_OVERLAY = fullImage("textures/gui/overlay/in_slot_overlay.png", + ColorType.DEFAULT); public static final UITexture IN_SLOT_OVERLAY_BRONZE = fullImage("textures/gui/overlay/in_slot_overlay_bronze.png"); public static final UITexture IN_SLOT_OVERLAY_STEEL = fullImage("textures/gui/overlay/in_slot_overlay_steel.png"); - public static final UITexture INGOT_OVERLAY = fullImage("textures/gui/overlay/ingot_overlay.png", true); - public static final UITexture INT_CIRCUIT_OVERLAY = fullImage("textures/gui/overlay/int_circuit_overlay.png", true); - public static final UITexture LENS_OVERLAY = fullImage("textures/gui/overlay/lens_overlay.png", true); - public static final UITexture LIGHTNING_OVERLAY_1 = fullImage("textures/gui/overlay/lightning_overlay_1.png", true); - public static final UITexture LIGHTNING_OVERLAY_2 = fullImage("textures/gui/overlay/lightning_overlay_2.png", true); - public static final UITexture MOLD_OVERLAY = fullImage("textures/gui/overlay/mold_overlay.png", true); - public static final UITexture MOLECULAR_OVERLAY_1 = fullImage("textures/gui/overlay/molecular_overlay_1.png", true); - public static final UITexture MOLECULAR_OVERLAY_2 = fullImage("textures/gui/overlay/molecular_overlay_2.png", true); - public static final UITexture MOLECULAR_OVERLAY_3 = fullImage("textures/gui/overlay/molecular_overlay_3.png", true); - public static final UITexture MOLECULAR_OVERLAY_4 = fullImage("textures/gui/overlay/molecular_overlay_4.png", true); - public static final UITexture OUT_SLOT_OVERLAY = fullImage("textures/gui/overlay/out_slot_overlay.png", true); + public static final UITexture INGOT_OVERLAY = fullImage("textures/gui/overlay/ingot_overlay.png", + ColorType.DEFAULT); + public static final UITexture INT_CIRCUIT_OVERLAY = fullImage("textures/gui/overlay/int_circuit_overlay.png", + ColorType.DEFAULT); + public static final UITexture LENS_OVERLAY = fullImage("textures/gui/overlay/lens_overlay.png", ColorType.DEFAULT); + public static final UITexture LIGHTNING_OVERLAY_1 = fullImage("textures/gui/overlay/lightning_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture LIGHTNING_OVERLAY_2 = fullImage("textures/gui/overlay/lightning_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture MOLD_OVERLAY = fullImage("textures/gui/overlay/mold_overlay.png", ColorType.DEFAULT); + public static final UITexture MOLECULAR_OVERLAY_1 = fullImage("textures/gui/overlay/molecular_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture MOLECULAR_OVERLAY_2 = fullImage("textures/gui/overlay/molecular_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture MOLECULAR_OVERLAY_3 = fullImage("textures/gui/overlay/molecular_overlay_3.png", + ColorType.DEFAULT); + public static final UITexture MOLECULAR_OVERLAY_4 = fullImage("textures/gui/overlay/molecular_overlay_4.png", + ColorType.DEFAULT); + public static final UITexture OUT_SLOT_OVERLAY = fullImage("textures/gui/overlay/out_slot_overlay.png", + ColorType.DEFAULT); public static final UITexture OUT_SLOT_OVERLAY_BRONZE = fullImage( "textures/gui/overlay/out_slot_overlay_bronze.png"); public static final UITexture OUT_SLOT_OVERLAY_STEEL = fullImage("textures/gui/overlay/out_slot_overlay_steel.png"); - public static final UITexture PAPER_OVERLAY = fullImage("textures/gui/overlay/paper_overlay.png", true); + public static final UITexture PAPER_OVERLAY = fullImage("textures/gui/overlay/paper_overlay.png", + ColorType.DEFAULT); public static final UITexture PRINTED_PAPER_OVERLAY = fullImage("textures/gui/overlay/printed_paper_overlay.png", - true); - public static final UITexture PIPE_OVERLAY_2 = fullImage("textures/gui/overlay/pipe_overlay_2.png", true); - public static final UITexture PIPE_OVERLAY_1 = fullImage("textures/gui/overlay/pipe_overlay_1.png", true); - public static final UITexture PRESS_OVERLAY_1 = fullImage("textures/gui/overlay/press_overlay_1.png", true); - public static final UITexture PRESS_OVERLAY_2 = fullImage("textures/gui/overlay/press_overlay_2.png", true); - public static final UITexture PRESS_OVERLAY_3 = fullImage("textures/gui/overlay/press_overlay_3.png", true); - public static final UITexture PRESS_OVERLAY_4 = fullImage("textures/gui/overlay/press_overlay_4.png", true); - public static final UITexture SAWBLADE_OVERLAY = fullImage("textures/gui/overlay/sawblade_overlay.png", true); - public static final UITexture SOLIDIFIER_OVERLAY = fullImage("textures/gui/overlay/solidifier_overlay.png", true); - public static final UITexture STRING_SLOT_OVERLAY = fullImage("textures/gui/overlay/string_slot_overlay.png", true); - public static final UITexture TOOL_SLOT_OVERLAY = fullImage("textures/gui/overlay/tool_slot_overlay.png", true); - public static final UITexture TURBINE_OVERLAY = fullImage("textures/gui/overlay/turbine_overlay.png", true); - public static final UITexture VIAL_OVERLAY_1 = fullImage("textures/gui/overlay/vial_overlay_1.png", true); - public static final UITexture VIAL_OVERLAY_2 = fullImage("textures/gui/overlay/vial_overlay_2.png", true); - public static final UITexture WIREMILL_OVERLAY = fullImage("textures/gui/overlay/wiremill_overlay.png", true); + ColorType.DEFAULT); + public static final UITexture PIPE_OVERLAY_2 = fullImage("textures/gui/overlay/pipe_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture PIPE_OVERLAY_1 = fullImage("textures/gui/overlay/pipe_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture PRESS_OVERLAY_1 = fullImage("textures/gui/overlay/press_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture PRESS_OVERLAY_2 = fullImage("textures/gui/overlay/press_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture PRESS_OVERLAY_3 = fullImage("textures/gui/overlay/press_overlay_3.png", + ColorType.DEFAULT); + public static final UITexture PRESS_OVERLAY_4 = fullImage("textures/gui/overlay/press_overlay_4.png", + ColorType.DEFAULT); + public static final UITexture SAWBLADE_OVERLAY = fullImage("textures/gui/overlay/sawblade_overlay.png", + ColorType.DEFAULT); + public static final UITexture SOLIDIFIER_OVERLAY = fullImage("textures/gui/overlay/solidifier_overlay.png", + ColorType.DEFAULT); + public static final UITexture STRING_SLOT_OVERLAY = fullImage("textures/gui/overlay/string_slot_overlay.png", + ColorType.DEFAULT); + public static final UITexture TOOL_SLOT_OVERLAY = fullImage("textures/gui/overlay/tool_slot_overlay.png", + ColorType.DEFAULT); + public static final UITexture TURBINE_OVERLAY = fullImage("textures/gui/overlay/turbine_overlay.png", + ColorType.DEFAULT); + public static final UITexture VIAL_OVERLAY_1 = fullImage("textures/gui/overlay/vial_overlay_1.png", + ColorType.DEFAULT); + public static final UITexture VIAL_OVERLAY_2 = fullImage("textures/gui/overlay/vial_overlay_2.png", + ColorType.DEFAULT); + public static final UITexture WIREMILL_OVERLAY = fullImage("textures/gui/overlay/wiremill_overlay.png", + ColorType.DEFAULT); public static final UITexture POSITIVE_MATTER_OVERLAY = fullImage( - "textures/gui/overlay/positive_matter_overlay.png", true); + "textures/gui/overlay/positive_matter_overlay.png", ColorType.DEFAULT); public static final UITexture NEUTRAL_MATTER_OVERLAY = fullImage("textures/gui/overlay/neutral_matter_overlay.png", - true); - public static final UITexture DATA_ORB_OVERLAY = fullImage("textures/gui/overlay/data_orb_overlay.png", true); - public static final UITexture SCANNER_OVERLAY = fullImage("textures/gui/overlay/scanner_overlay.png", true); - public static final UITexture DUCT_TAPE_OVERLAY = fullImage("textures/gui/overlay/duct_tape_overlay.png", true); + ColorType.DEFAULT); + public static final UITexture DATA_ORB_OVERLAY = fullImage("textures/gui/overlay/data_orb_overlay.png", + ColorType.DEFAULT); + public static final UITexture SCANNER_OVERLAY = fullImage("textures/gui/overlay/scanner_overlay.png", + ColorType.DEFAULT); + public static final UITexture DUCT_TAPE_OVERLAY = fullImage("textures/gui/overlay/duct_tape_overlay.png", + ColorType.DEFAULT); public static final UITexture RESEARCH_STATION_OVERLAY = fullImage( - "textures/gui/overlay/research_station_overlay.png", true); + "textures/gui/overlay/research_station_overlay.png", ColorType.DEFAULT); // BUTTONS @@ -405,7 +464,7 @@ private static String id(String path) { public static final UITexture BUTTON_BRONZE = new UITexture.Builder() .location(GTValues.MODID, "textures/gui/widget/buttons.png") .imageSize(54, 36) - .uv(18, 0, 18, 18) + .xy(18, 0, 18, 18) .adaptable(2) .name(IDs.BRONZE_BUTTON) .build(); @@ -413,7 +472,7 @@ private static String id(String path) { public static final UITexture BUTTON_BRONZE_SELECTED = new UITexture.Builder() .location(GTValues.MODID, "textures/gui/widget/buttons.png") .imageSize(54, 36) - .uv(18, 18, 18, 18) + .xy(18, 18, 18, 18) .adaptable(2) .name(IDs.BRONZE_BUTTON_SELECTED) .build(); @@ -421,7 +480,7 @@ private static String id(String path) { public static final UITexture BUTTON_STEEL = new UITexture.Builder() .location(GTValues.MODID, "textures/gui/widget/buttons.png") .imageSize(54, 36) - .uv(36, 0, 18, 18) + .xy(36, 0, 18, 18) .adaptable(2) .name(IDs.STEEL_BUTTON) .build(); @@ -429,7 +488,7 @@ private static String id(String path) { public static final UITexture BUTTON_STEEL_SELECTED = new UITexture.Builder() .location(GTValues.MODID, "textures/gui/widget/buttons.png") .imageSize(54, 36) - .uv(36, 18, 18, 18) + .xy(36, 18, 18, 18) .adaptable(2) .name(IDs.STEEL_BUTTON_SELECTED) .build(); @@ -454,8 +513,9 @@ private static String id(String path) { "textures/gui/widget/button_fluid_output_overlay.png"); public static final UITexture BUTTON_AUTO_COLLAPSE = fullImage( "textures/gui/widget/button_auto_collapse_overlay.png"); - public static final UITexture BUTTON_X = fullImage("textures/gui/widget/button_x_overlay.png", true); - public static final UITexture BUTTON_CLEAR_GRID = fullImage("textures/gui/widget/button_clear_grid.png", false); + public static final UITexture BUTTON_X = fullImage("textures/gui/widget/button_x_overlay.png", ColorType.DEFAULT); + public static final UITexture BUTTON_CLEAR_GRID = fullImage("textures/gui/widget/button_clear_grid.png", + ColorType.DEFAULT); public static final UITexture BUTTON_CROSS = fullImage("textures/gui/widget/button_cross.png"); public static final UITexture BUTTON_REDSTONE_ON = fullImage("textures/gui/widget/button_redstone_on.png"); @@ -465,8 +525,8 @@ private static String id(String path) { * 0 = OFF
* 1 = ON
*/ - public static final UITexture[] BUTTON_POWER = slice("textures/gui/widget/button_power.png", - 18, 36, 18, 18, false); + public static final UITexture[] BUTTON_POWER = slice("textures/gui/widget/button_power.png", 18, 36, 18, 18, + ColorType.DEFAULT); public static final UITexture BUTTON_POWER_DETAIL = fullImage("textures/gui/widget/button_power_detail.png"); @@ -476,8 +536,8 @@ private static String id(String path) { * 2 = FLUID VOID
* 3 = VOID BOTH
**/ - public static final UITexture[] MULTIBLOCK_VOID = slice("textures/gui/widget/button_void_multiblock.png", - 18, 72, 18, 18, false); + public static final UITexture[] MULTIBLOCK_VOID = slice("textures/gui/widget/button_void_multiblock.png", 18, 72, + 18, 18, ColorType.DEFAULT); public static final UITexture OVERLAY_VOID_NONE = fullImage("textures/gui/widget/button_void_none.png"); @@ -485,104 +545,102 @@ private static String id(String path) { * 0 = DISABLED
* 1 = ENABLED
*/ - public static final UITexture[] OVERLAY_DISTINCT_BUSES = slice("textures/gui/widget/button_distinct_buses.png", - 18, 36, 18, 18, false); + public static final UITexture[] OVERLAY_DISTINCT_BUSES = slice("textures/gui/widget/button_distinct_buses.png", 18, + 36, 18, 18); - public static final UITexture OVERLAY_NO_FLEX = fullImage("textures/gui/widget/button_no_flex.png", false); - public static final UITexture BUTTON_MULTI_MAP = fullImage("textures/gui/widget/button_multi_map.png", true); - public static final UITexture BUTTON_MINER_MODES = fullImage("textures/gui/widget/button_miner_modes.png", true); - public static final UITexture BUTTON_THROTTLE_MINUS = fullImage("textures/gui/widget/button_throttle_minus.png", - true); // TODO new texture - public static final UITexture BUTTON_THROTTLE_PLUS = fullImage("textures/gui/widget/button_throttle_plus.png", - true); // TODO remove this + public static final UITexture OVERLAY_NO_FLEX = fullImage("textures/gui/widget/button_no_flex.png"); + public static final UITexture BUTTON_MULTI_MAP = fullImage("textures/gui/widget/button_multi_map.png", + ColorType.DEFAULT); + public static final UITexture BUTTON_MINER_MODES = fullImage("textures/gui/widget/button_miner_modes.png", + ColorType.DEFAULT); // PROGRESS BARS public static final UITexture PROGRESS_BAR_ARC_FURNACE = progressBar( - "textures/gui/progress_bar/progress_bar_arc_furnace.png", true); + "textures/gui/progress_bar/progress_bar_arc_furnace.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_ARROW = progressBar("textures/gui/progress_bar/progress_bar_arrow.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_ARROW_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_arrow_bronze.png"); public static final UITexture PROGRESS_BAR_ARROW_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_arrow_steel.png"); public static final UITexture PROGRESS_BAR_ARROW_MULTIPLE = progressBar( - "textures/gui/progress_bar/progress_bar_arrow_multiple.png", true); + "textures/gui/progress_bar/progress_bar_arrow_multiple.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_BATH = progressBar("textures/gui/progress_bar/progress_bar_bath.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_BENDING = progressBar( - "textures/gui/progress_bar/progress_bar_bending.png", true); + "textures/gui/progress_bar/progress_bar_bending.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_CANNER = progressBar("textures/gui/progress_bar/progress_bar_canner.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_CIRCUIT = progressBar( - "textures/gui/progress_bar/progress_bar_circuit.png", true); + "textures/gui/progress_bar/progress_bar_circuit.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_CIRCUIT_ASSEMBLER = progressBar( - "textures/gui/progress_bar/progress_bar_circuit_assembler.png", true); + "textures/gui/progress_bar/progress_bar_circuit_assembler.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_COMPRESS = progressBar( - "textures/gui/progress_bar/progress_bar_compress.png", true); + "textures/gui/progress_bar/progress_bar_compress.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_COMPRESS_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_compress_bronze.png"); public static final UITexture PROGRESS_BAR_COMPRESS_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_compress_steel.png"); public static final UITexture PROGRESS_BAR_CRACKING = progressBar( - "textures/gui/progress_bar/progress_bar_cracking.png", true); + "textures/gui/progress_bar/progress_bar_cracking.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_CRACKING_INPUT = progressBar( - "textures/gui/progress_bar/progress_bar_cracking_2.png", 21, 38, true); + "textures/gui/progress_bar/progress_bar_cracking_2.png", 21, 38, ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_CRYSTALLIZATION = progressBar( - "textures/gui/progress_bar/progress_bar_crystallization.png", true); + "textures/gui/progress_bar/progress_bar_crystallization.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_EXTRACT = progressBar( - "textures/gui/progress_bar/progress_bar_extract.png", true); + "textures/gui/progress_bar/progress_bar_extract.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_EXTRACT_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_extract_bronze.png"); public static final UITexture PROGRESS_BAR_EXTRACT_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_extract_steel.png"); public static final UITexture PROGRESS_BAR_EXTRUDER = progressBar( - "textures/gui/progress_bar/progress_bar_extruder.png", true); + "textures/gui/progress_bar/progress_bar_extruder.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_FUSION = progressBar("textures/gui/progress_bar/progress_bar_fusion.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_GAS_COLLECTOR = progressBar( - "textures/gui/progress_bar/progress_bar_gas_collector.png", true); + "textures/gui/progress_bar/progress_bar_gas_collector.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_HAMMER = progressBar("textures/gui/progress_bar/progress_bar_hammer.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_HAMMER_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_hammer_bronze.png"); public static final UITexture PROGRESS_BAR_HAMMER_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_hammer_steel.png"); public static final UITexture PROGRESS_BAR_HAMMER_BASE = fullImage( - "textures/gui/progress_bar/progress_bar_hammer_base.png", true); + "textures/gui/progress_bar/progress_bar_hammer_base.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_HAMMER_BASE_BRONZE = fullImage( "textures/gui/progress_bar/progress_bar_hammer_base_bronze.png"); public static final UITexture PROGRESS_BAR_HAMMER_BASE_STEEL = fullImage( "textures/gui/progress_bar/progress_bar_hammer_base_steel.png"); public static final UITexture PROGRESS_BAR_LATHE = progressBar("textures/gui/progress_bar/progress_bar_lathe.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_LATHE_BASE = fullImage( - "textures/gui/progress_bar/progress_bar_lathe_base.png", true); + "textures/gui/progress_bar/progress_bar_lathe_base.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_MACERATE = progressBar( - "textures/gui/progress_bar/progress_bar_macerate.png", true); + "textures/gui/progress_bar/progress_bar_macerate.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_MACERATE_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_macerate_bronze.png"); public static final UITexture PROGRESS_BAR_MACERATE_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_macerate_steel.png"); public static final UITexture PROGRESS_BAR_MAGNET = progressBar("textures/gui/progress_bar/progress_bar_magnet.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_MASS_FAB = progressBar( - "textures/gui/progress_bar/progress_bar_mass_fab.png", true); + "textures/gui/progress_bar/progress_bar_mass_fab.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_MIXER = progressBar("textures/gui/progress_bar/progress_bar_mixer.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_PACKER = progressBar("textures/gui/progress_bar/progress_bar_packer.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_RECYCLER = progressBar( - "textures/gui/progress_bar/progress_bar_recycler.png", true); + "textures/gui/progress_bar/progress_bar_recycler.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_REPLICATOR = progressBar( - "textures/gui/progress_bar/progress_bar_replicator.png", true); + "textures/gui/progress_bar/progress_bar_replicator.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_SIFT = progressBar("textures/gui/progress_bar/progress_bar_sift.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_SLICE = progressBar("textures/gui/progress_bar/progress_bar_slice.png", - true); + ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_UNPACKER = progressBar( - "textures/gui/progress_bar/progress_bar_unpacker.png", true); + "textures/gui/progress_bar/progress_bar_unpacker.png", ColorType.DEFAULT); public static final UITexture PROGRESS_BAR_WIREMILL = progressBar( - "textures/gui/progress_bar/progress_bar_wiremill.png", true); + "textures/gui/progress_bar/progress_bar_wiremill.png", ColorType.DEFAULT); // more custom progress bars // MULTIBLOCK BARS @@ -647,16 +705,21 @@ private static String id(String path) { public static void init() {/**/} private static UITexture fullImage(String path) { - return fullImage(path, false); + return fullImage(path, null); } - private static UITexture fullImage(String path, boolean canApplyTheme) { - return UITexture.fullImage(GTValues.MODID, path, canApplyTheme); + private static UITexture fullImage(String path, @Nullable ColorType colorType) { + return UITexture.fullImage(GTValues.MODID, path, colorType); + } + + @SuppressWarnings("SameParameterValue") + private static UITexture[] slice(String path, int imageWidth, int imageHeight, int sliceWidth, int sliceHeight) { + return slice(path, imageWidth, imageHeight, sliceWidth, sliceHeight, null); } @SuppressWarnings("SameParameterValue") private static UITexture[] slice(String path, int imageWidth, int imageHeight, int sliceWidth, int sliceHeight, - boolean canApplyTheme) { + @Nullable ColorType colorType) { if (imageWidth % sliceWidth != 0 || imageHeight % sliceHeight != 0) throw new IllegalArgumentException("Slice height and slice width must divide the image evenly!"); @@ -668,42 +731,51 @@ private static UITexture[] slice(String path, int imageWidth, int imageHeight, i for (int indexY = 0; indexY < countY; indexY++) { slices[(indexX * countX) + indexY] = UITexture.builder() .location(GTValues.MODID, path) - .canApplyTheme(canApplyTheme) + .colorType(colorType) .imageSize(imageWidth, imageHeight) - .uv(indexX * sliceWidth, indexY * sliceHeight, sliceWidth, sliceHeight) + .xy(indexX * sliceWidth, indexY * sliceHeight, sliceWidth, sliceHeight) .build(); } } return slices; } - private static UITexture[] slice(String path, int imageWidth, int imageHeight, boolean canApplyTheme) { + private static UITexture[] slice(String path, int imageWidth, int imageHeight) { + return slice(path, imageWidth, imageHeight, null); + } + + private static UITexture[] slice(String path, int imageWidth, int imageHeight, @Nullable ColorType colorType) { int sliceSize = Math.min(imageWidth, imageHeight); - return slice(path, imageWidth, imageHeight, sliceSize, sliceSize, canApplyTheme); + return slice(path, imageWidth, imageHeight, sliceSize, sliceSize, colorType); + } + + private static IDrawable animated(String path, int imageWidth, int imageHeight, int rate) { + return dynamic(slice(path, imageWidth, imageHeight, null), rate); } - private static IDrawable animated(String path, int imageWidth, int imageHeight, boolean canApplyTheme, int rate) { - return dynamic(slice(path, imageWidth, imageHeight, canApplyTheme), rate); + private static IDrawable animated(String path, int imageWidth, int imageHeight, @Nullable ColorType colorType, + int rate) { + return dynamic(slice(path, imageWidth, imageHeight, colorType), rate); } private static UITexture progressBar(String path) { - return progressBar(path, 20, 40, false); + return progressBar(path, 20, 40); } - private static UITexture progressBar(String path, boolean canApplyTheme) { - return progressBar(path, 20, 40, canApplyTheme); + private static UITexture progressBar(String path, @Nullable ColorType colorType) { + return progressBar(path, 20, 40, colorType); } private static UITexture progressBar(String path, int width, int height) { - return progressBar(path, width, height, false); + return progressBar(path, width, height, null); } - private static UITexture progressBar(String path, int width, int height, boolean canApplyTheme) { - UITexture.Builder builder = new UITexture.Builder() + private static UITexture progressBar(String path, int width, int height, @Nullable ColorType colorType) { + return new UITexture.Builder() .location(GTValues.MODID, path) - .imageSize(width, height); - if (canApplyTheme) builder.canApplyTheme(); - return builder.build(); + .imageSize(width, height) + .colorType(colorType) + .build(); } // todo steam logos? multi indicator blinking logos? diff --git a/src/main/java/gregtech/api/mui/GTGuis.java b/src/main/java/gregtech/api/mui/GTGuis.java index f955cd922f8..a8301981eaa 100644 --- a/src/main/java/gregtech/api/mui/GTGuis.java +++ b/src/main/java/gregtech/api/mui/GTGuis.java @@ -108,7 +108,7 @@ private PopupPanel(@NotNull String name) { child(ButtonWidget.panelCloseButton().top(5).right(5) .onMousePressed(mouseButton -> { if (mouseButton == 0 || mouseButton == 1) { - this.closeIfOpen(true); + this.closeIfOpen(); return true; } return false; diff --git a/src/main/java/gregtech/api/mui/IconAcessor.java b/src/main/java/gregtech/api/mui/IconAcessor.java deleted file mode 100644 index 2bf4218904f..00000000000 --- a/src/main/java/gregtech/api/mui/IconAcessor.java +++ /dev/null @@ -1,8 +0,0 @@ -package gregtech.api.mui; - -import com.cleanroommc.modularui.api.drawable.IDrawable; - -public interface IconAcessor { - - IDrawable gregTech$getDrawable(); -} diff --git a/src/main/java/gregtech/api/mui/drawable/GTObjectDrawable.java b/src/main/java/gregtech/api/mui/drawable/GTObjectDrawable.java index 2a562ae63b0..def024b35bf 100644 --- a/src/main/java/gregtech/api/mui/drawable/GTObjectDrawable.java +++ b/src/main/java/gregtech/api/mui/drawable/GTObjectDrawable.java @@ -11,25 +11,29 @@ import com.cleanroommc.modularui.drawable.GuiDraw; import com.cleanroommc.modularui.drawable.Icon; import com.cleanroommc.modularui.drawable.text.TextRenderer; -import com.cleanroommc.modularui.integration.jei.JeiIngredientProvider; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerIngredientProvider; import com.cleanroommc.modularui.screen.viewport.GuiContext; import com.cleanroommc.modularui.screen.viewport.ModularGuiContext; -import com.cleanroommc.modularui.theme.WidgetSlotTheme; +import com.cleanroommc.modularui.theme.SlotTheme; import com.cleanroommc.modularui.theme.WidgetTheme; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.widget.Widget; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.function.Function; +import java.util.function.Predicate; -public class GTObjectDrawable implements IDrawable, JeiIngredientProvider { +public class GTObjectDrawable implements IDrawable, RecipeViewerIngredientProvider { private static final TextRenderer renderer = new TextRenderer(); private final Object object; private final long amount; private Function, Integer> boostFunction; + @NotNull + private Predicate drawBackground = $ -> true; public GTObjectDrawable(Object object, long amount) { this.object = object; @@ -41,6 +45,10 @@ public GTObjectDrawable setBoostFunction(Function, Integ return this; } + public void setDrawBackground(@NotNull Predicate drawBackground) { + this.drawBackground = drawBackground; + } + static { renderer.setScale(0.5f); renderer.setShadow(true); @@ -62,16 +70,20 @@ public void draw(GuiContext context, int x, int y, int width, int height, Widget private void drawObject(Object object, ModularGuiContext context, int x, int y, int width, int height) { if (object instanceof ItemStack stack) { - WidgetSlotTheme theme = context.getTheme().getItemSlotTheme(); + SlotTheme theme = context.getTheme().getItemSlotTheme().getTheme(); IDrawable background = theme.getBackground(); - if (background == null) background = GTGuiTextures.SLOT; - background.draw(context, x, y, width, height, theme); - GuiDraw.drawItem(stack, x + 1, y + 1, width - 2, height - 2); + if (drawBackground.test(object)) { + if (background == null) background = GTGuiTextures.SLOT; + background.draw(context, x, y, width, height, theme); + } + GuiDraw.drawItem(stack, x + 1, y + 1, width - 2, height - 2, 100); } else if (object instanceof FluidStack stack) { - WidgetSlotTheme theme = context.getTheme().getFluidSlotTheme(); - IDrawable slot = theme.getBackground(); - if (slot == null) slot = GTGuiTextures.FLUID_SLOT; - slot.draw(context, x, y, width, height, theme); + SlotTheme theme = context.getTheme().getFluidSlotTheme().getTheme(); + IDrawable background = theme.getBackground(); + if (drawBackground.test(object)) { + if (background == null) background = GTGuiTextures.FLUID_SLOT; + background.draw(context, x, y, width, height, theme); + } GuiDraw.drawFluidTexture(stack, x + 1, y + 1, width - 2, height - 2, 0); } else if (object instanceof BoostableChanceEntryentry) { drawObject(entry.getIngredient(), context, x, y, width, height); diff --git a/src/main/java/gregtech/api/mui/widget/GhostCircuitSlotWidget.java b/src/main/java/gregtech/api/mui/widget/GhostCircuitSlotWidget.java index 5a498360404..c914a0f4f87 100644 --- a/src/main/java/gregtech/api/mui/widget/GhostCircuitSlotWidget.java +++ b/src/main/java/gregtech/api/mui/widget/GhostCircuitSlotWidget.java @@ -8,37 +8,46 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; -import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.IItemHandlerModifiable; import com.cleanroommc.modularui.api.IPanelHandler; +import com.cleanroommc.modularui.api.UpOrDown; import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.api.widget.Interactable; import com.cleanroommc.modularui.drawable.ItemDrawable; -import com.cleanroommc.modularui.screen.ModularScreen; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerIngredientProvider; import com.cleanroommc.modularui.screen.RichTooltip; +import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.MouseData; -import com.cleanroommc.modularui.value.sync.ItemSlotSH; import com.cleanroommc.modularui.value.sync.SyncHandler; import com.cleanroommc.modularui.widget.Widget; import com.cleanroommc.modularui.widgets.ButtonWidget; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.layout.Grid; -import com.cleanroommc.modularui.widgets.slot.ModularSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.IOException; -public class GhostCircuitSlotWidget extends ItemSlot { +public class GhostCircuitSlotWidget extends Widget implements Interactable, + RecipeViewerIngredientProvider { private static final int SYNC_CIRCUIT_INDEX = 10; + private static final int SYNC_SCROLL = 3; + private static final int SYNC_CLICK = 2; + private static final int SYNC_CIRCUIT = 1; + @Nullable private IPanelHandler selectorPanel; private GhostCircuitSyncHandler syncHandler; public GhostCircuitSlotWidget() { - super(); + tooltipAutoUpdate(true); tooltipBuilder(this::getCircuitSlotTooltip); + size(18); + background(GTGuiTextures.SLOT, GTGuiTextures.INT_CIRCUIT_OVERLAY); + ItemDrawable stack = new ItemDrawable(); + overlay(stack.asIcon().alignment(Alignment.Center)); + onUpdateListener(w -> stack.setItem(syncHandler.getCircuitStack())); } @Override @@ -48,30 +57,28 @@ public GhostCircuitSlotWidget() { this.getSelectorPanel().openPanel(); } else { MouseData mouseData = MouseData.create(mouseButton); - getSyncHandler().syncToServer(2, mouseData::writeToPacket); + getSyncHandler().syncToServer(SYNC_CLICK, mouseData::writeToPacket); } } return Result.SUCCESS; } @Override - public boolean onMouseScroll(ModularScreen.UpOrDown scrollDirection, int amount) { + public boolean onMouseScroll(UpOrDown scrollDirection, int amount) { if (isSelectorPanelOpen()) return true; MouseData mouseData = MouseData.create(scrollDirection.modifier); - getSyncHandler().syncToServer(3, mouseData::writeToPacket); + getSyncHandler().syncToServer(SYNC_SCROLL, mouseData::writeToPacket); return true; } @Override public boolean isValidSyncHandler(SyncHandler syncHandler) { this.syncHandler = castIfTypeElseNull(syncHandler, GhostCircuitSyncHandler.class); - if (this.syncHandler == null) return false; - return super.isValidSyncHandler(syncHandler); + return this.syncHandler != null; } - @Override - public ItemSlot slot(ModularSlot slot) { - this.syncHandler = new GhostCircuitSyncHandler(slot); + public GhostCircuitSlotWidget slot(IItemHandlerModifiable handlerModifiable, int index) { + this.syncHandler = new GhostCircuitSyncHandler(handlerModifiable, index); isValidSyncHandler(this.syncHandler); setSyncHandler(this.syncHandler); return this; @@ -89,9 +96,6 @@ protected void getCircuitSlotTooltip(@NotNull RichTooltip tooltip) { tooltip.addLine(IKey.lang("gregtech.gui.configurator_slot.tooltip", configString)); } - @Override - public void onMouseDrag(int mouseButton, long timeSinceClick) {} - @Override public boolean onMouseRelease(int mouseButton) { return true; @@ -135,13 +139,32 @@ private IPanelHandler getSelectorPanel() { return this.selectorPanel; } - private static class GhostCircuitSyncHandler extends ItemSlotSH { + @Override + public @Nullable Object getIngredient() { + return this.syncHandler.getCircuitStack(); + } - public GhostCircuitSyncHandler(ModularSlot slot) { - super(slot); + private static class GhostCircuitSyncHandler extends SyncHandler { + + private final IItemHandlerModifiable handler; + private final int index; + + public GhostCircuitSyncHandler(IItemHandlerModifiable handler, int index) { + if (!(handler instanceof GhostCircuitItemStackHandler)) { + throw new IllegalArgumentException( + "GhostCircuitSyncHandler has IItemHandler that is not GhostCircuitItemStackHandler"); + } + this.handler = handler; + this.index = index; } @Override + public void detectAndSendChanges(boolean init) { + if (init) { + syncToClient(SYNC_CIRCUIT, buffer -> buffer.writeItemStack(getCircuitStack())); + } + } + protected void phantomClick(MouseData mouseData) { if (mouseData.mouseButton == 0) { // increment on left-click @@ -155,7 +178,6 @@ protected void phantomClick(MouseData mouseData) { } } - @Override protected void phantomScroll(MouseData mouseData) { setCircuitValue(getNextCircuitValue(mouseData.mouseButton)); } @@ -164,11 +186,7 @@ private void setCircuitValue(int value) { GhostCircuitItemStackHandler handler = getGhostCircuitHandler(); if (handler.getCircuitValue() != value) { handler.setCircuitValue(value); - syncToClient(1, buf -> { - buf.writeBoolean(false); - buf.writeItemStack(handler.getStackInSlot(0)); - buf.writeBoolean(false); - }); + syncToClient(SYNC_CIRCUIT, buf -> buf.writeItemStack(getCircuitStack())); } } @@ -177,15 +195,24 @@ public int getCircuitValue() { } public ItemStack getCircuitStack() { - return getSlot().getStack(); + return this.handler.getStackInSlot(this.index); + } + + @Override + public void readOnClient(int id, PacketBuffer buf) throws IOException { + if (id == SYNC_CIRCUIT) { + this.handler.setStackInSlot(this.index, buf.readItemStack()); + } } @Override public void readOnServer(int id, PacketBuffer buf) throws IOException { if (id == SYNC_CIRCUIT_INDEX) { setCircuitValue(buf.readShort()); - } else { - super.readOnServer(id, buf); + } else if (id == SYNC_CLICK) { + phantomClick(MouseData.readPacket(buf)); + } else if (id == SYNC_SCROLL) { + phantomScroll(MouseData.readPacket(buf)); } } @@ -209,12 +236,7 @@ private int getNextCircuitValue(int delta) { } public GhostCircuitItemStackHandler getGhostCircuitHandler() { - IItemHandler handler = getSlot().getItemHandler(); - if (!(handler instanceof GhostCircuitItemStackHandler ghostHandler)) { - throw new IllegalStateException( - "GhostCircuitSyncHandler has IItemHandler that is not GhostCircuitItemStackHandler"); - } - return ghostHandler; + return (GhostCircuitItemStackHandler) this.handler; } } } diff --git a/src/main/java/gregtech/api/util/JEIUtil.java b/src/main/java/gregtech/api/util/JEIUtil.java index 08077c0a462..64729686dbf 100644 --- a/src/main/java/gregtech/api/util/JEIUtil.java +++ b/src/main/java/gregtech/api/util/JEIUtil.java @@ -1,10 +1,11 @@ package gregtech.api.util; -import net.minecraft.enchantment.EnchantmentData; +import gregtech.integration.jei.JustEnoughItemsModule; + +import net.minecraft.item.ItemStack; -import com.cleanroommc.modularui.integration.jei.JeiGhostIngredientSlot; import com.cleanroommc.modularui.integration.jei.ModularUIJeiPlugin; -import mezz.jei.Internal; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerGhostIngredientSlot; public class JEIUtil { @@ -12,18 +13,15 @@ public class JEIUtil { * Check if the player is currently hovering over a valid ingredient for this slot.
* Will always return false is JEI is not installed. */ - public static boolean hoveringOverIngredient(JeiGhostIngredientSlot jeiGhostIngredientSlot) { + public static boolean hoveringOverIngredient(RecipeViewerGhostIngredientSlot jeiGhostIngredientSlot) { if (!Mods.JustEnoughItems.isModLoaded()) return false; return ModularUIJeiPlugin.hoveringOverIngredient(jeiGhostIngredientSlot); } - public static Object getBookStackIfEnchantment(Object ingredient) { - if (ingredient instanceof EnchantmentData enchantmentData) { - return Internal.getIngredientRegistry() - .getIngredientHelper(enchantmentData) - .getCheatItemStack(enchantmentData); - } - - return ingredient; + public static ItemStack getActualStack(Object ingredient) { + if (!Mods.JustEnoughItems.isModLoaded()) return ItemStack.EMPTY; + return JustEnoughItemsModule.ingredientRegistry + .getIngredientHelper(ingredient) + .getCheatItemStack(ingredient); } } diff --git a/src/main/java/gregtech/client/utils/RenderUtil.java b/src/main/java/gregtech/client/utils/RenderUtil.java index 8b93f3f54ee..e2076c7fdd9 100644 --- a/src/main/java/gregtech/client/utils/RenderUtil.java +++ b/src/main/java/gregtech/client/utils/RenderUtil.java @@ -30,9 +30,9 @@ import com.cleanroommc.modularui.api.MCHelper; import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.drawable.GuiDraw; -import com.cleanroommc.modularui.integration.jei.JeiGhostIngredientSlot; -import com.cleanroommc.modularui.theme.WidgetSlotTheme; -import com.cleanroommc.modularui.theme.WidgetTheme; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerGhostIngredientSlot; +import com.cleanroommc.modularui.theme.SlotTheme; +import com.cleanroommc.modularui.theme.WidgetThemeEntry; import com.cleanroommc.modularui.utils.Color; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -726,33 +726,37 @@ public static void drawSlotOverlay(@NotNull IWidget slot, int overlayColor) { GlStateManager.colorMask(true, true, true, true); } - public static void drawSlotOverlay(@NotNull IWidget slot, WidgetTheme widgetTheme) { - drawSlotOverlay(slot, widgetTheme instanceof WidgetSlotTheme slotTheme ? slotTheme.getSlotHoverColor() : - defaultSlotHoverColor); + public static void drawSlotOverlay(@NotNull IWidget slot, SlotTheme theme) { + drawSlotOverlay(slot, theme.getSlotHoverColor()); } - public static void handleSlotOverlay(@NotNull IWidget slot, @NotNull WidgetTheme widgetTheme) { + public static void handleSlotOverlay(@NotNull IWidget slot, @NotNull WidgetThemeEntry themeEntry) { if (slot.isHovering()) { - drawSlotOverlay(slot, widgetTheme); + if (themeEntry.getTheme() instanceof SlotTheme slotTheme) { + drawSlotOverlay(slot, slotTheme); + } else { + drawSlotOverlay(slot, defaultSlotHoverColor); + } } } public static < - T extends IWidget & JeiGhostIngredientSlot> void drawJEIGhostSlotOverlay(@NotNull T jeiGhostIngredientSlot) { + T extends IWidget & RecipeViewerGhostIngredientSlot> void drawJEIGhostSlotOverlay(@NotNull T jeiGhostIngredientSlot) { GlStateManager.colorMask(true, true, true, false); jeiGhostIngredientSlot.drawHighlight(jeiGhostIngredientSlot.getArea(), jeiGhostIngredientSlot.isHovering()); GlStateManager.colorMask(true, true, true, true); } + @SuppressWarnings("UnusedReturnValue") public static < - T extends IWidget & JeiGhostIngredientSlot> boolean handleJEIGhostSlotOverlay(@NotNull T jeiGhostIngredientSlot, - @NotNull WidgetTheme widgetTheme) { + T extends IWidget & RecipeViewerGhostIngredientSlot> boolean handleJEIGhostSlotOverlay(@NotNull T jeiGhostIngredientSlot, + @NotNull WidgetThemeEntry themeEntry) { if (JEIUtil.hoveringOverIngredient(jeiGhostIngredientSlot)) { drawJEIGhostSlotOverlay(jeiGhostIngredientSlot); return true; } - handleSlotOverlay(jeiGhostIngredientSlot, widgetTheme); + handleSlotOverlay(jeiGhostIngredientSlot, themeEntry); return false; } } diff --git a/src/main/java/gregtech/common/covers/CoverConveyor.java b/src/main/java/gregtech/common/covers/CoverConveyor.java index b037492f993..8e10e7a0cc2 100644 --- a/src/main/java/gregtech/common/covers/CoverConveyor.java +++ b/src/main/java/gregtech/common/covers/CoverConveyor.java @@ -47,6 +47,7 @@ import com.cleanroommc.modularui.factory.GuiData; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.utils.MouseData; import com.cleanroommc.modularui.value.sync.EnumSyncValue; @@ -503,7 +504,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var panel = GTGuis.createPanel(this, 176, 192 + 18); getItemFilterContainer().setMaxTransferSize(getMaxStackSize()); diff --git a/src/main/java/gregtech/common/covers/CoverFluidFilter.java b/src/main/java/gregtech/common/covers/CoverFluidFilter.java index a0b6585ebd7..e178b0441de 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidFilter.java +++ b/src/main/java/gregtech/common/covers/CoverFluidFilter.java @@ -36,6 +36,7 @@ import com.cleanroommc.modularui.drawable.Rectangle; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; @@ -144,7 +145,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var filteringMode = new EnumSyncValue<>(FluidFilterMode.class, this::getFilterMode, this::setFilterMode); guiSyncManager.syncValue("filtering_mode", filteringMode); @@ -180,7 +181,7 @@ public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncMan .child(new Rectangle().setColor(UI_TEXT_COLOR).asWidget() .height(1).widthRel(0.95f).margin(0, 4)) .child(getFilter().createWidgets(guiSyncManager))) - .child(SlotGroupWidget.playerInventory().bottom(7).left(7)); + .child(SlotGroupWidget.playerInventory(false).bottom(7).left(7)); } @Override diff --git a/src/main/java/gregtech/common/covers/CoverFluidRegulator.java b/src/main/java/gregtech/common/covers/CoverFluidRegulator.java index 141b51e0552..a3cf6bcbf96 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidRegulator.java +++ b/src/main/java/gregtech/common/covers/CoverFluidRegulator.java @@ -23,6 +23,7 @@ import com.cleanroommc.modularui.factory.GuiData; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.EnumSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; @@ -243,8 +244,8 @@ private boolean shouldDisplayAmountSlider() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { - return super.buildUI(guiData, guiSyncManager).height(192 + 36); + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { + return super.buildUI(guiData, guiSyncManager, settings).height(192 + 36); } @Override diff --git a/src/main/java/gregtech/common/covers/CoverFluidVoiding.java b/src/main/java/gregtech/common/covers/CoverFluidVoiding.java index 4bd8472b55f..750a97de15f 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidVoiding.java +++ b/src/main/java/gregtech/common/covers/CoverFluidVoiding.java @@ -28,6 +28,7 @@ import com.cleanroommc.modularui.factory.GuiData; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; @@ -72,8 +73,8 @@ public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 tra } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { - return super.buildUI(guiData, guiSyncManager).height(192 - 22); + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { + return super.buildUI(guiData, guiSyncManager, settings).height(192 - 22); } @Override diff --git a/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java b/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java index b6a9e1cd1e5..84f722c39c6 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java +++ b/src/main/java/gregtech/common/covers/CoverFluidVoidingAdvanced.java @@ -23,6 +23,7 @@ import com.cleanroommc.modularui.factory.GuiData; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.EnumSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; @@ -101,8 +102,8 @@ public VoidingMode getVoidingMode() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { - return super.buildUI(guiData, guiSyncManager).height(192 + 20); + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { + return super.buildUI(guiData, guiSyncManager, settings).height(192 + 20); } @Override diff --git a/src/main/java/gregtech/common/covers/CoverItemFilter.java b/src/main/java/gregtech/common/covers/CoverItemFilter.java index 8c667ad8ce7..35a418d50cd 100644 --- a/src/main/java/gregtech/common/covers/CoverItemFilter.java +++ b/src/main/java/gregtech/common/covers/CoverItemFilter.java @@ -35,6 +35,7 @@ import com.cleanroommc.modularui.drawable.Rectangle; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; @@ -147,7 +148,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var filteringMode = new EnumSyncValue<>(ItemFilterMode.class, this::getFilterMode, this::setFilterMode); guiSyncManager.syncValue("filtering_mode", filteringMode); @@ -182,7 +183,7 @@ public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncMan .child(new Rectangle().setColor(UI_TEXT_COLOR).asWidget() .height(1).widthRel(0.95f).margin(0, 4)) .child(getFilter().createWidgets(guiSyncManager).left(0))) - .child(SlotGroupWidget.playerInventory().bottom(7).left(7)); + .child(SlotGroupWidget.playerInventory(false).bottom(7).left(7)); } @Override diff --git a/src/main/java/gregtech/common/covers/CoverItemVoiding.java b/src/main/java/gregtech/common/covers/CoverItemVoiding.java index e8129ec11f3..234ebb70fcc 100644 --- a/src/main/java/gregtech/common/covers/CoverItemVoiding.java +++ b/src/main/java/gregtech/common/covers/CoverItemVoiding.java @@ -25,6 +25,7 @@ import com.cleanroommc.modularui.factory.GuiData; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; @@ -73,8 +74,8 @@ void voidAny(IItemHandler myItemHandler) { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { - return super.buildUI(guiData, guiSyncManager).height(192 - 22); + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { + return super.buildUI(guiData, guiSyncManager, settings).height(192 - 22); } @Override diff --git a/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java b/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java index b739e7e6e1f..1a716509505 100644 --- a/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java +++ b/src/main/java/gregtech/common/covers/CoverItemVoidingAdvanced.java @@ -20,6 +20,7 @@ import com.cleanroommc.modularui.factory.GuiData; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.EnumSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; @@ -89,8 +90,8 @@ protected void voidOverflow(IItemHandler myItemHandler) { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { - return super.buildUI(guiData, guiSyncManager).height(192 + 18); + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { + return super.buildUI(guiData, guiSyncManager, settings).height(192 + 18); } @Override diff --git a/src/main/java/gregtech/common/covers/CoverMachineController.java b/src/main/java/gregtech/common/covers/CoverMachineController.java index 545f3cde52e..3a97582a9bc 100644 --- a/src/main/java/gregtech/common/covers/CoverMachineController.java +++ b/src/main/java/gregtech/common/covers/CoverMachineController.java @@ -25,6 +25,7 @@ import com.cleanroommc.modularui.drawable.Rectangle; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.value.BoolValue; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; @@ -111,7 +112,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { EnumSyncValue controllerModeValue = new EnumSyncValue<>(ControllerMode.class, this::getControllerMode, this::setControllerMode); BooleanSyncValue invertedValue = new BooleanSyncValue(this::isInverted, this::setInverted); diff --git a/src/main/java/gregtech/common/covers/CoverPump.java b/src/main/java/gregtech/common/covers/CoverPump.java index 659b916e80b..29bf0b2b52c 100644 --- a/src/main/java/gregtech/common/covers/CoverPump.java +++ b/src/main/java/gregtech/common/covers/CoverPump.java @@ -45,6 +45,7 @@ import com.cleanroommc.modularui.factory.GuiData; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.utils.MouseData; import com.cleanroommc.modularui.value.sync.EnumSyncValue; @@ -189,7 +190,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var panel = GTGuis.createPanel(this, 176, 192); getFluidFilterContainer().setMaxTransferSize(getMaxTransferRate()); diff --git a/src/main/java/gregtech/common/covers/CoverRoboticArm.java b/src/main/java/gregtech/common/covers/CoverRoboticArm.java index b1b99657adf..31918dbcaac 100644 --- a/src/main/java/gregtech/common/covers/CoverRoboticArm.java +++ b/src/main/java/gregtech/common/covers/CoverRoboticArm.java @@ -22,6 +22,7 @@ import com.cleanroommc.modularui.factory.GuiData; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.EnumSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; @@ -192,8 +193,8 @@ private boolean shouldDisplayAmountSlider() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { - return super.buildUI(guiData, guiSyncManager).height(192 + 36 + 18 + 2); + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { + return super.buildUI(guiData, guiSyncManager, settings).height(192 + 36 + 18 + 2); } @Override diff --git a/src/main/java/gregtech/common/covers/CoverStorage.java b/src/main/java/gregtech/common/covers/CoverStorage.java index 4d4f35a5ec1..addf992cd3b 100644 --- a/src/main/java/gregtech/common/covers/CoverStorage.java +++ b/src/main/java/gregtech/common/covers/CoverStorage.java @@ -25,10 +25,11 @@ import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -86,7 +87,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { guiSyncManager.registerSlotGroup("item_inv", this.storageHandler.getSlots()); int rowSize = this.storageHandler.getSlots(); diff --git a/src/main/java/gregtech/common/covers/ender/CoverAbstractEnderLink.java b/src/main/java/gregtech/common/covers/ender/CoverAbstractEnderLink.java index 29e7e9a0b9a..f37a17d39fd 100644 --- a/src/main/java/gregtech/common/covers/ender/CoverAbstractEnderLink.java +++ b/src/main/java/gregtech/common/covers/ender/CoverAbstractEnderLink.java @@ -33,6 +33,7 @@ import com.cleanroommc.modularui.factory.SidedPosGuiData; import com.cleanroommc.modularui.network.NetworkUtils; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncHandler; @@ -136,7 +137,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var panel = GTGuis.createPanel(this, 176, 192); this.playerUUID = guiData.getPlayer().getUniqueID(); @@ -362,7 +363,7 @@ protected IWidget createRow(final String name, final PanelSyncManager syncManage .background(GTGuiTextures.SLOT.asIcon().size(18)) .top(1)) .child(new InteractableText<>(entry, this::updateColor) - .tooltip(tooltip -> tooltip.setAutoUpdate(true)) + .tooltipAutoUpdate(true) .tooltipBuilder(tooltip -> { String desc = entry.getDescription(); if (!desc.isEmpty()) tooltip.add(desc); diff --git a/src/main/java/gregtech/common/covers/filter/BaseFilter.java b/src/main/java/gregtech/common/covers/filter/BaseFilter.java index b0a312b6e1e..1bc6bc8f2d6 100644 --- a/src/main/java/gregtech/common/covers/filter/BaseFilter.java +++ b/src/main/java/gregtech/common/covers/filter/BaseFilter.java @@ -21,7 +21,6 @@ import com.cleanroommc.modularui.widget.Widget; import com.cleanroommc.modularui.widgets.CycleButtonWidget; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public abstract class BaseFilter implements IFilter { @@ -64,14 +63,14 @@ public final ItemStack getContainerStack() { return this.getFilterReader().getContainer(); } - public static @Nullable BaseFilter getFilterFromStack(ItemStack stack) { + public static @NotNull BaseFilter getFilterFromStack(ItemStack stack) { if (stack.getItem() instanceof MetaItemmetaItem) { var metaValueItem = metaItem.getItem(stack); var factory = metaValueItem == null ? null : metaValueItem.getFilterFactory(); if (factory != null) return factory.create(stack); } - return null; + return ERROR_FILTER; } public final void setBlacklistFilter(boolean blacklistFilter) { diff --git a/src/main/java/gregtech/common/covers/filter/BaseFilterContainer.java b/src/main/java/gregtech/common/covers/filter/BaseFilterContainer.java index d1c2fe60e7b..067a4fd6eee 100644 --- a/src/main/java/gregtech/common/covers/filter/BaseFilterContainer.java +++ b/src/main/java/gregtech/common/covers/filter/BaseFilterContainer.java @@ -20,8 +20,8 @@ import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; import com.cleanroommc.modularui.widgets.ButtonWidget; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.layout.Flow; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java b/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java index dbeabae9c0b..7cd5c8eeae1 100644 --- a/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/SimpleItemFilter.java @@ -24,9 +24,9 @@ import com.cleanroommc.modularui.value.sync.SyncHandlers; import com.cleanroommc.modularui.widget.Widget; import com.cleanroommc.modularui.widgets.CycleButtonWidget; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.layout.Flow; +import com.cleanroommc.modularui.widgets.slot.PhantomItemSlot; import com.cleanroommc.modularui.widgets.slot.SlotGroup; import org.jetbrains.annotations.NotNull; @@ -118,7 +118,15 @@ public void initUI(Consumer widgetGroup) { .matrix("XXX", "XXX", "XXX") - .key('X', index -> new ItemSlot() + .key('X', index -> new PhantomItemSlot() + .slot(SyncHandlers.itemSlot(this.filterReader, index) + .ignoreMaxStackSize(true) + .slotGroup(filterInventory) + .changeListener((newItem, onlyAmountChanged, client, init) -> { + if (onlyAmountChanged && !init) { + markDirty(); + } + })) .tooltip(tooltip -> { tooltip.setAutoUpdate(true); tooltip.textColor(Color.GREY.main); @@ -135,15 +143,7 @@ public void initUI(Consumer widgetGroup) { tooltip.addLine( IKey.str("Count: %s", TextFormattingUtil.formatNumbers(count))); } - }) - .slot(SyncHandlers.phantomItemSlot(this.filterReader, index) - .ignoreMaxStackSize(true) - .slotGroup(filterInventory) - .changeListener((newItem, onlyAmountChanged, client, init) -> { - if (onlyAmountChanged && !init) { - markDirty(); - } - }))) + })) .build().marginRight(4)) .child(Flow.column().width(18).coverChildren() .child(createBlacklistUI()) diff --git a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java index f7523d976d1..8677fcfe582 100644 --- a/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/IntCircuitBehaviour.java @@ -25,6 +25,7 @@ import com.cleanroommc.modularui.drawable.ItemDrawable; import com.cleanroommc.modularui.factory.HandGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.InteractionSyncHandler; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.widgets.ButtonWidget; @@ -65,7 +66,7 @@ public ActionResult onItemRightClick(World world, EntityPlayer player } @Override - public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var panel = GTGuis.createPanel(guiData.getUsedItemStack(), 176, 120); ItemDrawable circuitPreview = new ItemDrawable(guiData.getUsedItemStack()); for (int i = 0; i <= 32; i++) { diff --git a/src/main/java/gregtech/common/items/behaviors/filter/BaseFilterUIManager.java b/src/main/java/gregtech/common/items/behaviors/filter/BaseFilterUIManager.java index cbddb18d305..91161663700 100644 --- a/src/main/java/gregtech/common/items/behaviors/filter/BaseFilterUIManager.java +++ b/src/main/java/gregtech/common/items/behaviors/filter/BaseFilterUIManager.java @@ -17,6 +17,7 @@ import com.cleanroommc.modularui.factory.HandGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import java.util.List; @@ -36,7 +37,7 @@ public final ActionResult onItemRightClick(World world, EntityPlayer } @Override - public abstract ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager); + public abstract ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings); protected final ModularPanel createBasePanel(ItemStack stack) { return GTGuis.createPanel(stack, 176, 188) diff --git a/src/main/java/gregtech/common/items/behaviors/filter/OreDictFilterUIManager.java b/src/main/java/gregtech/common/items/behaviors/filter/OreDictFilterUIManager.java index f38182f9f5c..08e19f607cf 100644 --- a/src/main/java/gregtech/common/items/behaviors/filter/OreDictFilterUIManager.java +++ b/src/main/java/gregtech/common/items/behaviors/filter/OreDictFilterUIManager.java @@ -4,16 +4,17 @@ import com.cleanroommc.modularui.factory.HandGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.widgets.SlotGroupWidget; public class OreDictFilterUIManager extends BaseFilterUIManager { @Override - public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var filter = BaseFilter.getFilterFromStack(guiData.getUsedItemStack()); return createBasePanel(filter.getContainerStack()).height(160) .child(filter.createWidgets(guiSyncManager).top(22).margin(7, 0)) - .child(SlotGroupWidget.playerInventory().bottom(7).left(7)); + .child(SlotGroupWidget.playerInventory(true)); } } diff --git a/src/main/java/gregtech/common/items/behaviors/filter/SimpleFilterUIManager.java b/src/main/java/gregtech/common/items/behaviors/filter/SimpleFilterUIManager.java index ee8062618a4..eb33ca66fcb 100644 --- a/src/main/java/gregtech/common/items/behaviors/filter/SimpleFilterUIManager.java +++ b/src/main/java/gregtech/common/items/behaviors/filter/SimpleFilterUIManager.java @@ -4,16 +4,20 @@ import com.cleanroommc.modularui.factory.HandGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.widgets.SlotGroupWidget; public class SimpleFilterUIManager extends BaseFilterUIManager { @Override - public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var filter = BaseFilter.getFilterFromStack(guiData.getUsedItemStack()); - return createBasePanel(filter.getContainerStack()).padding(4).height(166) - .child(filter.createWidgets(guiSyncManager).top(22).left(7)) - .child(SlotGroupWidget.playerInventory().left(7)); + return createBasePanel(filter.getContainerStack()) + .height(166) + .child(filter.createWidgets(guiSyncManager) + .top(22) + .left(7)) + .child(SlotGroupWidget.playerInventory(true)); } } diff --git a/src/main/java/gregtech/common/items/behaviors/filter/SimpleFluidFilterUIManager.java b/src/main/java/gregtech/common/items/behaviors/filter/SimpleFluidFilterUIManager.java index 64164c932fd..915746faacd 100644 --- a/src/main/java/gregtech/common/items/behaviors/filter/SimpleFluidFilterUIManager.java +++ b/src/main/java/gregtech/common/items/behaviors/filter/SimpleFluidFilterUIManager.java @@ -4,16 +4,20 @@ import com.cleanroommc.modularui.factory.HandGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.widgets.SlotGroupWidget; public class SimpleFluidFilterUIManager extends BaseFilterUIManager { @Override - public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var filter = BaseFilter.getFilterFromStack(guiData.getUsedItemStack()); - return createBasePanel(filter.getContainerStack()).padding(4).height(166) - .child(filter.createWidgets(guiSyncManager).top(22).left(7)) - .child(SlotGroupWidget.playerInventory().left(7)); + return createBasePanel(filter.getContainerStack()) + .height(166) + .child(filter.createWidgets(guiSyncManager) + .top(22) + .left(7)) + .child(SlotGroupWidget.playerInventory(true)); } } diff --git a/src/main/java/gregtech/common/items/behaviors/filter/SmartFilterUIManager.java b/src/main/java/gregtech/common/items/behaviors/filter/SmartFilterUIManager.java index 3fc047deae6..0f8f96ed76a 100644 --- a/src/main/java/gregtech/common/items/behaviors/filter/SmartFilterUIManager.java +++ b/src/main/java/gregtech/common/items/behaviors/filter/SmartFilterUIManager.java @@ -4,16 +4,17 @@ import com.cleanroommc.modularui.factory.HandGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.widgets.SlotGroupWidget; public class SmartFilterUIManager extends BaseFilterUIManager { @Override - public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var filter = BaseFilter.getFilterFromStack(guiData.getUsedItemStack()); return createBasePanel(filter.getContainerStack()).height(166) .child(filter.createWidgets(guiSyncManager).left(7).top(22)) - .child(SlotGroupWidget.playerInventory().bottom(7).left(7)); + .child(SlotGroupWidget.playerInventory(true)); } } diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java index 88caa0adc19..ca26c1cba5c 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBatteryBuffer.java @@ -38,11 +38,12 @@ import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -148,7 +149,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { int rowSize = (int) Math.sqrt(inventorySize); int colSize = rowSize; if (inventorySize == 8) { @@ -172,7 +173,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) // TODO: Change the position of the name when it's standardized. return GTGuis.createPanel(this, 176, 18 + 18 * colSize + 94) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(new Grid() .top(18).height(colSize * 18).width(rowSize * 18) .minElementMargin(0, 0) diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java index 5d574ef1668..65e4e3a76fb 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityBlockBreaker.java @@ -44,11 +44,12 @@ import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -321,7 +322,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { int rowSize = (int) Math.sqrt(getInventorySize()); guiSyncManager.registerSlotGroup("item_inv", rowSize); @@ -337,7 +338,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) return GTGuis.createPanel(this, 176, 18 + 18 * rowSize + 94) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(new Grid() .top(18).height(rowSize * 18) .minElementMargin(0, 0) diff --git a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java index c32f2ce65a2..44c55e814cf 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java +++ b/src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityFisher.java @@ -32,11 +32,12 @@ import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -70,7 +71,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { int rowSize = (int) Math.sqrt(inventorySize); guiSyncManager.registerSlotGroup("item_in", 1); guiSyncManager.registerSlotGroup("item_out", rowSize); @@ -89,7 +90,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) return GTGuis.createPanel(this, 176, 18 + 18 * rowSize + 94) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(new ItemSlot().slot(SyncHandlers.itemSlot(importItems, 0) .slotGroup("item_in")) .background(GTGuiTextures.SLOT, GTGuiTextures.STRING_SLOT_OVERLAY) diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java index e63d6a6b6e4..f9b0c35313c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityCokeOven.java @@ -40,8 +40,8 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.value.sync.DoubleSyncValue; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.ProgressWidget; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import com.cleanroommc.modularui.widgets.slot.ModularSlot; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java index 8bb43d653f9..4a0a6e7adee 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java @@ -40,7 +40,6 @@ import codechicken.lib.vec.Matrix4; import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.utils.Alignment; -import com.cleanroommc.modularui.widgets.TextWidget; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -145,7 +144,8 @@ protected MultiblockUIFactory createUIFactory() { .disableDisplay() .disableButtons() .addScreenChildren((parent, syncManager) -> { - parent.child(new TextWidget(IKey.lang(getMetaFullName())) + parent.child(IKey.lang(getMetaFullName()) + .asWidget() .pos(5, 5)); parent.child(new GTFluidSlot() .pos(52, 18) diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java index abc1e11b3cc..4b5dcac0b53 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPrimitiveBlastFurnace.java @@ -43,9 +43,10 @@ import com.cleanroommc.modularui.drawable.UITexture; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.value.sync.DoubleSyncValue; -import com.cleanroommc.modularui.widgets.ItemSlot; +import com.cleanroommc.modularui.widgets.ProgressWidget; import com.cleanroommc.modularui.widgets.layout.Flow; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import com.cleanroommc.modularui.widgets.slot.ModularSlot; import com.cleanroommc.modularui.widgets.slot.SlotGroup; import org.apache.commons.lang3.ArrayUtils; @@ -111,27 +112,27 @@ protected MultiblockUIFactory createUIFactory() { .child(Flow.row() .top(20) .alignX(0.5f) - // .pos(52, 20) .crossAxisAlignment(Alignment.CrossAxis.CENTER) .coverChildren() .child(new Grid() .coverChildren() .mapTo(1, 3, value -> new ItemSlot() .background(GTGuiTextures.SLOT_PRIMITIVE, importOverlays[value]) + // todo why do we need this now? + .disableHoverBackground() .slot(new ModularSlot(importItems, value) .slotGroup(importGroup))) .marginRight(6)) - .child(new com.cleanroommc.modularui.widgets.ProgressWidget() - // .pos(77, 39) + .child(new ProgressWidget() .size(20, 15) .marginRight(6) .texture(GTGuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, 20) .value(new DoubleSyncValue(recipeMapWorkable::getProgressPercent))) .child(new Grid() .coverChildren() - // .pos(104, 38) .mapTo(3, 3, value -> new ItemSlot() .background(GTGuiTextures.SLOT_PRIMITIVE, exportOverlays[value]) + .disableHoverBackground() .slot(new ModularSlot(exportItems, value) .accessibility(false, true))))); }); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java index 0537a814d37..4d841dc6582 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityPumpHatch.java @@ -36,13 +36,14 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.RichTextWidget; import com.cleanroommc.modularui.widgets.SlotGroupWidget; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -125,7 +126,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { guiSyncManager.registerSlotGroup("item_inv", 2); GTFluidSyncHandler tankSyncHandler = GTFluidSlot.sync(this.exportFluids.getTankAt(0)) @@ -135,7 +136,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) // TODO: Change the position of the name when it's standardized. return GTGuis.createPanel(this, 176, 166) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(GTGuiTextures.DISPLAY.asWidget() .left(7).top(16) .size(81, 55)) diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java index f9a5876a59c..39d85a09234 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java @@ -47,13 +47,14 @@ import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.network.NetworkUtils; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.RichTextWidget; import com.cleanroommc.modularui.widgets.ToggleButton; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import com.cleanroommc.modularui.widgets.slot.ModularSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -281,7 +282,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { var fluidSyncHandler = GTFluidSlot.sync(fluidTank) .showAmountOnSlot(false) .accessibility(true, !isExportHatch); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java index c3dae2f0e06..127977cb343 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java @@ -40,15 +40,16 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; import com.cleanroommc.modularui.widget.Widget; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.ToggleButton; import com.cleanroommc.modularui.widgets.layout.Flow; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import it.unimi.dsi.fastutil.objects.Object2IntMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -265,7 +266,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) { int rowSize = (int) Math.sqrt(getInventorySize()); panelSyncManager.registerSlotGroup("item_inv", rowSize); @@ -282,7 +283,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage return GTGuis.createPanel(this, backgroundWidth, backgroundHeight) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(new Grid() .top(18).height(rowSize * 18) .minElementMargin(0, 0) @@ -323,7 +324,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage IKey.lang("gregtech.gui.item_auto_collapse.tooltip.enabled") : IKey.lang("gregtech.gui.item_auto_collapse.tooltip.disabled")))) .childIf(hasGhostCircuit, new GhostCircuitSlotWidget() - .slot(SyncHandlers.itemSlot(circuitInventory, 0)) + .slot(circuitInventory, 0) .background(GTGuiTextures.SLOT, GTGuiTextures.INT_CIRCUIT_OVERLAY)) .childIf(!hasGhostCircuit, new Widget<>() .background(GTGuiTextures.SLOT, GTGuiTextures.BUTTON_X) diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java index ba324cf1dff..31511ae2cb6 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMachineHatch.java @@ -28,10 +28,11 @@ import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; import com.cleanroommc.modularui.screen.RichTooltip; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -74,13 +75,13 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { guiSyncManager.registerSlotGroup("item_inv", 1); // TODO: Change the position of the name when it's standardized. return GTGuis.createPanel(this, 176, 18 + 18 + 94) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(new ItemSlot() .slot(SyncHandlers.itemSlot(machineHandler, 0) .slotGroup("item_inv")) diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java index 5c909ef7a69..dda4c982efc 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityMultiFluidHatch.java @@ -33,6 +33,7 @@ import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.network.NetworkUtils; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.widgets.layout.Grid; import org.jetbrains.annotations.NotNull; @@ -208,7 +209,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { int rowSize = (int) Math.sqrt(numSlots); List fluidSlots = new ArrayList<>(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java index 568e897c850..a486765725c 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityObjectHolder.java @@ -34,10 +34,11 @@ import com.cleanroommc.modularui.drawable.GuiDraw; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -67,13 +68,13 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { guiSyncManager.registerSlotGroup("item_inv", 2); // TODO: Change the position of the name when it's standardized. return GTGuis.createPanel(this, 176, 166) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(GTGuiTextures.PROGRESS_BAR_RESEARCH_STATION_BASE.asWidget() .left(46).top(18) .size(84, 60)) diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchFluid.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchFluid.java index 14c86351976..a047127d832 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchFluid.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchFluid.java @@ -37,6 +37,7 @@ import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.widgets.SlotGroupWidget; @@ -138,7 +139,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { int rowSize = (int) Math.sqrt(getTier() + 1); int backgroundWidth = 9 * 18 + 14; @@ -156,7 +157,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) BooleanSyncValue workingStateValue = new BooleanSyncValue(() -> workingEnabled, val -> workingEnabled = val); return GTGuis.createPanel(this, backgroundWidth, backgroundHeight) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(new Grid() .top(18).height(rowSize * 18) .minElementMargin(0, 0) diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java index a5be8680efa..4d02dba1e66 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityPassthroughHatchItem.java @@ -36,13 +36,14 @@ import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.BooleanSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.ToggleButton; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -140,7 +141,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { int rowSize = (int) Math.sqrt(getInventorySize()); guiSyncManager.registerSlotGroup("item_inv", rowSize); @@ -163,7 +164,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) BooleanSyncValue workingStateValue = new BooleanSyncValue(() -> workingEnabled, val -> workingEnabled = val); return GTGuis.createPanel(this, backgroundWidth, backgroundHeight) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(new Grid() .top(18).height(rowSize * 18) .minElementMargin(0, 0) diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java index 9f8a133d401..00241591cf8 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityReservoirHatch.java @@ -42,13 +42,14 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.RichTextWidget; import com.cleanroommc.modularui.widgets.SlotGroupWidget; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -149,7 +150,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { guiSyncManager.registerSlotGroup("item_inv", 2); GTFluidSyncHandler tankSyncHandler = GTFluidSlot.sync(this.fluidTank) @@ -159,7 +160,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) // TODO: Change the position of the name when it's standardized. return GTGuis.createPanel(this, 176, 166) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(GTGuiTextures.DISPLAY.asWidget() .left(7).top(16) .size(81, 55)) diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java index 9401664249d..d82088dc81a 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityRotorHolder.java @@ -41,10 +41,11 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -86,12 +87,12 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { guiSyncManager.registerSlotGroup("item_inv", 1); // TODO: Change the position of the name when it's standardized. return GTGuis.createPanel(this, 176, 166) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(new ItemSlot() .slot(SyncHandlers.itemSlot(inventory, 0) .slotGroup("item_inv") diff --git a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java index 78bc61b5a2d..879cb9c2da0 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java +++ b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamHatch.java @@ -39,13 +39,14 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.RichTextWidget; import com.cleanroommc.modularui.widgets.SlotGroupWidget; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -140,7 +141,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { guiSyncManager.registerSlotGroup("item_inv", 2); GTFluidSyncHandler tankSyncHandler = GTFluidSlot.sync(this.importFluids.getTankAt(0)) @@ -148,7 +149,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) return GTGuis.createPanel(this, 176, 166) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child((IS_STEEL ? GTGuiTextures.DISPLAY_STEEL : GTGuiTextures.DISPLAY_BRONZE).asWidget() .left(7).top(16) .size(81, 55)) diff --git a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java index c73bcb442a9..6734a00616a 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java +++ b/src/main/java/gregtech/common/metatileentities/steam/multiblockpart/MetaTileEntitySteamItemBus.java @@ -27,10 +27,11 @@ import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -87,7 +88,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) { panelSyncManager.registerSlotGroup("item_inv", 2); List> widgets = new ArrayList<>(); diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java index e7a94663d21..353cdf406c3 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityBuffer.java @@ -30,11 +30,12 @@ import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; @@ -85,7 +86,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) { int invTier = tier + 2; guiSyncManager.registerSlotGroup("item_inv", invTier); @@ -108,7 +109,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) // TODO: Change the position of the name when it's standardized. return GTGuis.createPanel(this, 176, Math.max(166, 18 + 18 * invTier + 94)) .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) - .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) + .child(SlotGroupWidget.playerInventory(false).left(7).bottom(7)) .child(new Grid() .top(18).height(18 * invTier) .left(7) diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java index 1da4918ffcc..5c6948c5ffc 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCrate.java @@ -35,10 +35,11 @@ import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandlers; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -141,7 +142,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager, UISettings settings) { panelSyncManager.registerSlotGroup("item_inv", rowSize); int rows = inventorySize / rowSize; diff --git a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java index cf19d68fe16..3483c603223 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java +++ b/src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityWorkbench.java @@ -47,17 +47,18 @@ import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.network.NetworkUtils; import com.cleanroommc.modularui.screen.ModularPanel; +import com.cleanroommc.modularui.screen.UISettings; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.value.sync.IntSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.widget.scroll.VerticalScrollData; import com.cleanroommc.modularui.widgets.ButtonWidget; -import com.cleanroommc.modularui.widgets.ItemSlot; import com.cleanroommc.modularui.widgets.PageButton; import com.cleanroommc.modularui.widgets.PagedWidget; import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.layout.Flow; import com.cleanroommc.modularui.widgets.layout.Grid; +import com.cleanroommc.modularui.widgets.slot.ItemSlot; import com.cleanroommc.modularui.widgets.slot.ModularSlot; import com.cleanroommc.modularui.widgets.slot.SlotGroup; import com.google.common.base.Preconditions; @@ -217,7 +218,7 @@ public boolean usesMui2() { } @Override - public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager syncManager) { + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager syncManager, UISettings settings) { getCraftingRecipeLogic().updateCurrentRecipe(); this.recipeLogic.clearSlotMap(); @@ -322,19 +323,7 @@ public IWidget createCraftingGrid() { } }) .background(GTGuiTextures.SLOT)) - .build() - .child(new ButtonWidget<>() - .margin(2) - .size(8) - .topRel(0f) - .rightRel(0f, 0, 1f) - .background(GTGuiTextures.BUTTON_CLEAR_GRID) - .addTooltipLine(IKey.lang("gregtech.machine.workbench.clear_grid")) - .disableHoverBackground() - .onMousePressed(mouseButton -> { - this.recipeLogic.clearCraftingGrid(); - return true; - })); + .build(); } public IWidget createCraftingOutput(PosGuiData guiData, PanelSyncManager syncManager) { @@ -349,7 +338,18 @@ public IWidget createCraftingOutput(PosGuiData guiData, PanelSyncManager syncMan .marginBottom(4)) .child(IKey.dynamic(() -> TextFormattingUtil.formatLongToCompactString(amountCrafted.getIntValue(), 5)) .alignment(Alignment.Center) - .asWidget().widthRel(1f)); + .asWidget().widthRel(1f)) + .child(new ButtonWidget<>() + .margin(2) + .size(8) + .align(Alignment.TopLeft) + .background(GTGuiTextures.BUTTON_CLEAR_GRID) + .addTooltipLine(IKey.lang("gregtech.machine.workbench.clear_grid")) + .disableHoverBackground() + .onMousePressed(mouseButton -> { + this.recipeLogic.clearCraftingGrid(); + return true; + })); } public IWidget createRecipeMemoryGrid(PanelSyncManager syncManager) { diff --git a/src/main/java/gregtech/common/mui/widget/GTFluidSlot.java b/src/main/java/gregtech/common/mui/widget/GTFluidSlot.java index 56b7709548b..92d32a9cd97 100644 --- a/src/main/java/gregtech/common/mui/widget/GTFluidSlot.java +++ b/src/main/java/gregtech/common/mui/widget/GTFluidSlot.java @@ -10,16 +10,15 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import com.cleanroommc.modularui.api.ITheme; +import com.cleanroommc.modularui.api.UpOrDown; import com.cleanroommc.modularui.api.widget.Interactable; import com.cleanroommc.modularui.drawable.GuiDraw; import com.cleanroommc.modularui.drawable.text.TextRenderer; -import com.cleanroommc.modularui.integration.jei.JeiGhostIngredientSlot; -import com.cleanroommc.modularui.integration.jei.JeiIngredientProvider; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerGhostIngredientSlot; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerIngredientProvider; import com.cleanroommc.modularui.network.NetworkUtils; -import com.cleanroommc.modularui.screen.ModularScreen; import com.cleanroommc.modularui.screen.viewport.ModularGuiContext; -import com.cleanroommc.modularui.theme.WidgetSlotTheme; -import com.cleanroommc.modularui.theme.WidgetTheme; +import com.cleanroommc.modularui.theme.WidgetThemeEntry; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.Color; import com.cleanroommc.modularui.utils.MouseData; @@ -29,8 +28,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public final class GTFluidSlot extends Widget implements Interactable, JeiIngredientProvider, - JeiGhostIngredientSlot { +public final class GTFluidSlot extends Widget implements Interactable, RecipeViewerIngredientProvider, + RecipeViewerGhostIngredientSlot { private final TextRenderer textRenderer = new TextRenderer(); private GTFluidSyncHandler syncHandler; @@ -50,7 +49,7 @@ public void onInit() { this.textRenderer.setScale(0.5f); this.textRenderer.setColor(Color.WHITE.main); if (syncHandler.canLockFluid() || syncHandler.isPhantom()) { - getContext().getJeiSettings().addJeiGhostIngredientSlot(this); + getContext().getRecipeViewerSettings().addRecipeViewerGhostIngredientSlot(this); } tooltipBuilder(syncHandler::handleTooltip); syncHandler.setChangeConsumer($ -> markTooltipDirty()); @@ -77,19 +76,13 @@ public boolean isValidSyncHandler(SyncHandler syncHandler) { } @Override - public void drawBackground(ModularGuiContext context, WidgetTheme widgetTheme) { + public void drawBackground(ModularGuiContext context, WidgetThemeEntry widgetTheme) { if (disableBackground) return; super.drawBackground(context, widgetTheme); } @Override - public void draw(ModularGuiContext context, WidgetTheme widgetTheme) { - if (widgetTheme instanceof WidgetSlotTheme slotTheme) { - draw(context, slotTheme); - } - } - - public void draw(ModularGuiContext context, WidgetSlotTheme widgetTheme) { + public void draw(ModularGuiContext context, WidgetThemeEntry widgetTheme) { FluidStack content = this.syncHandler.getFluid(); if (content == null) content = this.syncHandler.getLockedFluid(); @@ -107,7 +100,7 @@ public void draw(ModularGuiContext context, WidgetSlotTheme widgetTheme) { GuiDraw.drawFluidTexture(content, 1, y, getArea().w() - 2, height, 0); if (content != null && this.syncHandler.showAmountOnSlot()) { - String amount = NumberFormat.formatWithMaxDigits(content.amount, 3) + "L"; + String amount = NumberFormat.DEFAULT.format(content.amount) + "L"; this.textRenderer.setAlignment(Alignment.CenterRight, getArea().width - 1f); this.textRenderer.setPos(0, 12); this.textRenderer.draw(amount); @@ -131,7 +124,7 @@ public void draw(ModularGuiContext context, WidgetSlotTheme widgetTheme) { } @Override - public boolean onMouseScroll(ModularScreen.UpOrDown scrollDirection, int amount) { + public boolean onMouseScroll(UpOrDown scrollDirection, int amount) { if (!this.syncHandler.isPhantom()) return false; if ((scrollDirection.isUp() && !this.syncHandler.canFillSlot()) || (scrollDirection.isDown() && !this.syncHandler.canDrainSlot())) { @@ -143,7 +136,7 @@ public boolean onMouseScroll(ModularScreen.UpOrDown scrollDirection, int amount) } @Override - protected WidgetTheme getWidgetThemeInternal(ITheme theme) { + protected WidgetThemeEntry getWidgetThemeInternal(ITheme theme) { return theme.getFluidSlotTheme(); } diff --git a/src/main/java/gregtech/common/mui/widget/InteractableText.java b/src/main/java/gregtech/common/mui/widget/InteractableText.java index bcafa15208d..0ac02dd22e3 100644 --- a/src/main/java/gregtech/common/mui/widget/InteractableText.java +++ b/src/main/java/gregtech/common/mui/widget/InteractableText.java @@ -15,7 +15,7 @@ import java.util.function.Consumer; -public class InteractableText extends TextWidget implements Interactable { +public class InteractableText extends TextWidget> implements Interactable { private final T entry; private final EntryColorSH syncHandler; diff --git a/src/main/java/gregtech/common/mui/widget/ScrollableTextWidget.java b/src/main/java/gregtech/common/mui/widget/ScrollableTextWidget.java index a20bfc92a41..adb417827fb 100644 --- a/src/main/java/gregtech/common/mui/widget/ScrollableTextWidget.java +++ b/src/main/java/gregtech/common/mui/widget/ScrollableTextWidget.java @@ -1,11 +1,11 @@ package gregtech.common.mui.widget; -import gregtech.api.mui.IconAcessor; - import net.minecraft.client.gui.FontRenderer; import com.cleanroommc.modularui.api.GuiAxis; +import com.cleanroommc.modularui.api.UpOrDown; import com.cleanroommc.modularui.api.drawable.IHoverable; +import com.cleanroommc.modularui.api.drawable.IIcon; import com.cleanroommc.modularui.api.drawable.IRichTextBuilder; import com.cleanroommc.modularui.api.layout.IViewport; import com.cleanroommc.modularui.api.layout.IViewportStack; @@ -14,10 +14,10 @@ import com.cleanroommc.modularui.drawable.Stencil; import com.cleanroommc.modularui.drawable.text.RichText; import com.cleanroommc.modularui.drawable.text.TextRenderer; -import com.cleanroommc.modularui.integration.jei.JeiIngredientProvider; -import com.cleanroommc.modularui.screen.ModularScreen; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerIngredientProvider; import com.cleanroommc.modularui.screen.RichTooltip; import com.cleanroommc.modularui.screen.viewport.ModularGuiContext; +import com.cleanroommc.modularui.theme.TextFieldTheme; import com.cleanroommc.modularui.utils.HoveredWidgetList; import com.cleanroommc.modularui.widget.Widget; import com.cleanroommc.modularui.widget.scroll.ScrollArea; @@ -30,7 +30,7 @@ public class ScrollableTextWidget extends Widget implements IRichTextBuilder, Interactable, IViewport, - JeiIngredientProvider { + RecipeViewerIngredientProvider { private final RichText text = new RichText(); private Consumer builder; @@ -73,8 +73,8 @@ public void drawForeground(ModularGuiContext context) { tooltip.draw(context); } } - if (getHoveredElement() instanceof IconAcessor accessor && - accessor.gregTech$getDrawable() instanceof JeiIngredientProvider provider) { + if (getHoveredElement() instanceof IIcon icon && + icon.getRootDrawable() instanceof RecipeViewerIngredientProvider provider) { lastIngredient = provider.getIngredient(); } else { lastIngredient = null; @@ -94,7 +94,7 @@ public void drawForeground(ModularGuiContext context) { } @Override - public boolean onMouseScroll(ModularScreen.UpOrDown scrollDirection, int amount) { + public boolean onMouseScroll(UpOrDown scrollDirection, int amount) { if (this.scroll.mouseScroll(getContext())) { return true; } @@ -138,7 +138,7 @@ public void transformChildren(IViewportStack stack) { @Override public void getSelfAt(IViewportStack stack, HoveredWidgetList widgets, int x, int y) { if (isInside(stack, x, y)) { - widgets.add(this, stack.peek()); + widgets.add(this, stack, getAdditionalHoverInfo(stack, x, y)); } } @@ -173,13 +173,14 @@ private void drawText(ModularGuiContext context) { } this.dirty = false; } - this.text.setupRenderer(this.renderer, getArea().getPadding().left, getArea().getPadding().top - getScrollY(), - getArea().paddedWidth(), getArea().paddedHeight(), - getWidgetTheme(context.getTheme()).getTextColor(), - getWidgetTheme(context.getTheme()).getTextShadow()); + + TextFieldTheme textFieldTheme = context.getTheme().getTextFieldTheme().getTheme(); + this.text.setupRenderer(this.renderer, getArea().getPadding().getLeft(), + getArea().getPadding().getTop() - getScrollY(), getArea().paddedWidth(), getArea().paddedHeight(), + textFieldTheme.getTextColor(), textFieldTheme.getTextShadow()); this.text.compileAndDraw(this.renderer, context, false); // this isn't perfect, but i hope it's good enough - int diff = (int) Math.ceil((this.renderer.getLastHeight() - getArea().h()) / 2); + int diff = (int) Math.ceil((this.renderer.getLastTrimmedHeight() - getArea().h()) / 2); this.scroll.getScrollY().setScrollSize(getArea().h() + Math.max(0, diff)); } @@ -187,7 +188,7 @@ private void drawText(ModularGuiContext context) { public void postDraw(ModularGuiContext context, boolean transformed) { if (!transformed) { Stencil.remove(); - this.scroll.drawScrollbar(); + this.scroll.drawScrollbar(context, context.getTheme().getScrollbarTheme().getTheme(isHovering())); } } diff --git a/src/main/java/gregtech/common/mui/widget/orefilter/ItemOreFilterTestSlot.java b/src/main/java/gregtech/common/mui/widget/orefilter/ItemOreFilterTestSlot.java index 9e16df34dfb..e316b5024cd 100644 --- a/src/main/java/gregtech/common/mui/widget/orefilter/ItemOreFilterTestSlot.java +++ b/src/main/java/gregtech/common/mui/widget/orefilter/ItemOreFilterTestSlot.java @@ -11,7 +11,7 @@ public class ItemOreFilterTestSlot extends ModularSlot { OreFilterTestSlot parent; public ItemOreFilterTestSlot() { - super(new ItemStackHandler(1), 0, true); + super(new ItemStackHandler(1), 0); } void setParent(OreFilterTestSlot parent) { diff --git a/src/main/java/gregtech/common/mui/widget/orefilter/OreFilterTestSlot.java b/src/main/java/gregtech/common/mui/widget/orefilter/OreFilterTestSlot.java index e4d0ea8648c..bbef75a510c 100644 --- a/src/main/java/gregtech/common/mui/widget/orefilter/OreFilterTestSlot.java +++ b/src/main/java/gregtech/common/mui/widget/orefilter/OreFilterTestSlot.java @@ -8,8 +8,8 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.screen.viewport.ModularGuiContext; -import com.cleanroommc.modularui.theme.WidgetTheme; -import com.cleanroommc.modularui.widgets.ItemSlot; +import com.cleanroommc.modularui.theme.WidgetThemeEntry; +import com.cleanroommc.modularui.widgets.slot.PhantomItemSlot; import it.unimi.dsi.fastutil.objects.Object2BooleanAVLTreeMap; import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import org.jetbrains.annotations.Nullable; @@ -22,7 +22,7 @@ /** * @author brachy84 */ -public class OreFilterTestSlot extends ItemSlot { +public class OreFilterTestSlot extends PhantomItemSlot { private final ItemOreFilterTestSlot slot; private Supplier globSupplier = ImpossibleOreGlob::getInstance; @@ -106,14 +106,12 @@ public void updatePreview() { } @Override - public void draw(ModularGuiContext context, WidgetTheme widgetTheme) { + public void draw(ModularGuiContext context, WidgetThemeEntry widgetTheme) { super.draw(context, widgetTheme); if (this.matchSuccess) { - GTGuiTextures.OREDICT_MATCH - .draw(context, 12, -2, 9, 6, widgetTheme); - } else if (testResult.size() > 0) { - GTGuiTextures.OREDICT_NO_MATCH - .draw(context, 12, -3, 7, 7, widgetTheme); + GTGuiTextures.OREDICT_MATCH.draw(context, 12, -2, 9, 6, widgetTheme.getTheme()); + } else if (!testResult.isEmpty()) { + GTGuiTextures.OREDICT_NO_MATCH.draw(context, 12, -3, 7, 7, widgetTheme.getTheme()); } } diff --git a/src/main/java/gregtech/common/mui/widget/workbench/CraftingInputSlot.java b/src/main/java/gregtech/common/mui/widget/workbench/CraftingInputSlot.java index 3c718d2e90c..89234810439 100644 --- a/src/main/java/gregtech/common/mui/widget/workbench/CraftingInputSlot.java +++ b/src/main/java/gregtech/common/mui/widget/workbench/CraftingInputSlot.java @@ -12,12 +12,12 @@ import com.cleanroommc.modularui.api.widget.IGuiAction; import com.cleanroommc.modularui.api.widget.Interactable; -import com.cleanroommc.modularui.integration.jei.JeiGhostIngredientSlot; -import com.cleanroommc.modularui.integration.jei.JeiIngredientProvider; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerGhostIngredientSlot; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerIngredientProvider; import com.cleanroommc.modularui.network.NetworkUtils; import com.cleanroommc.modularui.screen.RichTooltip; import com.cleanroommc.modularui.screen.viewport.ModularGuiContext; -import com.cleanroommc.modularui.theme.WidgetTheme; +import com.cleanroommc.modularui.theme.WidgetThemeEntry; import com.cleanroommc.modularui.value.sync.PanelSyncManager; import com.cleanroommc.modularui.value.sync.SyncHandler; import com.cleanroommc.modularui.widget.Widget; @@ -26,8 +26,8 @@ import org.jetbrains.annotations.Nullable; public class CraftingInputSlot extends Widget implements Interactable, - JeiGhostIngredientSlot, - JeiIngredientProvider { + RecipeViewerGhostIngredientSlot, + RecipeViewerIngredientProvider { private final InputSyncHandler syncHandler; public boolean hasIngredients = true; @@ -75,7 +75,7 @@ public boolean isValidSyncHandler(SyncHandler syncHandler) { @Override public void onInit() { - getContext().getJeiSettings().addJeiGhostIngredientSlot(this); + getContext().getRecipeViewerSettings().addRecipeViewerGhostIngredientSlot(this); } public CraftingInputSlot changeListener(IOnSlotChanged listener) { @@ -101,7 +101,7 @@ public void onMouseDrag(int mouseButton, long timeSinceClick) { } @Override - public void draw(ModularGuiContext context, WidgetTheme widgetTheme) { + public void draw(ModularGuiContext context, WidgetThemeEntry widgetTheme) { ItemStack itemstack = this.syncHandler.getStack(); boolean jeiIngredientBeingHovered = JEIUtil.hoveringOverIngredient(this); @@ -135,8 +135,8 @@ public void setGhostIngredient(@NotNull ItemStack ingredient) { @Override public @Nullable ItemStack castGhostIngredientIfValid(@NotNull Object ingredient) { - ingredient = JEIUtil.getBookStackIfEnchantment(ingredient); - return areAncestorsEnabled() && ingredient instanceof ItemStack ? (ItemStack) ingredient : null; + ItemStack stack = JEIUtil.getActualStack(ingredient); + return areAncestorsEnabled() && !stack.isEmpty() ? stack : null; } @Override diff --git a/src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java b/src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java index 6576008a0c5..f857df7dc2d 100644 --- a/src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java +++ b/src/main/java/gregtech/common/mui/widget/workbench/CraftingOutputSlot.java @@ -17,11 +17,11 @@ import net.minecraftforge.items.ItemHandlerHelper; import com.cleanroommc.modularui.api.widget.Interactable; -import com.cleanroommc.modularui.integration.jei.JeiIngredientProvider; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerIngredientProvider; import com.cleanroommc.modularui.network.NetworkUtils; import com.cleanroommc.modularui.screen.RichTooltip; import com.cleanroommc.modularui.screen.viewport.ModularGuiContext; -import com.cleanroommc.modularui.theme.WidgetTheme; +import com.cleanroommc.modularui.theme.WidgetThemeEntry; import com.cleanroommc.modularui.utils.MouseData; import com.cleanroommc.modularui.value.sync.IntSyncValue; import com.cleanroommc.modularui.value.sync.PanelSyncManager; @@ -37,7 +37,8 @@ import java.util.List; import java.util.stream.Collectors; -public class CraftingOutputSlot extends Widget implements Interactable, JeiIngredientProvider { +public class CraftingOutputSlot extends Widget implements Interactable, + RecipeViewerIngredientProvider { private static final int MOUSE_CLICK = 2; private static final int SYNC_STACK = 5; @@ -70,7 +71,7 @@ public boolean isValidSyncHandler(SyncHandler syncHandler) { } @Override - public void draw(ModularGuiContext context, WidgetTheme widgetTheme) { + public void draw(ModularGuiContext context, WidgetThemeEntry widgetTheme) { ItemStack itemstack = this.syncHandler.getOutputStack(); RenderUtil.renderItem(itemstack, 1, 1, 16, 16); RenderUtil.handleSlotOverlay(this, widgetTheme); @@ -260,7 +261,7 @@ protected static class CraftingOutputMS extends ModularSlot { public CraftingOutputMS(IntSyncValue amountCrafted, MetaTileEntityWorkbench workbench) { super(new InventoryWrapper( workbench.getCraftingRecipeLogic().getCraftingResultInventory(), - workbench.getCraftingRecipeLogic()), 0, true); + workbench.getCraftingRecipeLogic()), 0); this.amountCrafted = amountCrafted; this.recipeLogic = workbench.getCraftingRecipeLogic(); this.recipeMemory = workbench.getRecipeMemory(); diff --git a/src/main/java/gregtech/common/mui/widget/workbench/RecipeMemorySlot.java b/src/main/java/gregtech/common/mui/widget/workbench/RecipeMemorySlot.java index b33d71ee40c..d4aba3440e1 100644 --- a/src/main/java/gregtech/common/mui/widget/workbench/RecipeMemorySlot.java +++ b/src/main/java/gregtech/common/mui/widget/workbench/RecipeMemorySlot.java @@ -10,16 +10,16 @@ import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.api.widget.Interactable; -import com.cleanroommc.modularui.integration.jei.JeiIngredientProvider; +import com.cleanroommc.modularui.integration.recipeviewer.RecipeViewerIngredientProvider; import com.cleanroommc.modularui.screen.RichTooltip; import com.cleanroommc.modularui.screen.viewport.ModularGuiContext; -import com.cleanroommc.modularui.theme.WidgetTheme; +import com.cleanroommc.modularui.theme.WidgetThemeEntry; import com.cleanroommc.modularui.utils.MouseData; import com.cleanroommc.modularui.widget.Widget; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class RecipeMemorySlot extends Widget implements Interactable, JeiIngredientProvider { +public class RecipeMemorySlot extends Widget implements Interactable, RecipeViewerIngredientProvider { private final CraftingRecipeMemory memory; private final int index; @@ -44,7 +44,7 @@ public RecipeMemorySlot(CraftingRecipeMemory memory, int index) { } @Override - public void draw(ModularGuiContext context, WidgetTheme widgetTheme) { + public void draw(ModularGuiContext context, WidgetThemeEntry widgetTheme) { ItemStack itemStack = this.memory.getRecipeOutputAtIndex(this.index); if (!itemStack.isEmpty()) { @@ -56,7 +56,7 @@ public void draw(ModularGuiContext context, WidgetTheme widgetTheme) { // noinspection DataFlowIssue if (this.memory.getRecipeAtIndex(this.index).isRecipeLocked()) { GlStateManager.disableDepth(); - GTGuiTextures.RECIPE_LOCK.draw(context, 10, 1, 8, 8, widgetTheme); + GTGuiTextures.RECIPE_LOCK.draw(context, 10, 1, 8, 8, widgetTheme.getTheme()); GlStateManager.enableDepth(); } } diff --git a/src/main/java/gregtech/mixins/mui2/AbstractCycleButtonWidgetMixin.java b/src/main/java/gregtech/mixins/mui2/AbstractCycleButtonWidgetMixin.java deleted file mode 100644 index 5f72806e42e..00000000000 --- a/src/main/java/gregtech/mixins/mui2/AbstractCycleButtonWidgetMixin.java +++ /dev/null @@ -1,52 +0,0 @@ -package gregtech.mixins.mui2; - -import com.cleanroommc.modularui.api.ITheme; -import com.cleanroommc.modularui.api.drawable.IDrawable; -import com.cleanroommc.modularui.theme.WidgetTheme; -import com.cleanroommc.modularui.widget.Widget; -import com.cleanroommc.modularui.widgets.AbstractCycleButtonWidget; -import com.llamalad7.mixinextras.injector.ModifyReturnValue; -import com.llamalad7.mixinextras.sugar.Local; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; - -import java.util.Arrays; - -@Mixin(value = AbstractCycleButtonWidget.class, remap = false) -public class AbstractCycleButtonWidgetMixin> extends Widget { - - @Shadow - protected IDrawable[] hoverBackground; - - @Shadow - protected IDrawable[] hoverOverlay; - - @ModifyReturnValue(method = "getCurrentOverlay", at = @At(value = "RETURN", ordinal = 0)) - public IDrawable fixOverlay(IDrawable original, - @Local(argsOnly = true) ITheme theme, - @Local(argsOnly = true) WidgetTheme widgetTheme) { - return original != IDrawable.NONE ? original : super.getCurrentOverlay(theme, widgetTheme); - } - - @ModifyReturnValue(method = "getCurrentBackground", at = @At(value = "RETURN", ordinal = 0)) - public IDrawable fixBackground(IDrawable original, - @Local(argsOnly = true) ITheme theme, - @Local(argsOnly = true) WidgetTheme widgetTheme) { - return original != IDrawable.NONE ? original : super.getCurrentBackground(theme, widgetTheme); - } - - @Override - public W disableHoverBackground() { - if (this.hoverBackground != null) - Arrays.fill(this.hoverBackground, IDrawable.NONE); - return getThis(); - } - - @Override - public W disableHoverOverlay() { - if (this.hoverOverlay != null) - Arrays.fill(this.hoverOverlay, IDrawable.NONE); - return getThis(); - } -} diff --git a/src/main/java/gregtech/mixins/mui2/IconMixin.java b/src/main/java/gregtech/mixins/mui2/IconMixin.java deleted file mode 100644 index faaafe69d34..00000000000 --- a/src/main/java/gregtech/mixins/mui2/IconMixin.java +++ /dev/null @@ -1,38 +0,0 @@ -package gregtech.mixins.mui2; - -import gregtech.api.mui.IconAcessor; - -import com.cleanroommc.modularui.api.drawable.IDrawable; -import com.cleanroommc.modularui.api.drawable.IIcon; -import com.cleanroommc.modularui.drawable.DelegateIcon; -import com.cleanroommc.modularui.drawable.Icon; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(value = Icon.class, remap = false) -public class IconMixin implements IconAcessor { - - @Shadow - @Final - private IDrawable drawable; - - public IDrawable gregTech$getDrawable() { - return this.drawable; - } - - @Mixin(value = DelegateIcon.class, remap = false) - public static abstract class DelegateMixin implements IconAcessor { - - @Shadow - public abstract IIcon getDelegate(); - - @Override - public IDrawable gregTech$getDrawable() { - if (getDelegate() instanceof IconAcessor acessor) { - return acessor.gregTech$getDrawable(); - } - return null; - } - } -} diff --git a/src/main/java/gregtech/mixins/mui2/ItemSlotMixin.java b/src/main/java/gregtech/mixins/mui2/ItemSlotMixin.java deleted file mode 100644 index 1f7bddb0573..00000000000 --- a/src/main/java/gregtech/mixins/mui2/ItemSlotMixin.java +++ /dev/null @@ -1,41 +0,0 @@ -package gregtech.mixins.mui2; - -import gregtech.api.util.JEIUtil; - -import net.minecraft.item.ItemStack; - -import com.cleanroommc.modularui.integration.jei.ModularUIJeiPlugin; -import com.cleanroommc.modularui.widgets.ItemSlot; -import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import mezz.jei.gui.ghost.GhostIngredientDrag; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -// TODO: remove once MUI PR 146 merges into a release we use -@Mixin(value = ItemSlot.class, remap = false) -public abstract class ItemSlotMixin { - - @Shadow - public abstract @Nullable ItemStack castGhostIngredientIfValid(@NotNull Object ingredient); - - @Redirect(method = "draw", - at = @At(value = "INVOKE", - target = "Lcom/cleanroommc/modularui/integration/jei/ModularUIJeiPlugin;hasDraggingGhostIngredient()Z")) - private boolean onlyHighlightOnValidDrag() { - GhostIngredientDrag ingredientDrag = ModularUIJeiPlugin.getGhostDrag(); - if (ingredientDrag == null) return false; - Object ingredient = ingredientDrag.getIngredient(); - if (ingredient == null) return false; - return castGhostIngredientIfValid(ingredient) != null; - } - - @WrapMethod(method = "castGhostIngredientIfValid(Ljava/lang/Object;)Lnet/minecraft/item/ItemStack;") - public @Nullable ItemStack addSupportForEnchantedBooks(Object ingredient, Operation original) { - return original.call(JEIUtil.getBookStackIfEnchantment(ingredient)); - } -} diff --git a/src/main/java/gregtech/mixins/mui2/LangKeyMixin.java b/src/main/java/gregtech/mixins/mui2/LangKeyMixin.java index e13bf3c8b44..2e5e1a3f8ce 100644 --- a/src/main/java/gregtech/mixins/mui2/LangKeyMixin.java +++ b/src/main/java/gregtech/mixins/mui2/LangKeyMixin.java @@ -3,22 +3,13 @@ import com.cleanroommc.modularui.drawable.text.BaseKey; import com.cleanroommc.modularui.drawable.text.LangKey; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.jetbrains.annotations.NotNull; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.function.Supplier; // all this mixin does is switch newlines to the expected format @Mixin(value = LangKey.class, remap = false) public abstract class LangKeyMixin extends BaseKey { - @Shadow - private long time; - @ModifyExpressionValue(method = "getFormatted", at = @At(value = "INVOKE", target = "Lcom/cleanroommc/modularui/drawable/text/FontRenderHelper;formatArgs([Ljava/lang/Object;Lcom/cleanroommc/modularui/drawable/text/FormattingState;Ljava/lang/String;Z)Ljava/lang/String;")) @@ -34,11 +25,4 @@ public String getTranslateKey(String original) { public String switchNewLines(String original) { return original.replace("/n", "\n"); } - - @Inject(method = "(Ljava/util/function/Supplier;Ljava/util/function/Supplier;)V", - at = @At(value = "RETURN")) - private void setTimeToNegativeOne(@NotNull Supplier keySupplier, @NotNull Supplier argsSupplier, - CallbackInfo ci) { - time = -1; - } } diff --git a/src/main/java/gregtech/mixins/mui2/ModularPanelMixin.java b/src/main/java/gregtech/mixins/mui2/ModularPanelMixin.java deleted file mode 100644 index 78cec0e56bb..00000000000 --- a/src/main/java/gregtech/mixins/mui2/ModularPanelMixin.java +++ /dev/null @@ -1,27 +0,0 @@ -package gregtech.mixins.mui2; - -import com.cleanroommc.modularui.api.layout.IViewport; -import com.cleanroommc.modularui.integration.jei.ModularUIJeiPlugin; -import com.cleanroommc.modularui.screen.ModularPanel; -import com.cleanroommc.modularui.screen.viewport.LocatedWidget; -import com.cleanroommc.modularui.widget.ParentWidget; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(value = ModularPanel.class, remap = false) -public abstract class ModularPanelMixin extends ParentWidget implements IViewport { - - @Redirect(method = "lambda$onMousePressed$3", - at = @At(value = "INVOKE", - target = "Lcom/cleanroommc/modularui/screen/viewport/LocatedWidget;getElement()Ljava/lang/Object;", - ordinal = 1)) - private Object checkDrag(LocatedWidget instance) { - // if we're dragging something, prevent interaction - if (ModularUIJeiPlugin.hasDraggingGhostIngredient()) { - return null; - } - - return instance.getElement(); - } -} diff --git a/src/main/java/gregtech/mixins/mui2/ModularUIJeiPluginMixin.java b/src/main/java/gregtech/mixins/mui2/ModularUIJeiPluginMixin.java deleted file mode 100644 index 2f0853cb4f1..00000000000 --- a/src/main/java/gregtech/mixins/mui2/ModularUIJeiPluginMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package gregtech.mixins.mui2; - -import com.cleanroommc.modularui.integration.jei.JeiGhostIngredientSlot; -import com.cleanroommc.modularui.integration.jei.ModularUIJeiPlugin; -import mezz.jei.config.Config; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value = ModularUIJeiPlugin.class) -public class ModularUIJeiPluginMixin { - - // TODO: remove this mixin when the fix from Brachy makes it into a release we use - @Inject(method = "hoveringOverIngredient", at = @At(value = "HEAD"), remap = false, cancellable = true) - private static void cancelIfCheatsOn(JeiGhostIngredientSlot ingredientSlot, - CallbackInfoReturnable cir) { - if (Config.isCheatItemsEnabled()) { - cir.setReturnValue(false); - } - } -} diff --git a/src/main/java/gregtech/mixins/mui2/RichTextCompilerMixin.java b/src/main/java/gregtech/mixins/mui2/RichTextCompilerMixin.java deleted file mode 100644 index 79c44c7d20b..00000000000 --- a/src/main/java/gregtech/mixins/mui2/RichTextCompilerMixin.java +++ /dev/null @@ -1,41 +0,0 @@ -package gregtech.mixins.mui2; - -import net.minecraft.client.gui.FontRenderer; - -import com.cleanroommc.modularui.api.drawable.IKey; -import com.cleanroommc.modularui.drawable.text.RichTextCompiler; -import com.llamalad7.mixinextras.sugar.Local; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.List; - -@Mixin(value = RichTextCompiler.class, remap = false) -public class RichTextCompilerMixin { - - @Shadow - private int x; - - @Shadow - private FontRenderer fr; - - @ModifyArg(method = "trimRight", - at = @At(value = "INVOKE", - target = "Ljava/lang/String;substring(II)Ljava/lang/String;"), - index = 1) - private static int fixTrim(int beginIndex) { - return beginIndex + 1; - } - - @Inject(method = "compile", - at = @At(value = "INVOKE", - target = "Lcom/cleanroommc/modularui/drawable/text/RichTextCompiler;addLineElement(Ljava/lang/Object;)V", - ordinal = 0)) - private void moveXString(List raw, CallbackInfo ci, @Local IKey key) { - x += fr.getStringWidth(key.get()); - } -} diff --git a/src/main/resources/mixins.gregtech.mui2.json b/src/main/resources/mixins.gregtech.mui2.json index fccde409ebd..427113e6ac8 100644 --- a/src/main/resources/mixins.gregtech.mui2.json +++ b/src/main/resources/mixins.gregtech.mui2.json @@ -7,17 +7,9 @@ "injectors": { "maxShiftBy": 10 }, - "mixins": [ - "AbstractCycleButtonWidgetMixin", - "IconMixin", - "IconMixin$DelegateMixin", - "ModularPanelMixin", - "RichTextCompilerMixin" - ], + "mixins": [], "client": [ - "LangKeyMixin", - "ModularUIJeiPluginMixin", - "ItemSlotMixin" + "LangKeyMixin" ], "server": [] }