From 83d2848f118d467bd8de73ccc4a0d66cd2b58a74 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Fri, 24 Apr 2026 10:56:42 +1000 Subject: [PATCH 1/8] make GTGuiTextures an interface like mui gui textures --- .../gtceu/common/mui/GTGuiTextures.java | 578 +++++++++--------- 1 file changed, 290 insertions(+), 288 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTGuiTextures.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTGuiTextures.java index 006273103ff..5ad2246b3a5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTGuiTextures.java +++ b/src/main/java/com/gregtechceu/gtceu/common/mui/GTGuiTextures.java @@ -9,51 +9,53 @@ import brachy.modularui.drawable.ColorType; import brachy.modularui.drawable.TabTexture; import brachy.modularui.drawable.UITexture; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; @SuppressWarnings("unused") -public class GTGuiTextures { +@ApiStatus.NonExtendable +public interface GTGuiTextures { /** Keys used for GT assets registered for use in Themes */ - public static class IDs { + interface IDs { - public static final String STANDARD_BACKGROUND = "gregtech_standard_bg"; - public static final String STANDARD_BACKGROUND_INVERSE = "gregtech_standard_inverse_bg"; - public static final String COVER_BACKGROUND = "gregtech_cover_bg"; - public static final String BRONZE_BACKGROUND = "gregtech_bronze_bg"; - public static final String STEEL_BACKGROUND = "gregtech_steel_bg"; - public static final String PRIMITIVE_BACKGROUND = "gregtech_primitive_bg"; + String STANDARD_BACKGROUND = "gregtech_standard_bg"; + String STANDARD_BACKGROUND_INVERSE = "gregtech_standard_inverse_bg"; + String COVER_BACKGROUND = "gregtech_cover_bg"; + String BRONZE_BACKGROUND = "gregtech_bronze_bg"; + String STEEL_BACKGROUND = "gregtech_steel_bg"; + String PRIMITIVE_BACKGROUND = "gregtech_primitive_bg"; - public static final String STANDARD_SLOT = "gregtech_standard_slot"; - public static final String BRONZE_SLOT = "gregtech_bronze_slot"; - public static final String STEEL_SLOT = "gregtech_steel_slot"; - public static final String PRIMITIVE_SLOT = "gregtech_primitive_slot"; + String STANDARD_SLOT = "gregtech_standard_slot"; + String BRONZE_SLOT = "gregtech_bronze_slot"; + String STEEL_SLOT = "gregtech_steel_slot"; + String PRIMITIVE_SLOT = "gregtech_primitive_slot"; - public static final String STANDARD_FLUID_SLOT = "gregtech_standard_fluid_slot"; + String STANDARD_FLUID_SLOT = "gregtech_standard_fluid_slot"; - public static final String STANDARD_BUTTON = "gregtech_standard_button"; + String STANDARD_BUTTON = "gregtech_standard_button"; } - public static final ResourceLocation MONOCRAFT_FONT = GTCEu.id("monocraft"); + ResourceLocation MONOCRAFT_FONT = GTCEu.id("monocraft"); // ICONS /** @apiNote You may want {@link GTGuiTextures#getLogo} instead. */ - public static final UITexture GREGTECH_LOGO = fullImage("textures/gui/icon/gregtech_logo.png"); + UITexture GREGTECH_LOGO = fullImage("textures/gui/icon/gregtech_logo.png"); /** @apiNote You may want {@link GTGuiTextures#getLogo} instead. */ - 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"); + UITexture GREGTECH_LOGO_XMAS = fullImage("textures/gui/icon/gregtech_logo_xmas.png"); + UITexture GREGTECH_LOGO_DARK = fullImage("textures/gui/icon/gregtech_logo_dark.png"); // todo blinking GT logos - public static final UITexture INDICATOR_NO_ENERGY = fullImage("textures/gui/base/indicator_no_energy.png"); - public static final UITexture INDICATOR_NO_STEAM_BRONZE = fullImage( + UITexture INDICATOR_NO_ENERGY = fullImage("textures/gui/base/indicator_no_energy.png"); + UITexture INDICATOR_NO_STEAM_BRONZE = fullImage( "textures/gui/base/indicator_no_steam_bronze.png"); - public static final UITexture INDICATOR_NO_STEAM_STEEL = fullImage( + UITexture INDICATOR_NO_STEAM_STEEL = fullImage( "textures/gui/base/indicator_no_steam_steel.png"); - public static final UITexture TANK_ICON = fullImage("textures/gui/base/tank_icon.png"); + UITexture TANK_ICON = fullImage("textures/gui/base/tank_icon.png"); // BACKGROUNDS - public static final UITexture BACKGROUND = UITexture.builder() + UITexture BACKGROUND = UITexture.builder() .location(GTCEu.MOD_ID, "textures/gui/base/background.png") .imageSize(16, 16) .adaptable(4) @@ -61,7 +63,7 @@ public static class IDs { .defaultColorType() .build(); - public static final UITexture BACKGROUND_POPUP = UITexture.builder() + UITexture BACKGROUND_POPUP = UITexture.builder() .location(GTCEu.MOD_ID, "textures/gui/base/background_popup.png") .imageSize(195, 136) .adaptable(4) @@ -69,7 +71,7 @@ public static class IDs { .canApplyTheme() .build(); - public static final UITexture BACKGROUND_INVERSE = UITexture.builder() + UITexture BACKGROUND_INVERSE = UITexture.builder() .location(GTCEu.MOD_ID, "textures/gui/base/background_inverse.png") .imageSize(16, 16) .adaptable(3) @@ -77,24 +79,24 @@ public static class IDs { .canApplyTheme() .build(); - public static final UITexture BACKGROUND_BRONZE = UITexture.builder() + UITexture BACKGROUND_BRONZE = UITexture.builder() .location(GTCEu.MOD_ID, "textures/gui/base/background_bronze.png") .imageSize(16, 16) .adaptable(4) .name(IDs.BRONZE_BACKGROUND) .build(); - public static final UITexture BACKGROUND_STEEL = UITexture.builder() + UITexture BACKGROUND_STEEL = UITexture.builder() .location(GTCEu.MOD_ID, "textures/gui/base/background_steel.png") .imageSize(16, 16) .adaptable(4) .name(IDs.STEEL_BACKGROUND) .build(); - public static final UITexture BLANK_TRANSPARENT = fullImage("textures/gui/base/blank_transparent.png"); + UITexture BLANK_TRANSPARENT = fullImage("textures/gui/base/blank_transparent.png"); // todo move to textures/gui/base - public static final UITexture BACKGROUND_PRIMITIVE = UITexture.builder() + UITexture BACKGROUND_PRIMITIVE = UITexture.builder() .location(GTCEu.MOD_ID, "textures/gui/primitive/primitive_background.png") .imageSize(176, 166) .adaptable(3) @@ -104,18 +106,18 @@ public static class IDs { // todo clipboard backgrounds, may deserve some redoing // DISPLAYS - public static final UITexture DISPLAY = new UITexture.Builder() + UITexture DISPLAY = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/base/display.png") .imageSize(182, 117) .canApplyTheme() .build(); - public static final UITexture DISPLAY_BRONZE = new UITexture.Builder() + UITexture DISPLAY_BRONZE = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/base/display_bronze.png") .imageSize(162, 121) .build(); - public static final UITexture DISPLAY_STEEL = new UITexture.Builder() + UITexture DISPLAY_STEEL = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/base/display_steel.png") .imageSize(162, 121) .adaptable(1) @@ -124,7 +126,7 @@ public static class IDs { // todo primitive display? // SLOTS - public static final UITexture SLOT = new UITexture.Builder() + UITexture SLOT = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/base/slot.png") .imageSize(18, 18) .adaptable(1) @@ -132,14 +134,14 @@ public static class IDs { .canApplyTheme() .build(); - public static final UITexture SLOT_BRONZE = new UITexture.Builder() + UITexture SLOT_BRONZE = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/base/slot_bronze.png") .imageSize(18, 18) .adaptable(1) .name(IDs.BRONZE_SLOT) .build(); - public static final UITexture SLOT_STEEL = new UITexture.Builder() + UITexture SLOT_STEEL = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/base/slot_steel.png") .imageSize(18, 18) .adaptable(1) @@ -147,14 +149,14 @@ public static class IDs { .build(); // todo move to textures/gui/base - public static final UITexture SLOT_PRIMITIVE = new UITexture.Builder() + UITexture SLOT_PRIMITIVE = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/primitive/primitive_slot.png") .imageSize(18, 18) .adaptable(1) .name(IDs.PRIMITIVE_SLOT) .build(); - public static final UITexture FLUID_SLOT = new UITexture.Builder() + UITexture FLUID_SLOT = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/base/fluid_slot.png") .imageSize(18, 18) .adaptable(1) @@ -162,271 +164,271 @@ public static class IDs { .canApplyTheme() .build(); - public static final UITexture[] BUTTON_POWER = slice("textures/gui/widget/button_power.png", 16, 32, 16, 16, + UITexture[] BUTTON_POWER = slice("textures/gui/widget/button_power.png", 16, 32, 16, 16, ColorType.DEFAULT); - public static final UITexture BUTTON_BLACKLIST = fullImage("textures/gui/widget/button_blacklist.png", + UITexture BUTTON_BLACKLIST = fullImage("textures/gui/widget/button_blacklist.png", ColorType.DEFAULT); - public static final UITexture[] BUTTON_IGNORE_DAMAGE = slice("textures/gui/widget/button_filter_damage.png", + UITexture[] BUTTON_IGNORE_DAMAGE = slice("textures/gui/widget/button_filter_damage.png", 16, 32, 16, 16, ColorType.DEFAULT); - public static final UITexture BUTTON_IGNORE_NBT = fullImage("textures/gui/widget/button_filter_nbt.png", + UITexture BUTTON_IGNORE_NBT = fullImage("textures/gui/widget/button_filter_nbt.png", ColorType.DEFAULT); - public static final UITexture[] BUTTON_CASE_SENSITIVE = slice( + UITexture[] BUTTON_CASE_SENSITIVE = slice( "textures/gui/widget/ore_filter/button_case_sensitive.png", 16, 32, 16, 16, ColorType.DEFAULT); - public static final UITexture[] BUTTON_MATCH_ALL = slice("textures/gui/widget/ore_filter/button_match_all.png", + UITexture[] BUTTON_MATCH_ALL = slice("textures/gui/widget/ore_filter/button_match_all.png", 16, 32, 16, 16, ColorType.DEFAULT); - public static final UITexture BUTTON_LOCK = fullImage("textures/gui/widget/button_lock.png"); + UITexture BUTTON_LOCK = fullImage("textures/gui/widget/button_lock.png"); - public static final UITexture OREDICT_ERROR = fullImage("textures/gui/widget/ore_filter/error.png"); - public static final UITexture OREDICT_INFO = fullImage("textures/gui/widget/ore_filter/info.png"); - public static final UITexture OREDICT_MATCH = fullImage("textures/gui/widget/ore_filter/match.png"); - public static final UITexture OREDICT_NO_MATCH = fullImage("textures/gui/widget/ore_filter/no_match.png"); - public static final UITexture OREDICT_SUCCESS = fullImage("textures/gui/widget/ore_filter/success.png"); - public static final UITexture OREDICT_WAITING = fullImage("textures/gui/widget/ore_filter/waiting.png"); - public static final UITexture OREDICT_WARN = fullImage("textures/gui/widget/ore_filter/warn.png"); + UITexture OREDICT_ERROR = fullImage("textures/gui/widget/ore_filter/error.png"); + UITexture OREDICT_INFO = fullImage("textures/gui/widget/ore_filter/info.png"); + UITexture OREDICT_MATCH = fullImage("textures/gui/widget/ore_filter/match.png"); + UITexture OREDICT_NO_MATCH = fullImage("textures/gui/widget/ore_filter/no_match.png"); + UITexture OREDICT_SUCCESS = fullImage("textures/gui/widget/ore_filter/success.png"); + UITexture OREDICT_WAITING = fullImage("textures/gui/widget/ore_filter/waiting.png"); + UITexture OREDICT_WARN = fullImage("textures/gui/widget/ore_filter/warn.png"); - public static final UITexture INFO = fullImage("textures/gui/widget/information.png"); + UITexture INFO = fullImage("textures/gui/widget/information.png"); - public static final UITexture[] MANUAL_IO_OVERLAY_IN = { fullImage("textures/gui/icon/manual_io_mode/disabled.png"), + UITexture[] MANUAL_IO_OVERLAY_IN = { fullImage("textures/gui/icon/manual_io_mode/disabled.png"), fullImage("textures/gui/icon/manual_io_mode/filtered.png"), fullImage("textures/gui/icon/manual_io_mode/unfiltered.png") }; - public static final UITexture[] MANUAL_IO_OVERLAY_OUT = slice("textures/gui/overlay/manual_io_overlay_out.png", + UITexture[] MANUAL_IO_OVERLAY_OUT = slice("textures/gui/overlay/manual_io_overlay_out.png", 18, 18 * 3, 18, 18, ColorType.DEFAULT); - public static final UITexture[] CONVEYOR_MODE_OVERLAY = slice("textures/gui/overlay/conveyor_mode_overlay.png", + UITexture[] CONVEYOR_MODE_OVERLAY = slice("textures/gui/overlay/conveyor_mode_overlay.png", 18, 18 * 2, 18, 18, ColorType.DEFAULT); - public static final UITexture[] TRANSFER_MODE_OVERLAY = slice("textures/gui/overlay/transfer_mode_overlay.png", + UITexture[] TRANSFER_MODE_OVERLAY = slice("textures/gui/overlay/transfer_mode_overlay.png", 40, 40 * 3, 40, 40, ColorType.DEFAULT); - public static final UITexture[] BUTTON_DISTINCT = slice( + UITexture[] BUTTON_DISTINCT = slice( "textures/gui/widget/button_distinct_buses.png", 16, 32, 16, 16, ColorType.DEFAULT); - public static final UITexture[] FLUID_TRANSFER_MODE_OVERLAY = slice( + UITexture[] FLUID_TRANSFER_MODE_OVERLAY = slice( "textures/gui/overlay/fluid_transfer_mode_overlay.png", 18, 18 * 3, 18, 18, ColorType.DEFAULT); - public static final UITexture[] DISTRIBUTION_MODE_OVERLAY = slice( + UITexture[] DISTRIBUTION_MODE_OVERLAY = slice( "textures/gui/widget/button_distribution_mode.png", 16, 48, 16, 16, ColorType.DEFAULT); - public static final UITexture[] VOIDING_MODES = { fullImage("textures/gui/icon/voiding_mode/void_any.png"), + UITexture[] VOIDING_MODES = { fullImage("textures/gui/icon/voiding_mode/void_any.png"), fullImage("textures/gui/icon/voiding_mode/void_overflow.png") }; - public static final UITexture BUTTON_VOID = fullImage("textures/gui/widget/button_void.png"); + UITexture BUTTON_VOID = fullImage("textures/gui/widget/button_void.png"); - public static final UITexture BUTTON_VOID_PARTIAL = fullImage("textures/gui/widget/button_void_partial.png"); + UITexture BUTTON_VOID_PARTIAL = fullImage("textures/gui/widget/button_void_partial.png"); - public static final UITexture[] BUTTON_VOID_MULTIBLOCK = slice("textures/gui/widget/button_void_multiblock.png", + UITexture[] BUTTON_VOID_MULTIBLOCK = slice("textures/gui/widget/button_void_multiblock.png", 16, 48, 16, 16, ColorType.DEFAULT); - public static final UITexture[] FILTER_MODE_OVERLAY = slice( + UITexture[] FILTER_MODE_OVERLAY = slice( "textures/gui/overlay/filter_mode_overlay.png", 16, 48, 16, 16, ColorType.DEFAULT); - public static final UITexture[] PRIVATE_MODE_BUTTON = slice( + UITexture[] PRIVATE_MODE_BUTTON = slice( "textures/gui/widget/button_public_private.png", 18, 36, 18, 18, ColorType.DEFAULT); - public static final UITexture MENU_OVERLAY = fullImage("textures/gui/overlay/menu_overlay.png"); + UITexture MENU_OVERLAY = fullImage("textures/gui/overlay/menu_overlay.png"); - public static final UITexture RECIPE_LOCK = fullImage("textures/gui/widget/lock.png"); + UITexture RECIPE_LOCK = fullImage("textures/gui/widget/lock.png"); // todo bronze/steel/primitive fluid slots? // SLOT OVERLAYS - public static final UITexture ATOMIC_OVERLAY_1 = fullImage("textures/gui/overlay/atomic_overlay_1.png", + 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", + 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", + 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", + UITexture ARROW_OUTPUT_OVERLAY = fullImage("textures/gui/overlay/arrow_output_overlay.png", ColorType.DEFAULT); - public static final UITexture BATTERY_OVERLAY = fullImage("textures/gui/overlay/battery_overlay.png", + 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", + 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", + 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", + 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", + 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", + 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", + UITexture BOX_OVERLAY = fullImage("textures/gui/overlay/box_overlay.png", ColorType.DEFAULT); + 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", + 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", + 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", + 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", + UITexture CANISTER_OVERLAY = fullImage("textures/gui/overlay/canister_overlay.png", ColorType.DEFAULT); - public static final UITexture CANISTER_OVERLAY_BRONZE = fullImage( + 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", + UITexture CANISTER_OVERLAY_STEEL = fullImage("textures/gui/overlay/canister_overlay_steel.png"); + 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", + 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", + UITexture COAL_OVERLAY_BRONZE = fullImage("textures/gui/overlay/coal_overlay_bronze.png"); + UITexture COAL_OVERLAY_STEEL = fullImage("textures/gui/overlay/coal_overlay_steel.png"); + UITexture COMPRESSOR_OVERLAY = fullImage("textures/gui/overlay/compressor_overlay.png", ColorType.DEFAULT); - public static final UITexture COMPRESSOR_OVERLAY_BRONZE = fullImage( + UITexture COMPRESSOR_OVERLAY_BRONZE = fullImage( "textures/gui/overlay/compressor_overlay_bronze.png"); - public static final UITexture COMPRESSOR_OVERLAY_STEEL = fullImage( + 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", + 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", + 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", + UITexture CRUSHED_ORE_OVERLAY = fullImage("textures/gui/overlay/crushed_ore_overlay.png", ColorType.DEFAULT); - public static final UITexture CRUSHED_ORE_OVERLAY_BRONZE = fullImage( + UITexture CRUSHED_ORE_OVERLAY_BRONZE = fullImage( "textures/gui/overlay/crushed_ore_overlay_bronze.png"); - public static final UITexture CRUSHED_ORE_OVERLAY_STEEL = fullImage( + 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", + 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", + 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", + UITexture DARK_CANISTER_OVERLAY = fullImage("textures/gui/overlay/dark_canister_overlay.png", 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 PRIMITIVE_DUST_OVERLAY = fullImage( + UITexture DUST_OVERLAY = fullImage("textures/gui/overlay/dust_overlay.png", ColorType.DEFAULT); + UITexture DUST_OVERLAY_BRONZE = fullImage("textures/gui/overlay/dust_overlay_bronze.png"); + UITexture DUST_OVERLAY_STEEL = fullImage("textures/gui/overlay/dust_overlay_steel.png"); + UITexture PRIMITIVE_DUST_OVERLAY = fullImage( "textures/gui/primitive/overlay_primitive_dust.png", ColorType.DEFAULT); - public static final UITexture EXTRACTOR_OVERLAY = fullImage("textures/gui/overlay/extractor_overlay.png", + UITexture EXTRACTOR_OVERLAY = fullImage("textures/gui/overlay/extractor_overlay.png", ColorType.DEFAULT); - public static final UITexture EXTRACTOR_OVERLAY_BRONZE = fullImage( + UITexture EXTRACTOR_OVERLAY_BRONZE = fullImage( "textures/gui/overlay/extractor_overlay_bronze.png"); - public static final UITexture EXTRACTOR_OVERLAY_STEEL = fullImage( + 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", + UITexture FILTER_SLOT_OVERLAY = fullImage("textures/gui/overlay/filter_slot_overlay.png", ColorType.DEFAULT); - public static final UITexture FILTER_SETTINGS_OVERLAY = fullImage( + UITexture FILTER_SETTINGS_OVERLAY = fullImage( "textures/gui/overlay/filter_settings_overlay.png", ColorType.DEFAULT); - public static final UITexture FURNACE_OVERLAY_1 = fullImage("textures/gui/overlay/furnace_overlay_1.png", + 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", + 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 PRIMITIVE_FURNACE_OVERLAY = fullImage( + UITexture FURNACE_OVERLAY_BRONZE = fullImage("textures/gui/overlay/furnace_overlay_bronze.png"); + UITexture FURNACE_OVERLAY_STEEL = fullImage("textures/gui/overlay/furnace_overlay_steel.png"); + UITexture PRIMITIVE_FURNACE_OVERLAY = fullImage( "textures/gui/primitive/overlay_primitive_furnace.png", ColorType.DEFAULT); - public static final UITexture PRIMITIVE_LARGE_FLUID_TANK = fullImage( + UITexture PRIMITIVE_LARGE_FLUID_TANK = fullImage( "textures/gui/primitive/primitive_large_fluid_tank.png", ColorType.DEFAULT); - public static final UITexture PRIMITIVE_LARGE_FLUID_TANK_OVERLAY = fullImage( + UITexture PRIMITIVE_LARGE_FLUID_TANK_OVERLAY = fullImage( "textures/gui/primitive/primitive_large_fluid_tank_overlay.png", ColorType.DEFAULT); - public static final UITexture HAMMER_OVERLAY = fullImage("textures/gui/overlay/hammer_overlay.png", + 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", + UITexture HAMMER_OVERLAY_BRONZE = fullImage("textures/gui/overlay/hammer_overlay_bronze.png"); + UITexture HAMMER_OVERLAY_STEEL = fullImage("textures/gui/overlay/hammer_overlay_steel.png"); + 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", + 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", + 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", + 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", + 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", + UITexture IN_SLOT_OVERLAY_BRONZE = fullImage("textures/gui/overlay/in_slot_overlay_bronze.png"); + UITexture IN_SLOT_OVERLAY_STEEL = fullImage("textures/gui/overlay/in_slot_overlay_steel.png"); + UITexture INGOT_OVERLAY = fullImage("textures/gui/overlay/ingot_overlay.png", ColorType.DEFAULT); - public static final UITexture PRIMITIVE_INGOT_OVERLAY = fullImage( + UITexture PRIMITIVE_INGOT_OVERLAY = fullImage( "textures/gui/primitive/overlay_primitive_ingot.png", ColorType.DEFAULT); - public static final UITexture INT_CIRCUIT_OVERLAY = fullImage("textures/gui/overlay/int_circuit_overlay.png", + 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", + UITexture LENS_OVERLAY = fullImage("textures/gui/overlay/lens_overlay.png", ColorType.DEFAULT); + 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", + 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", + UITexture MOLD_OVERLAY = fullImage("textures/gui/overlay/mold_overlay.png", ColorType.DEFAULT); + 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", + 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", + 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", + 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", + UITexture OUT_SLOT_OVERLAY = fullImage("textures/gui/overlay/out_slot_overlay.png", ColorType.DEFAULT); - public static final UITexture OUT_SLOT_OVERLAY_BRONZE = fullImage( + 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", + UITexture OUT_SLOT_OVERLAY_STEEL = fullImage("textures/gui/overlay/out_slot_overlay_steel.png"); + UITexture PAPER_OVERLAY = fullImage("textures/gui/overlay/paper_overlay.png", ColorType.DEFAULT); - public static final UITexture PATTERN_OVERLAY = fullImage("textures/gui/widget/pattern_overlay.png", + UITexture PATTERN_OVERLAY = fullImage("textures/gui/widget/pattern_overlay.png", ColorType.DEFAULT); - public static final UITexture PRINTED_PAPER_OVERLAY = fullImage("textures/gui/overlay/printed_paper_overlay.png", + UITexture PRINTED_PAPER_OVERLAY = fullImage("textures/gui/overlay/printed_paper_overlay.png", ColorType.DEFAULT); - public static final UITexture PIPE_OVERLAY_2 = fullImage("textures/gui/overlay/pipe_overlay_2.png", + 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", + 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", + 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", + 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", + 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", + UITexture PRESS_OVERLAY_4 = fullImage("textures/gui/overlay/press_overlay_4.png", ColorType.DEFAULT); - public static final UITexture REFUND_OVERLAY = fullImage("textures/gui/widget/refund_overlay.png", + UITexture REFUND_OVERLAY = fullImage("textures/gui/widget/refund_overlay.png", ColorType.DEFAULT); - public static final UITexture SAWBLADE_OVERLAY = fullImage("textures/gui/overlay/sawblade_overlay.png", + 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", + 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", + 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", + 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", + 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", + 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", + 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", + UITexture WIREMILL_OVERLAY = fullImage("textures/gui/overlay/wiremill_overlay.png", ColorType.DEFAULT); - public static final UITexture POSITIVE_MATTER_OVERLAY = fullImage( + UITexture POSITIVE_MATTER_OVERLAY = fullImage( "textures/gui/overlay/positive_matter_overlay.png", ColorType.DEFAULT); - public static final UITexture NEUTRAL_MATTER_OVERLAY = fullImage("textures/gui/overlay/neutral_matter_overlay.png", + UITexture NEUTRAL_MATTER_OVERLAY = fullImage("textures/gui/overlay/neutral_matter_overlay.png", ColorType.DEFAULT); - public static final UITexture DATA_ORB_OVERLAY = fullImage("textures/gui/overlay/data_orb_overlay.png", + 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", + 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", + UITexture DUCT_TAPE_OVERLAY = fullImage("textures/gui/overlay/duct_tape_overlay.png", ColorType.DEFAULT); - public static final UITexture RESEARCH_STATION_OVERLAY = fullImage( + UITexture RESEARCH_STATION_OVERLAY = fullImage( "textures/gui/overlay/research_station_overlay.png", ColorType.DEFAULT); - public static final UITexture OVERLAY_REDSTONE_ON = fullImage("textures/gui/overlay/redstone_on.png"); - public static final UITexture OVERLAY_REDSTONE_OFF = fullImage("textures/gui/overlay/redstone_off.png"); + UITexture OVERLAY_REDSTONE_ON = fullImage("textures/gui/overlay/redstone_on.png"); + UITexture OVERLAY_REDSTONE_OFF = fullImage("textures/gui/overlay/redstone_off.png"); // BUTTONS - public static final UITexture BUTTON = new UITexture.Builder() + UITexture BUTTON = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/widget/button.png") .imageSize(32, 32) .adaptable(2) @@ -436,254 +438,254 @@ public static class IDs { // BUTTON OVERLAYS - public static final UITexture BUTTON_ITEM_OUTPUT = fullImage("textures/gui/widget/button_item_output_overlay.png"); - public static final UITexture BUTTON_FLUID_OUTPUT = fullImage( + UITexture BUTTON_ITEM_OUTPUT = fullImage("textures/gui/widget/button_item_output_overlay.png"); + UITexture BUTTON_FLUID_OUTPUT = fullImage( "textures/gui/widget/button_fluid_output_overlay.png"); - public static final UITexture BUTTON_AUTO_COLLAPSE = fullImage( + 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", ColorType.DEFAULT); - public static final UITexture BUTTON_CLEAR_GRID = fullImage("textures/gui/widget/button_clear_grid.png", null); + UITexture BUTTON_X = fullImage("textures/gui/widget/button_x_overlay.png", ColorType.DEFAULT); + UITexture BUTTON_CLEAR_GRID = fullImage("textures/gui/widget/button_clear_grid.png", null); - public static final UITexture BUTTON_CROSS = fullImage("textures/gui/widget/button_clear_grid.png"); - public static final UITexture BUTTON_DETECTOR_INVERT = fullImage( + UITexture BUTTON_CROSS = fullImage("textures/gui/widget/button_clear_grid.png"); + UITexture BUTTON_DETECTOR_INVERT = fullImage( "textures/gui/widget/button_detector_cover_inverted.png"); - public static final UITexture BUTTON_REDSTONE_ON = fullImage("textures/gui/widget/button_redstone_on.png"); - public static final UITexture BUTTON_REDSTONE_OFF = fullImage("textures/gui/widget/button_redstone_off.png"); - public static final UITexture BUTTON_THROTTLE_PLUS = fullImage("textures/gui/widget/button_throttle_plus.png"); - public static final UITexture BUTTON_THROTTLE_MINUS = fullImage("textures/gui/widget/button_throttle_minus.png"); - public static final UITexture BUTTON_EU = fullImage("textures/gui/overlay/mode_eu.png"); - public static final UITexture BUTTON_PERCENT = fullImage("textures/gui/overlay/mode_percent.png"); - public static final UITexture BUTTON_MAINTENANCE = fullImage("textures/gui/widget/button_maintenance.png"); + UITexture BUTTON_REDSTONE_ON = fullImage("textures/gui/widget/button_redstone_on.png"); + UITexture BUTTON_REDSTONE_OFF = fullImage("textures/gui/widget/button_redstone_off.png"); + UITexture BUTTON_THROTTLE_PLUS = fullImage("textures/gui/widget/button_throttle_plus.png"); + UITexture BUTTON_THROTTLE_MINUS = fullImage("textures/gui/widget/button_throttle_minus.png"); + UITexture BUTTON_EU = fullImage("textures/gui/overlay/mode_eu.png"); + UITexture BUTTON_PERCENT = fullImage("textures/gui/overlay/mode_percent.png"); + UITexture BUTTON_MAINTENANCE = fullImage("textures/gui/widget/button_maintenance.png"); - public static final UITexture BUTTON_AUTO_PULL = fullImage("textures/gui/widget/button_me_auto_pull.png"); + UITexture BUTTON_AUTO_PULL = fullImage("textures/gui/widget/button_me_auto_pull.png"); // PROGRESS BARS - public static final UITexture PROGRESS_BAR_ARC_FURNACE = progressBar( + UITexture PROGRESS_BAR_ARC_FURNACE = progressBar( "textures/gui/progress_bar/progress_bar_arc_furnace.png", ColorType.DEFAULT); - public static final UITexture PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = progressBar( + UITexture PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = progressBar( "textures/gui/primitive/progress_bar_primitive_blast_furnace.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_ARROW = progressBar("textures/gui/progress_bar/progress_bar_arrow.png", + UITexture PROGRESS_BAR_ARROW = progressBar("textures/gui/progress_bar/progress_bar_arrow.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_ARROW_BRONZE = progressBar( + UITexture PROGRESS_BAR_ARROW_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_arrow_bronze.png"); - public static final UITexture PROGRESS_BAR_ARROW_STEEL = progressBar( + UITexture PROGRESS_BAR_ARROW_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_arrow_steel.png"); - public static final UITexture PROGRESS_BAR_ARROW_MULTIPLE = progressBar( + UITexture PROGRESS_BAR_ARROW_MULTIPLE = progressBar( "textures/gui/progress_bar/progress_bar_arrow_multiple.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_ASSEMBLER = progressBar( + UITexture PROGRESS_BAR_ASSEMBLER = progressBar( "textures/gui/progress_bar/progress_bar_assembler.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_BATH = progressBar("textures/gui/progress_bar/progress_bar_bath.png", + UITexture PROGRESS_BAR_BATH = progressBar("textures/gui/progress_bar/progress_bar_bath.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_BENDING = progressBar( + UITexture PROGRESS_BAR_BENDING = progressBar( "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", + UITexture PROGRESS_BAR_CANNER = progressBar("textures/gui/progress_bar/progress_bar_canner.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_CIRCUIT = progressBar( + UITexture PROGRESS_BAR_CIRCUIT = progressBar( "textures/gui/progress_bar/progress_bar_circuit.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_CIRCUIT_ASSEMBLER = progressBar( + UITexture PROGRESS_BAR_CIRCUIT_ASSEMBLER = progressBar( "textures/gui/progress_bar/progress_bar_circuit_assembler.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_COMPRESS = progressBar( + UITexture PROGRESS_BAR_COMPRESS = progressBar( "textures/gui/progress_bar/progress_bar_compress.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_COMPRESS_BRONZE = progressBar( + UITexture PROGRESS_BAR_COMPRESS_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_compress_bronze.png"); - public static final UITexture PROGRESS_BAR_COMPRESS_STEEL = progressBar( + UITexture PROGRESS_BAR_COMPRESS_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_compress_steel.png"); - public static final UITexture PROGRESS_BAR_CRACKING = progressBar( + UITexture PROGRESS_BAR_CRACKING = progressBar( "textures/gui/progress_bar/progress_bar_cracking.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_CRACKING_INPUT = progressBar( + UITexture PROGRESS_BAR_CRACKING_INPUT = progressBar( "textures/gui/progress_bar/progress_bar_cracking_2.png", 21, 38, ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_CRYSTALLIZATION = progressBar( + UITexture PROGRESS_BAR_CRYSTALLIZATION = progressBar( "textures/gui/progress_bar/progress_bar_crystallization.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_EXTRACT = progressBar( + UITexture PROGRESS_BAR_EXTRACT = progressBar( "textures/gui/progress_bar/progress_bar_extract.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_EXTRACT_BRONZE = progressBar( + UITexture PROGRESS_BAR_EXTRACT_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_extract_bronze.png"); - public static final UITexture PROGRESS_BAR_EXTRACT_STEEL = progressBar( + UITexture PROGRESS_BAR_EXTRACT_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_extract_steel.png"); - public static final UITexture PROGRESS_BAR_EXTRUDER = progressBar( + UITexture PROGRESS_BAR_EXTRUDER = progressBar( "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", + UITexture PROGRESS_BAR_FUSION = progressBar("textures/gui/progress_bar/progress_bar_fusion.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_GAS_COLLECTOR = progressBar( + UITexture PROGRESS_BAR_GAS_COLLECTOR = progressBar( "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", + UITexture PROGRESS_BAR_HAMMER = progressBar("textures/gui/progress_bar/progress_bar_hammer.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_HAMMER_BRONZE = progressBar( + UITexture PROGRESS_BAR_HAMMER_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_hammer_bronze.png"); - public static final UITexture PROGRESS_BAR_HAMMER_STEEL = progressBar( + UITexture PROGRESS_BAR_HAMMER_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_hammer_steel.png"); - public static final UITexture PROGRESS_BAR_HAMMER_BASE = fullImage( + UITexture PROGRESS_BAR_HAMMER_BASE = fullImage( "textures/gui/progress_bar/progress_bar_hammer_base.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_HAMMER_BASE_BRONZE = fullImage( + 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( + 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", + UITexture PROGRESS_BAR_LATHE = progressBar("textures/gui/progress_bar/progress_bar_lathe.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_LATHE_BASE = fullImage( + UITexture PROGRESS_BAR_LATHE_BASE = fullImage( "textures/gui/progress_bar/progress_bar_lathe_base.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_MACERATE = progressBar( + UITexture PROGRESS_BAR_MACERATE = progressBar( "textures/gui/progress_bar/progress_bar_macerate.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_MACERATE_BRONZE = progressBar( + UITexture PROGRESS_BAR_MACERATE_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_macerate_bronze.png"); - public static final UITexture PROGRESS_BAR_MACERATE_STEEL = progressBar( + 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", + UITexture PROGRESS_BAR_MAGNET = progressBar("textures/gui/progress_bar/progress_bar_magnet.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_MASS_FAB = progressBar( + UITexture PROGRESS_BAR_MASS_FAB = progressBar( "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", + UITexture PROGRESS_BAR_MIXER = progressBar("textures/gui/progress_bar/progress_bar_mixer.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_PACKER = progressBar("textures/gui/progress_bar/progress_bar_packer.png", + UITexture PROGRESS_BAR_PACKER = progressBar("textures/gui/progress_bar/progress_bar_packer.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_RECYCLER = progressBar( + UITexture PROGRESS_BAR_RECYCLER = progressBar( "textures/gui/progress_bar/progress_bar_recycler.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_REPLICATOR = progressBar( + UITexture PROGRESS_BAR_REPLICATOR = progressBar( "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", + UITexture PROGRESS_BAR_SIFT = progressBar("textures/gui/progress_bar/progress_bar_sift.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_SLICE = progressBar("textures/gui/progress_bar/progress_bar_slice.png", + UITexture PROGRESS_BAR_SLICE = progressBar("textures/gui/progress_bar/progress_bar_slice.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_UNPACKER = progressBar( + UITexture PROGRESS_BAR_UNPACKER = progressBar( "textures/gui/progress_bar/progress_bar_unpacker.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_WIREMILL = progressBar( + UITexture PROGRESS_BAR_WIREMILL = progressBar( "textures/gui/progress_bar/progress_bar_wiremill.png", ColorType.DEFAULT); // more custom progress bars // todo these boiler empty bars can probably be replaced by using a resized steam slot texture - public static final UITexture PROGRESS_BAR_BOILER_EMPTY_BRONZE = new UITexture.Builder() + UITexture PROGRESS_BAR_BOILER_EMPTY_BRONZE = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/progress_bar/progress_bar_boiler_empty_bronze.png") .imageSize(10, 54) .adaptable(1) .build(); - public static final UITexture PROGRESS_BAR_BOILER_EMPTY_STEEL = new UITexture.Builder() + UITexture PROGRESS_BAR_BOILER_EMPTY_STEEL = new UITexture.Builder() .location(GTCEu.MOD_ID, "textures/gui/progress_bar/progress_bar_boiler_empty_steel.png") .imageSize(10, 54) .adaptable(1) .build(); - public static final UITexture PROGRESS_BAR_BOILER_FUEL_BRONZE = progressBar( + UITexture PROGRESS_BAR_BOILER_FUEL_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_boiler_fuel_bronze.png", 18, 36); - public static final UITexture PROGRESS_BAR_BOILER_FUEL_STEEL = progressBar( + UITexture PROGRESS_BAR_BOILER_FUEL_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_boiler_fuel_steel.png", 18, 36); - public static final UITexture PROGRESS_BAR_BOILER_HEAT = progressBar( + UITexture PROGRESS_BAR_BOILER_HEAT = progressBar( "textures/gui/progress_bar/progress_bar_boiler_heat.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_ASSEMBLY_LINE = progressBar( + UITexture PROGRESS_BAR_ASSEMBLY_LINE = progressBar( "textures/gui/progress_bar/progress_bar_assembly_line.png", 54, 144, ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_ASSEMBLY_LINE_ARROW = progressBar( + UITexture PROGRESS_BAR_ASSEMBLY_LINE_ARROW = progressBar( "textures/gui/progress_bar/progress_bar_assembly_line_arrow.png", 10, 36, ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_COKE_OVEN = progressBar( + UITexture PROGRESS_BAR_COKE_OVEN = progressBar( "textures/gui/progress_bar/progress_bar_coke_oven.png", 36, 36, ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_DISTILLATION_TOWER = progressBar( + UITexture PROGRESS_BAR_DISTILLATION_TOWER = progressBar( "textures/gui/progress_bar/progress_bar_distillation_tower.png", 66, 116, ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_SOLAR_BRONZE = progressBar( + UITexture PROGRESS_BAR_SOLAR_BRONZE = progressBar( "textures/gui/progress_bar/progress_bar_solar_bronze.png", 10, 20); - public static final UITexture PROGRESS_BAR_SOLAR_STEEL = progressBar( + UITexture PROGRESS_BAR_SOLAR_STEEL = progressBar( "textures/gui/progress_bar/progress_bar_solar_steel.png", 10, 20); - public static final UITexture PROGRESS_BAR_RESEARCH_STATION_1 = progressBar( + UITexture PROGRESS_BAR_RESEARCH_STATION_1 = progressBar( "textures/gui/progress_bar/progress_bar_research_station_1.png", 54, 10, ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_RESEARCH_STATION_2 = progressBar( + UITexture PROGRESS_BAR_RESEARCH_STATION_2 = progressBar( "textures/gui/progress_bar/progress_bar_research_station_2.png", 10, 36, ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_RESEARCH_STATION_BASE = fullImage( + UITexture PROGRESS_BAR_RESEARCH_STATION_BASE = fullImage( "textures/gui/progress_bar/progress_bar_research_station_base.png", ColorType.DEFAULT); - public static final UITexture PROGRESS_BAR_FUSION_ENERGY = progressBar( + UITexture PROGRESS_BAR_FUSION_ENERGY = progressBar( "textures/gui/progress_bar/progress_bar_fusion_energy.png", 94, 14); - public static final UITexture PROGRESS_BAR_FUSION_HEAT = progressBar( + UITexture PROGRESS_BAR_FUSION_HEAT = progressBar( "textures/gui/progress_bar/progress_bar_fusion_heat.png", 94, 14); - public static final UITexture PROGRESS_BAR_MULTI_ENERGY_YELLOW = progressBar( + UITexture PROGRESS_BAR_MULTI_ENERGY_YELLOW = progressBar( "textures/gui/progress_bar/progress_bar_multi_energy_yellow.png", 190, 14); - public static final UITexture PROGRESS_BAR_HPCA_COMPUTATION = progressBar( + UITexture PROGRESS_BAR_HPCA_COMPUTATION = progressBar( "textures/gui/progress_bar/progress_bar_hpca_computation.png", 94, 14); - public static final UITexture PROGRESS_BAR_LCE_FUEL = progressBar( + UITexture PROGRESS_BAR_LCE_FUEL = progressBar( "textures/gui/progress_bar/progress_bar_lce_fuel.png", 62, 14); - public static final UITexture PROGRESS_BAR_LCE_LUBRICANT = progressBar( + UITexture PROGRESS_BAR_LCE_LUBRICANT = progressBar( "textures/gui/progress_bar/progress_bar_lce_lubricant.png", 62, 14); - public static final UITexture PROGRESS_BAR_LCE_OXYGEN = progressBar( + UITexture PROGRESS_BAR_LCE_OXYGEN = progressBar( "textures/gui/progress_bar/progress_bar_lce_oxygen.png", 62, 14); - public static final UITexture PROGRESS_BAR_TURBINE_ROTOR_SPEED = progressBar( + UITexture PROGRESS_BAR_TURBINE_ROTOR_SPEED = progressBar( "textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png", 62, 14); - public static final UITexture PROGRESS_BAR_TURBINE_ROTOR_DURABILITY = progressBar( + UITexture PROGRESS_BAR_TURBINE_ROTOR_DURABILITY = progressBar( "textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png", 62, 14); - public static final UITexture PROGRESS_BAR_FLUID_RIG_DEPLETION = progressBar( + UITexture PROGRESS_BAR_FLUID_RIG_DEPLETION = progressBar( "textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png", 190, 14); - public static final UITexture CYCLE_BUTTON = UITexture.builder() + UITexture CYCLE_BUTTON = UITexture.builder() .location(GTCEu.MOD_ID, "textures/gui/widget/button_distribution_mode.png") .imageSize(20, 60) .name("cycle") .build(); // 16, 48, 16, 16, true); - public static final TabTexture TAB_TOP = TabTexture.of( + TabTexture TAB_TOP = TabTexture.of( fullImage("textures/gui/tab/tabs_top.png", ColorType.DEFAULT), GuiAxis.Y, false, 28, 32, 4); - public static final UITexture MONITOR = UITexture.fullImage(GTCEu.MOD_ID, "item/computer_monitor_cover"); - public static final UITexture DATA_HATCH = UITexture.fullImage(GTCEu.MOD_ID, "textures/item/data_module.png") + UITexture MONITOR = UITexture.fullImage(GTCEu.MOD_ID, "item/computer_monitor_cover"); + UITexture DATA_HATCH = UITexture.fullImage(GTCEu.MOD_ID, "textures/item/data_module.png") .getSubArea(0, 0, 1, 1 / 13f); - public static final UITexture SEPERATOR_SIMPLE = UITexture.builder() + UITexture SEPERATOR_SIMPLE = UITexture.builder() .location(GTCEu.MOD_ID, "textures/gui/icon/seperator/seperator_simple.png") .imageSize(16, 5) .adaptable(2) .build(); // HPCA - public static final UITexture HPCA_COMPUTATION_COMPONENT = fullImage( + UITexture HPCA_COMPUTATION_COMPONENT = fullImage( "textures/gui/widget/hpca/computation_component.png"); - public static final UITexture HPCA_ADVANCED_COMPUTATION_COMPONENT = fullImage( + UITexture HPCA_ADVANCED_COMPUTATION_COMPONENT = fullImage( "textures/gui/widget/hpca/advanced_computation_component.png"); - public static final UITexture HPCA_DAMAGED_COMPUTATION_COMPONENT = fullImage( + UITexture HPCA_DAMAGED_COMPUTATION_COMPONENT = fullImage( "textures/gui/widget/hpca/damaged_computation_component.png"); - public static final UITexture HPCA_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = fullImage( + UITexture HPCA_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = fullImage( "textures/gui/widget/hpca/damaged_advanced_computation_component.png"); - public static final UITexture HPCA_ACTIVE_COOLER_COMPONENT = fullImage( + UITexture HPCA_ACTIVE_COOLER_COMPONENT = fullImage( "textures/gui/widget/hpca/active_cooler_component.png"); - public static final UITexture HPCA_HEAT_SINK_COMPONENT = fullImage( + UITexture HPCA_HEAT_SINK_COMPONENT = fullImage( "textures/gui/widget/hpca/heat_sink_component.png"); - public static final UITexture HPCA_EMPTY_COMPONENT = fullImage("textures/gui/widget/hpca/empty.png"); - public static final UITexture HPCA_BRIDGE_COMPONENT = fullImage("textures/gui/widget/hpca/bridge_component.png"); - public static final UITexture HPCA_COMPONENT_OUTLINE = fullImage("textures/gui/widget/hpca/component_outline.png"); + UITexture HPCA_EMPTY_COMPONENT = fullImage("textures/gui/widget/hpca/empty.png"); + UITexture HPCA_BRIDGE_COMPONENT = fullImage("textures/gui/widget/hpca/bridge_component.png"); + UITexture HPCA_COMPONENT_OUTLINE = fullImage("textures/gui/widget/hpca/component_outline.png"); // MACHINE GRID OVERLAYS - public static final UITexture TOOL_FRONT_FACING_ROTATION = fullImage( + UITexture TOOL_FRONT_FACING_ROTATION = fullImage( "textures/gui/overlay/tool_front_facing_rotation.png"); - public static final UITexture TOOL_IO_FACING_ROTATION = fullImage( + UITexture TOOL_IO_FACING_ROTATION = fullImage( "textures/gui/overlay/tool_io_facing_rotation.png"); - public static final UITexture TOOL_PAUSE = fullImage("textures/gui/overlay/tool_pause.png"); - public static final UITexture TOOL_START = fullImage("textures/gui/overlay/tool_start.png"); - public static final UITexture TOOL_COVER_SETTINGS = fullImage( + UITexture TOOL_PAUSE = fullImage("textures/gui/overlay/tool_pause.png"); + UITexture TOOL_START = fullImage("textures/gui/overlay/tool_start.png"); + UITexture TOOL_COVER_SETTINGS = fullImage( "textures/gui/overlay/tool_cover_settings.png"); - public static final UITexture TOOL_MUTE = fullImage("textures/gui/overlay/tool_mute.png"); - public static final UITexture TOOL_SOUND = fullImage("textures/gui/overlay/tool_sound.png"); - public static final UITexture TOOL_ALLOW_INPUT = fullImage( + UITexture TOOL_MUTE = fullImage("textures/gui/overlay/tool_mute.png"); + UITexture TOOL_SOUND = fullImage("textures/gui/overlay/tool_sound.png"); + UITexture TOOL_ALLOW_INPUT = fullImage( "textures/gui/overlay/tool_allow_input.png"); - public static final UITexture TOOL_ATTACH_COVER = fullImage( + UITexture TOOL_ATTACH_COVER = fullImage( "textures/gui/overlay/tool_attach_cover.png"); - public static final UITexture TOOL_REMOVE_COVER = fullImage( + UITexture TOOL_REMOVE_COVER = fullImage( "textures/gui/overlay/tool_remove_cover.png"); - public static final UITexture TOOL_PIPE_BLOCK = fullImage( + UITexture TOOL_PIPE_BLOCK = fullImage( "textures/gui/overlay/tool_pipe_block.png"); - public static final UITexture TOOL_PIPE_CONNECT = fullImage( + UITexture TOOL_PIPE_CONNECT = fullImage( "textures/gui/overlay/tool_pipe_connect.png"); - public static final UITexture TOOL_WIRE_BLOCK = fullImage( + UITexture TOOL_WIRE_BLOCK = fullImage( "textures/gui/overlay/tool_wire_block.png"); - public static final UITexture TOOL_WIRE_CONNECT = fullImage( + UITexture TOOL_WIRE_CONNECT = fullImage( "textures/gui/overlay/tool_wire_connect.png"); - public static final UITexture TOOL_AUTO_OUTPUT = fullImage( + UITexture TOOL_AUTO_OUTPUT = fullImage( "textures/gui/overlay/tool_auto_output.png"); - public static final UITexture TOOL_DISABLE_AUTO_OUTPUT = fullImage( + UITexture TOOL_DISABLE_AUTO_OUTPUT = fullImage( "textures/gui/overlay/tool_disable_auto_output.png"); - public static final UITexture TOOL_SWITCH_CONVERTER_NATIVE = fullImage( + UITexture TOOL_SWITCH_CONVERTER_NATIVE = fullImage( "textures/gui/overlay/tool_wire_block.png"); - public static final UITexture TOOL_SWITCH_CONVERTER_EU = fullImage( + UITexture TOOL_SWITCH_CONVERTER_EU = fullImage( "textures/gui/overlay/tool_wire_connect.png"); // MISC - public static void init() {/**/} + static void init() {/**/} private static UITexture fullImage(String path) { return fullImage(path, null); @@ -720,7 +722,7 @@ private static UITexture progressBar(String path) { return progressBar(path, null); } - private static UITexture progressBar(String path, ColorType colorType) { + private static UITexture progressBar(String path, @Nullable ColorType colorType) { return progressBar(path, 20, 40, colorType); } @@ -728,7 +730,7 @@ private static UITexture progressBar(String path, int width, int height) { return progressBar(path, width, height, null); } - private static UITexture progressBar(String path, int width, int height, ColorType colorType) { + private static UITexture progressBar(String path, int width, int height, @Nullable ColorType colorType) { UITexture.Builder builder = new UITexture.Builder() .location(GTCEu.MOD_ID, path) .imageSize(width, height) @@ -737,7 +739,7 @@ private static UITexture progressBar(String path, int width, int height, ColorTy } // todo steam logos? multi indicator blinking logos? - public static @NotNull UITexture getLogo(GTGuiTheme theme) { + static UITexture getLogo(@Nullable GTGuiTheme theme) { if (theme != null) { UITexture logo = theme.getLogo(); if (logo != null) return logo; From acdeb531b53992936ab9bee9ccf8a512e086d3ce Mon Sep 17 00:00:00 2001 From: Gustavo <77560533+gustovafing@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:44:24 +1000 Subject: [PATCH 2/8] Make recipe iterator hasNext work properly (#4770) --- .../gtceu/api/recipe/lookup/RecipeDB.java | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java index a7862af48d3..f3ee3967235 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeDB.java @@ -75,7 +75,8 @@ public void clear() { @VisibleForTesting public @Nullable GTRecipe find(@NotNull List> list, @NotNull Predicate predicate) { - return (new RecipeIterator(this, list, predicate)).next(); + var iter = new RecipeIterator(this, list, predicate); + return iter.hasNext() ? iter.next() : null; } /** @@ -285,6 +286,9 @@ public static class RecipeIterator implements Iterator { private final Deque stack = new ArrayDeque<>(); + private @Nullable GTRecipe nextCached = null; + private boolean hasCached = false; + @VisibleForTesting public RecipeIterator(@NotNull RecipeDB db, @NotNull List> ingredients, @@ -298,13 +302,7 @@ public RecipeIterator(@NotNull RecipeDB db, } } - @Override - public boolean hasNext() { - return !stack.isEmpty(); - } - - @Override - public GTRecipe next() { + private @Nullable GTRecipe getNext() { while (!stack.isEmpty()) { // We stay on one frame until all ingredients have been checked SearchFrame frame = stack.peek(); @@ -343,6 +341,23 @@ public GTRecipe next() { return null; // no more recipes } + @Override + public boolean hasNext() { + if (!hasCached) { + nextCached = getNext(); + hasCached = true; + } + return nextCached != null; + } + + @Override + public GTRecipe next() { + if (!hasCached) nextCached = getNext(); + hasCached = false; + if (nextCached == null) throw new NoSuchElementException(); + return nextCached; + } + /** * Reset the iterator */ From 84adf48d54222c29aa9b11b7e69c538e3bee3df0 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Fri, 24 Apr 2026 11:56:23 +1000 Subject: [PATCH 3/8] rewrite get backed slots row --- .../machine/mui/MachineUIPanelBuilder.java | 3 + .../api/recipe/gui/GTRecipeTypeUILayout.java | 229 ++++++++---------- .../gtceu/common/mui/GTMuiRecipeTypes.java | 5 - .../gtceu/common/mui/GTMuiWidgets.java | 22 +- 4 files changed, 107 insertions(+), 152 deletions(-) delete mode 100644 src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiRecipeTypes.java diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/mui/MachineUIPanelBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/machine/mui/MachineUIPanelBuilder.java index 281b261be04..a93806f4100 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/mui/MachineUIPanelBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/mui/MachineUIPanelBuilder.java @@ -28,6 +28,9 @@ public class MachineUIPanelBuilder { * Should the GregTech logo be drawn in the bottom right corner of the panel. */ private boolean drawGTLogo = false; + /** + * The texture to use for the GregTech logo. + */ private UITexture gtLogoTexture = GTGuiTextures.GREGTECH_LOGO; /** * Should the player inventory be attached to the bottom of the panel. diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java index c914115b2f3..6d359986b5a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java @@ -8,7 +8,6 @@ import brachy.modularui.api.drawable.IDrawable; import brachy.modularui.drawable.UITexture; -import brachy.modularui.screen.ModularPanel; import brachy.modularui.theme.ThemeAPI; import brachy.modularui.value.sync.DoubleSyncValue; import brachy.modularui.value.sync.PanelSyncManager; @@ -25,6 +24,7 @@ import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; import lombok.Getter; import lombok.Setter; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -43,14 +43,10 @@ public class GTRecipeTypeUILayout { @Getter private ProgressWidget.Direction progressDirection; @Getter - private Set IOs = new HashSet<>(); - @Getter private Map, Int2ObjectOpenHashMap>> overlays = new EnumMap<>(IO.class); private Map, Int2IntArrayMap>> gridLength = new EnumMap<>(IO.class); private Map, Int2IntArrayMap>> gridWidths = new EnumMap<>(IO.class); - private ParentWidget parentWidget = null; - public GTRecipeTypeUILayout() {} public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, @@ -60,145 +56,112 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, @Nullable NotifiableFluidTank inputFluids, @Nullable NotifiableFluidTank outputFluids, DoubleSupplier progressSupplier, int tier) { - if (recipeType != null) { - var backedSlotsPanel = new ParentWidget<>(); - backedSlotsPanel.coverChildren(); - var backedSlotsRow = Flow.row(); - backedSlotsRow.coverChildrenHeight(); - int rowWidthPx = 0; + Objects.requireNonNull(recipeType); - // List IOs = new ArrayList<>(); - if (inputItems != null || inputFluids != null) { - IOs.add(IO.IN); - } - if (outputFluids != null || outputItems != null) { - IOs.add(IO.OUT); + DoubleSyncValue progressPercent = syncManager.getOrCreateSyncHandler("progressPercent", + DoubleSyncValue.class, () -> new DoubleSyncValue(progressSupplier)); + + var backedSlotsRow = Flow.row() + .coverChildren() + .horizontalCenter() + .childPadding((progressSize / 2) + 2) + .childIf(inputItems != null || inputFluids != null, () -> getIOColumn(syncManager, IO.IN, + inputItems, inputFluids, themeId, tier)) + .child(new ProgressWidget() + .value(progressPercent) + .name("progressBar") + .texture(progressBar, progressSize) + .size(progressSize) + .direction(progressDirection)) + .childIf(outputFluids != null || outputItems != null, () -> getIOColumn(syncManager, IO.OUT, + outputItems, outputFluids, themeId, tier)); + + return new ParentWidget<>() + .widthRel(1f) + .coverChildrenHeight() + .child(backedSlotsRow); + } + + @Contract("_, _, null, null, _, _ -> fail") + private Flow getIOColumn(@NotNull PanelSyncManager syncManager, + IO io, + @Nullable NotifiableItemStackHandler items, + @Nullable NotifiableFluidTank fluids, + String themeId, + int tier) { + boolean in = io == IO.IN; + + if (items == null && fluids == null) throw new IllegalArgumentException("Item and fluid handler cannot both be null"); + + var caps = (in ? recipeType.maxInputs : recipeType.maxOutputs); + + Flow ioColumn = Flow.col().coverChildren(); + + var widgetGroups = new ArrayList>(); + + for (var recipeCap : caps.keySet()) { + int maxRecipeTypeSlots = caps.getInt(recipeCap); + int maxMachineSlots = 0; + if (maxRecipeTypeSlots == 0 || recipeCap == EURecipeCapability.CAP) continue; + if (recipeCap == ItemRecipeCapability.CAP) { + if (items == null) continue; + maxMachineSlots = items.getSlots(); + } else if (recipeCap == FluidRecipeCapability.CAP) { + if (fluids == null) continue; + maxMachineSlots = fluids.getTanks(); } - Map> colWidgetGroups = new Object2ReferenceOpenHashMap<>(); - - int slotLeftShiftPx = 0; - for (var io : IOs) { - boolean in = io == IO.IN; - - var caps = (in ? recipeType.maxInputs : recipeType.maxOutputs); - int slotGroupHeightPx = 0; - - Flow ioColumn = Flow.col(); - // ioColumn.coverChildrenWidth(); - int slotGroupWidthPx = 0; - - var widgetGroups = new ArrayList>(); - - for (var recipeCap : caps.keySet()) { - int maxRecipeTypeSlots = caps.get(recipeCap); - int maxMachineSlots = 0; - if (maxRecipeTypeSlots == 0 || recipeCap == EURecipeCapability.CAP) continue; - if (recipeCap == ItemRecipeCapability.CAP) { - if (in && inputItems == null) continue; - if (!in && outputItems == null) continue; - maxMachineSlots = in ? inputItems.getSlots() : outputItems.getSlots(); - } else if (recipeCap == FluidRecipeCapability.CAP) { - if (in && inputFluids == null) continue; - if (!in && outputFluids == null) continue; - maxMachineSlots = in ? inputFluids.getTanks() : outputFluids.getTanks(); - } + var grid = createGrid(io, recipeCap, 's', tier, maxMachineSlots); - var grid = createGrid(io, recipeCap, 's', tier, maxMachineSlots); - - slotGroupHeightPx += 18 * grid.length; - - IDrawable defaultSlotBackground = (recipeCap == ItemRecipeCapability.CAP ? - ThemeAPI.INSTANCE.getTheme(themeId).getItemSlotTheme().theme().getBackground() : - ThemeAPI.INSTANCE.getTheme(themeId).getFluidSlotTheme().theme().getBackground()); - - SlotGroupWidget.Builder slotWidgetBuilder = SlotGroupWidget.builder() - .matrix(grid); - - if (recipeCap == ItemRecipeCapability.CAP) { - var handler = in ? inputItems : outputItems; - SlotGroup group = new SlotGroup("item_" + io.name(), grid[0].length()); - if (handler != null) { - slotWidgetBuilder.key('s', i -> { - var overlay = IDrawable.EMPTY; - - if (overlays.containsKey(io) && overlays.get(io).containsKey(recipeCap)) { - overlay = overlays.get(io).get(recipeCap).get(i) != null ? - overlays.get(io).get(recipeCap).get(i) : IDrawable.EMPTY; - } - - return new ItemSlot().slot(new ModularSlot(handler, i) - .slotGroup(group)) - .background(defaultSlotBackground, overlay); - }); - } - } else if (recipeCap == FluidRecipeCapability.CAP) { - var handler = in ? inputFluids : outputFluids; - String syncHandlerName = "fluid_" + io.name(); - for (int i = 0; i < maxMachineSlots; i++) { - syncManager.syncValue(syncHandlerName, i, SyncHandlers.fluidSlot(handler.getStorages()[i])); - } - if (handler != null) { - slotWidgetBuilder.key('s', i -> { - var overlay = IDrawable.EMPTY; - - if (overlays.containsKey(io) && overlays.get(io).containsKey(recipeCap)) { - overlay = overlays.get(io).get(recipeCap).get(i) != null ? - overlays.get(io).get(recipeCap).get(i) : IDrawable.EMPTY; - } - - return new FluidSlot() - .syncHandler(syncHandlerName, i) - .background(defaultSlotBackground, overlay); - }); - } - } + IDrawable defaultSlotBackground = (recipeCap == ItemRecipeCapability.CAP ? + ThemeAPI.INSTANCE.getTheme(themeId).getItemSlotTheme().theme().getBackground() : + ThemeAPI.INSTANCE.getTheme(themeId).getFluidSlotTheme().theme().getBackground()); - // calculate full width of each column - slotGroupWidthPx = Math.max(slotGroupWidthPx, Math.min(maxRecipeTypeSlots, grid[0].length()) * 18); + SlotGroupWidget.Builder slotWidgetBuilder = SlotGroupWidget.builder() + .matrix(grid); - widgetGroups.add(slotWidgetBuilder.build() - .name(recipeCap.name + "_" + io.name()) - .leftRel(io == IO.IN ? 0f : 1)); - } + if (recipeCap == ItemRecipeCapability.CAP) { + SlotGroup group = new SlotGroup("item_" + io.name(), grid[0].length()); + slotWidgetBuilder.key('s', i -> { + var overlay = IDrawable.EMPTY; - ioColumn.size(slotGroupWidthPx, slotGroupHeightPx); - for (var g : widgetGroups) { - ioColumn.child(g); + if (overlays.containsKey(io) && overlays.get(io).containsKey(recipeCap)) { + overlay = overlays.get(io).get(recipeCap).get(i) != null ? + overlays.get(io).get(recipeCap).get(i) : IDrawable.EMPTY; + } + + return new ItemSlot().slot(new ModularSlot(items, i) + .slotGroup(group)) + .background(defaultSlotBackground, overlay); + }); + } else if (recipeCap == FluidRecipeCapability.CAP) { + String syncHandlerName = "fluid_" + io.name(); + for (int i = 0; i < maxMachineSlots; i++) { + syncManager.syncValue(syncHandlerName, i, SyncHandlers.fluidSlot(fluids.getStorages()[i])); } - slotLeftShiftPx += (slotGroupWidthPx / 2) * ((io == io.IN) ? -1 : 1); + slotWidgetBuilder.key('s', i -> { + var overlay = IDrawable.EMPTY; - rowWidthPx += slotGroupWidthPx; - colWidgetGroups.put(io, ioColumn); - } - // 2 px padding plus each half of the progress bar (1) - backedSlotsRow.childPadding((progressSize / 2) + 2); - for (var ioColumn : colWidgetGroups.entrySet()) { - var col = ioColumn.getValue(); - var io = ioColumn.getKey(); - backedSlotsRow.child(col.posRel(io == IO.IN ? 0f : 1f, 0.5f)); - } + if (overlays.containsKey(io) && overlays.get(io).containsKey(recipeCap)) { + overlay = overlays.get(io).get(recipeCap).get(i) != null ? + overlays.get(io).get(recipeCap).get(i) : IDrawable.EMPTY; + } - // same padding as (1) + half a slot on each side - rowWidthPx += progressSize + 4 + 18; - backedSlotsRow.width(rowWidthPx); + return new FluidSlot() + .syncHandler(syncHandlerName, i) + .background(defaultSlotBackground, overlay); + }); + } - backedSlotsPanel.child(backedSlotsRow.left(slotLeftShiftPx)); + widgetGroups.add(slotWidgetBuilder.build() + .coverChildren() + .name(recipeCap.name + "_" + io.name())); + } - DoubleSyncValue progressPercent = syncManager.getOrCreateSyncHandler("progressPercent", - DoubleSyncValue.class, () -> new DoubleSyncValue(progressSupplier)); - backedSlotsPanel.child(new ProgressWidget() - .center() - .value(progressPercent) - .name("progressBar") - .texture(progressBar, progressSize) - .size(progressSize) - .direction(progressDirection)); - return backedSlotsPanel; - } - return ModularPanel.defaultPanel("empty"); + widgetGroups.forEach(ioColumn::child); + return ioColumn; } public String[] createGrid(IO io, RecipeCapability cap, char key, int tier, int maxMachineSlots) { @@ -222,9 +185,9 @@ public static class Builder { private UITexture progressBar; private int progressSize; private ProgressWidget.Direction fillDirection; - private Map, Int2ObjectOpenHashMap>> overlays = new EnumMap<>(IO.class); - private Map, Int2IntArrayMap>> gridLength = new EnumMap<>(IO.class); - private Map, Int2IntArrayMap>> gridWidths = new EnumMap<>(IO.class); + private final Map, Int2ObjectOpenHashMap>> overlays = new EnumMap<>(IO.class); + private final Map, Int2IntArrayMap>> gridLength = new EnumMap<>(IO.class); + private final Map, Int2IntArrayMap>> gridWidths = new EnumMap<>(IO.class); public Builder setSlotOverlay(IO ioMode, int slotIndex, RecipeCapability cap, IDrawable overlay) { overlays.computeIfAbsent(ioMode, it -> new Object2ReferenceOpenHashMap<>()) diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiRecipeTypes.java deleted file mode 100644 index 58ec5af2045..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiRecipeTypes.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.gregtechceu.gtceu.common.mui; - -public class GTMuiRecipeTypes { - -} diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiWidgets.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiWidgets.java index 80b3188b426..e92f8225cac 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiWidgets.java +++ b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiWidgets.java @@ -49,6 +49,7 @@ import brachy.modularui.widgets.textfield.TextFieldWidget; import com.mojang.blaze3d.platform.InputConstants; import it.unimi.dsi.fastutil.booleans.BooleanConsumer; +import org.jetbrains.annotations.Nullable; import java.util.function.*; @@ -323,13 +324,6 @@ private static int nextCircuitValue(ItemStack stack, int current, double delta) } } - public static IDrawable.DrawableWidget createGTLogo() { - if (GTValues.XMAS.getAsBoolean()) { - return new IDrawable.DrawableWidget(GTGuiTextures.GREGTECH_LOGO_XMAS); - } - return new IDrawable.DrawableWidget(GTGuiTextures.GREGTECH_LOGO); - } - public static String[] createGrid(int amount, int rowSize, boolean output, char key) { int rows = (int) Math.ceil((float) amount / rowSize); String[] grid = new String[rows]; @@ -622,12 +616,12 @@ public boolean onMouseScrolled(double mouseX, double mouseY, double delta) { public static class EnumRowBuilder> { - private EnumSyncValue syncValue; + private @Nullable EnumSyncValue syncValue; private final Class enumValue; - private IKey lang; - private IDrawable[] background; - private IDrawable selectedBackground; - private IDrawable[] overlay; + private @Nullable IKey lang; + private IDrawable @Nullable [] background; + private @Nullable IDrawable selectedBackground; + private IDrawable @Nullable [] overlay; public EnumRowBuilder(Class enumValue) { this.enumValue = enumValue; @@ -672,10 +666,10 @@ private BoolValue.Dynamic boolValueOf(EnumSyncValue syncValue, T value) { public Flow build() { var row = Flow.row().coverChildrenHeight().widthRel(1f); - if (this.enumValue != null && this.syncValue != null) { + if (syncValue != null) { for (var enumVal : enumValue.getEnumConstants()) { var button = new ToggleButton().size(18).marginRight(2) - .value(boolValueOf(this.syncValue, enumVal)); + .value(boolValueOf(syncValue, enumVal)); if (this.background != null && this.background.length > 0) button.background(this.background); From a7c20fe42d920b46cdf334fced50e46c2ef743b8 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Fri, 24 Apr 2026 11:59:01 +1000 Subject: [PATCH 4/8] spotless --- .../api/recipe/gui/GTRecipeTypeUILayout.java | 24 +++++++++---------- .../gtceu/common/mui/GTMuiWidgets.java | 1 - 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java index 6d359986b5a..0a10515e9b2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java @@ -56,7 +56,6 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, @Nullable NotifiableFluidTank inputFluids, @Nullable NotifiableFluidTank outputFluids, DoubleSupplier progressSupplier, int tier) { - Objects.requireNonNull(recipeType); DoubleSyncValue progressPercent = syncManager.getOrCreateSyncHandler("progressPercent", @@ -67,15 +66,15 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, .horizontalCenter() .childPadding((progressSize / 2) + 2) .childIf(inputItems != null || inputFluids != null, () -> getIOColumn(syncManager, IO.IN, - inputItems, inputFluids, themeId, tier)) + inputItems, inputFluids, themeId, tier)) .child(new ProgressWidget() - .value(progressPercent) - .name("progressBar") - .texture(progressBar, progressSize) - .size(progressSize) - .direction(progressDirection)) + .value(progressPercent) + .name("progressBar") + .texture(progressBar, progressSize) + .size(progressSize) + .direction(progressDirection)) .childIf(outputFluids != null || outputItems != null, () -> getIOColumn(syncManager, IO.OUT, - outputItems, outputFluids, themeId, tier)); + outputItems, outputFluids, themeId, tier)); return new ParentWidget<>() .widthRel(1f) @@ -92,7 +91,8 @@ private Flow getIOColumn(@NotNull PanelSyncManager syncManager, int tier) { boolean in = io == IO.IN; - if (items == null && fluids == null) throw new IllegalArgumentException("Item and fluid handler cannot both be null"); + if (items == null && fluids == null) + throw new IllegalArgumentException("Item and fluid handler cannot both be null"); var caps = (in ? recipeType.maxInputs : recipeType.maxOutputs); @@ -132,7 +132,7 @@ private Flow getIOColumn(@NotNull PanelSyncManager syncManager, } return new ItemSlot().slot(new ModularSlot(items, i) - .slotGroup(group)) + .slotGroup(group)) .background(defaultSlotBackground, overlay); }); } else if (recipeCap == FluidRecipeCapability.CAP) { @@ -159,7 +159,6 @@ private Flow getIOColumn(@NotNull PanelSyncManager syncManager, .name(recipeCap.name + "_" + io.name())); } - widgetGroups.forEach(ioColumn::child); return ioColumn; } @@ -185,7 +184,8 @@ public static class Builder { private UITexture progressBar; private int progressSize; private ProgressWidget.Direction fillDirection; - private final Map, Int2ObjectOpenHashMap>> overlays = new EnumMap<>(IO.class); + private final Map, Int2ObjectOpenHashMap>> overlays = new EnumMap<>( + IO.class); private final Map, Int2IntArrayMap>> gridLength = new EnumMap<>(IO.class); private final Map, Int2IntArrayMap>> gridWidths = new EnumMap<>(IO.class); diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiWidgets.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiWidgets.java index e92f8225cac..db532481406 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiWidgets.java +++ b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMuiWidgets.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.common.mui; -import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.IControllable; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.cover.filter.Filter; From 80c277fbd6f79209ff1ee600bf796cc25bd9ba36 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Fri, 24 Apr 2026 15:02:17 +1000 Subject: [PATCH 5/8] remove recipe viewer function --- .../api/recipe/gui/GTRecipeTypeUILayout.java | 2 +- .../recipe/gui/GTRecipeViewerUILayout.java | 86 +------------------ 2 files changed, 3 insertions(+), 85 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java index 0a10515e9b2..296a7d59087 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java @@ -83,7 +83,7 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, } @Contract("_, _, null, null, _, _ -> fail") - private Flow getIOColumn(@NotNull PanelSyncManager syncManager, + public Flow getIOColumn(@NotNull PanelSyncManager syncManager, IO io, @Nullable NotifiableItemStackHandler items, @Nullable NotifiableFluidTank fluids, diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeViewerUILayout.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeViewerUILayout.java index 32807be3015..d673ef40e49 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeViewerUILayout.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeViewerUILayout.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.recipe.gui; +import brachy.modularui.value.sync.DoubleSyncValue; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; @@ -14,6 +15,7 @@ import java.util.ArrayList; import java.util.Map; +import java.util.Objects; public class GTRecipeViewerUILayout { @@ -31,90 +33,6 @@ public GTRecipeViewerUILayout overrideWidget(ParentWidget getRecipeWidget() { - if (layout.getRecipeType() != null) { - var parentWidget = new ParentWidget<>(); - parentWidget.coverChildren(); - var slotsRow = Flow.row(); - slotsRow.coverChildrenHeight(); - - int rowWidthPx = 0; - - Map> colWidgetGroups = new Object2ReferenceOpenHashMap<>(); - - int slotLeftShiftPx = 0; - for (var io : layout.getIOs()) { - boolean in = io == IO.IN; - - var caps = (in ? layout.getRecipeType().maxInputs : layout.getRecipeType().maxOutputs); - int slotGroupHeightPx = 0; - - Flow ioColumn = Flow.col(); - // ioColumn.coverChildrenWidth(); - int slotGroupWidthPx = 0; - - var widgetGroups = new ArrayList>(); - - for (var recipeCap : caps.keySet()) { - int maxRecipeTypeSlots = caps.get(recipeCap); - - var grid = layout.createGrid(io, recipeCap, 's', GTValues.MAX, Integer.MAX_VALUE); - - slotGroupHeightPx += 18 * grid.length; - - IDrawable defaultSlotBackground = (recipeCap == ItemRecipeCapability.CAP ? - GTGuiTextures.SLOT : GTGuiTextures.FLUID_SLOT); - - SlotGroupWidget.Builder slotWidgetBuilder = SlotGroupWidget.builder() - .matrix(grid); - var overlays = layout.getOverlays(); - slotWidgetBuilder.key('s', i -> { - var widget = new IDrawable.DrawableWidget(defaultSlotBackground); - if (overlays.containsKey(io) && overlays.get(io).containsKey(recipeCap)) { - widget.overlay(overlays.get(io).get(recipeCap).get(i)); - } - return widget; - }); - - // calculate full width of each column - slotGroupWidthPx = Math.max(slotGroupWidthPx, Math.min(maxRecipeTypeSlots, grid[0].length()) * 18); - - widgetGroups.add(slotWidgetBuilder.build() - .name(recipeCap.name + "_" + io.name()) - .leftRel(io == IO.IN ? 0 : 1)); - } - - ioColumn.size(slotGroupWidthPx, slotGroupHeightPx); - for (var g : widgetGroups) { - ioColumn.child(g); - } - slotLeftShiftPx += (slotGroupWidthPx / 2) * ((io == io.IN) ? -1 : 1); - - rowWidthPx += slotGroupWidthPx; - colWidgetGroups.put(io, ioColumn); - } - // 2 px padding plus each half of the progress bar (1) - slotsRow.childPadding((layout.getProgressSize() / 2) + 2); - for (var ioColumn : colWidgetGroups.entrySet()) { - var col = ioColumn.getValue(); - var io = ioColumn.getKey(); - slotsRow.child(col.posRel(io == IO.IN ? 0f : 1f, 0.5f)); - } - - // same padding as (1) + half a slot on each side - rowWidthPx += layout.getProgressSize() + 4 + 18; - slotsRow.width(rowWidthPx); - - parentWidget.child(slotsRow.left(slotLeftShiftPx)); - - parentWidget.child(new ProgressWidget() - .center() - // .progress(() -> 0.5f) - .name("progressBar") - .texture(layout.getProgressBar(), layout.getProgressSize()) - .size(layout.getProgressSize()) - .direction(layout.getProgressDirection())); - return parentWidget; - } return new ParentWidget<>(); } } From 79eb7d497c464070acb494315f6a47095c2e9053 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Fri, 24 Apr 2026 20:41:35 +1000 Subject: [PATCH 6/8] split up capability ui stuff --- .../recipe/BlockStateRecipeCapability.java | 2 + .../recipe/CWURecipeCapability.java | 7 + .../capability/recipe/EURecipeCapability.java | 7 + .../recipe/FluidRecipeCapability.java | 65 ++++++++- .../recipe/ItemRecipeCapability.java | 62 ++++++++- .../capability/recipe/RecipeCapability.java | 48 ++++++- .../api/recipe/gui/GTRecipeTypeUILayout.java | 123 ++++++------------ .../common/data/GTRecipeCapabilities.java | 4 +- .../mui/GTSingleblockMachinePanels.java | 16 +-- 9 files changed, 227 insertions(+), 107 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/BlockStateRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/BlockStateRecipeCapability.java index 5ff165fbddf..29ed8eb2ff0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/BlockStateRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/BlockStateRecipeCapability.java @@ -4,6 +4,7 @@ import net.minecraft.world.level.block.state.BlockState; +/* public class BlockStateRecipeCapability extends RecipeCapability { public final static BlockStateRecipeCapability CAP = new BlockStateRecipeCapability(); @@ -17,3 +18,4 @@ public BlockState copyInner(BlockState content) { return content; } } +*/ \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/CWURecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/CWURecipeCapability.java index a5409ab7742..fbce65181ae 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/CWURecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/CWURecipeCapability.java @@ -1,5 +1,7 @@ package com.gregtechceu.gtceu.api.capability.recipe; +import com.gregtechceu.gtceu.api.machine.trait.MachineTraitType; +import com.gregtechceu.gtceu.api.machine.trait.NotifiableComputationContainer; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; @@ -22,6 +24,11 @@ protected CWURecipeCapability() { super("cwu", 0xFFEEEE00, false, 3, SerializerInteger.INSTANCE); } + @Override + public MachineTraitType getNotifiableHandlerTraitType() { + return NotifiableComputationContainer.TYPE; + } + @Override public Integer copyInner(Integer content) { return content; diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java index c518228571c..8b6db228d19 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java @@ -2,6 +2,8 @@ import com.gregtechceu.gtceu.api.machine.feature.IOverclockMachine; import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; +import com.gregtechceu.gtceu.api.machine.trait.MachineTraitType; +import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; @@ -24,6 +26,11 @@ protected EURecipeCapability() { super("eu", 0xFFFFFF00, false, 2, SerializerEnergyStack.INSTANCE); } + @Override + public MachineTraitType getNotifiableHandlerTraitType() { + return NotifiableEnergyContainer.TYPE; + } + @Override public EnergyStack copyInner(EnergyStack content) { return content; diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java index 755a9c88955..2d532df4247 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java @@ -1,14 +1,21 @@ package com.gregtechceu.gtceu.api.capability.recipe; +import brachy.modularui.api.drawable.IDrawable; +import brachy.modularui.api.widget.IWidget; +import brachy.modularui.theme.ThemeAPI; +import brachy.modularui.value.sync.PanelSyncManager; +import brachy.modularui.value.sync.SyncHandlers; +import brachy.modularui.widgets.SlotGroupWidget; +import brachy.modularui.widgets.slot.FluidSlot; import com.gregtechceu.gtceu.api.gui.widget.TankWidget; -import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroup; -import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroupDistinctness; -import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerList; +import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.trait.*; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.content.SerializerFluidIngredient; +import com.gregtechceu.gtceu.api.recipe.gui.GTRecipeTypeUILayout; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.api.recipe.ingredient.IntProviderFluidIngredient; import com.gregtechceu.gtceu.api.recipe.lookup.ingredient.AbstractMapIngredient; @@ -28,6 +35,7 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.jei.IngredientIO; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.ChatFormatting; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -55,6 +63,11 @@ protected FluidRecipeCapability() { super("fluid", 0xFF3C70EE, true, 1, SerializerFluidIngredient.INSTANCE); } + @Override + public MachineTraitType getNotifiableHandlerTraitType() { + return NotifiableFluidTank.TYPE; + } + @Override public FluidIngredient copyInner(FluidIngredient content) { return content.copy(); @@ -456,4 +469,50 @@ public interface ICustomParallel { public boolean shouldBypassDistinct() { return false; } + + @Override + public boolean shouldCreateCapabilityUI() { + return true; + } + + @Override + public @Nullable IWidget createCapabilityUI(@NotNull MetaMachine machine, + PanelSyncManager syncManager, + NotifiableRecipeHandlerTrait handler, + GTRecipeTypeUILayout layout, + int maxRecipeTypeSlots, + int tier, + String themeId, + IO io) { + if (maxRecipeTypeSlots == 0) return null; + + var fluidTank = (NotifiableFluidTank)handler; + var overlays = layout.getOverlays().computeIfAbsent(io, $ -> new Object2ObjectOpenHashMap<>()).computeIfAbsent(CAP, $ -> new Int2ObjectOpenHashMap<>()); + + int maxMachineSlots = fluidTank.getTanks(); + + var grid = layout.createGrid(io, CAP, 's', tier, maxMachineSlots); + + IDrawable defaultSlotBackground = ThemeAPI.INSTANCE.getTheme(themeId).getFluidSlotTheme().theme().getBackground(); + + SlotGroupWidget.Builder slotWidgetBuilder = SlotGroupWidget.builder() + .matrix(grid); + + String syncHandlerName = "fluid_" + io.name(); + for (int i = 0; i < maxMachineSlots; i++) { + syncManager.syncValue(syncHandlerName, i, SyncHandlers.fluidSlot(fluidTank.getStorages()[i])); + } + slotWidgetBuilder.key('s', i -> { + var overlay = overlays.get(i) != null ? overlays.get(i) : IDrawable.EMPTY; + + return new FluidSlot() + .syncHandler(syncHandlerName, i) + .background(defaultSlotBackground, overlay); + }); + + return slotWidgetBuilder.build() + .coverChildren() + .name(CAP.name + "_" + io.name()); + + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index e38611320d5..96d14f42184 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -1,15 +1,23 @@ package com.gregtechceu.gtceu.api.capability.recipe; +import brachy.modularui.api.drawable.IDrawable; +import brachy.modularui.api.widget.IWidget; +import brachy.modularui.theme.ThemeAPI; +import brachy.modularui.value.sync.PanelSyncManager; +import brachy.modularui.widgets.SlotGroupWidget; +import brachy.modularui.widgets.slot.ItemSlot; +import brachy.modularui.widgets.slot.ModularSlot; +import brachy.modularui.widgets.slot.SlotGroup; import com.gregtechceu.gtceu.api.gui.widget.SlotWidget; -import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroup; -import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroupDistinctness; -import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerList; +import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.trait.*; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.ResearchData; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.content.SerializerIngredient; +import com.gregtechceu.gtceu.api.recipe.gui.GTRecipeTypeUILayout; import com.gregtechceu.gtceu.api.recipe.ingredient.IntCircuitIngredient; import com.gregtechceu.gtceu.api.recipe.ingredient.IntProviderIngredient; import com.gregtechceu.gtceu.api.recipe.ingredient.SizedIngredient; @@ -33,6 +41,7 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.jei.IngredientIO; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.util.valueproviders.IntProvider; @@ -60,6 +69,11 @@ protected ItemRecipeCapability() { super("item", 0xFFD96106, true, 0, SerializerIngredient.INSTANCE); } + @Override + public MachineTraitType getNotifiableHandlerTraitType() { + return NotifiableItemStackHandler.TYPE; + } + @Override public Ingredient copyInner(Ingredient content) { return SizedIngredient.copy(content); @@ -586,4 +600,46 @@ public interface ICustomParallel { public boolean shouldBypassDistinct() { return false; } + + @Override + public boolean shouldCreateCapabilityUI() { + return true; + } + + @Override + public @Nullable IWidget createCapabilityUI(@NotNull MetaMachine machine, + PanelSyncManager syncManager, + NotifiableRecipeHandlerTrait handler, + GTRecipeTypeUILayout layout, + int maxRecipeTypeSlots, + int tier, + String themeId, + IO io) { + + if (maxRecipeTypeSlots == 0) return null; + + var itemHandler = (NotifiableItemStackHandler)handler; + var overlays = layout.getOverlays().computeIfAbsent(io, $ -> new Object2ObjectOpenHashMap<>()).computeIfAbsent(CAP, $ -> new Int2ObjectOpenHashMap<>()); + + var grid = layout.createGrid(io, CAP, 's', tier, itemHandler.getSlots()); + + IDrawable defaultSlotBackground = ThemeAPI.INSTANCE.getTheme(themeId).getItemSlotTheme().theme().getBackground(); + + SlotGroupWidget.Builder slotWidgetBuilder = SlotGroupWidget.builder() + .matrix(grid); + + SlotGroup group = new SlotGroup("item_" + io.name(), grid[0].length()); + slotWidgetBuilder.key('s', i -> { + var overlay = overlays.get(i) != null ? + overlays.get(i) : IDrawable.EMPTY; + + return new ItemSlot().slot(new ModularSlot(itemHandler, i) + .slotGroup(group)) + .background(defaultSlotBackground, overlay); + }); + + return slotWidgetBuilder.build() + .coverChildren() + .name(CAP.name + "_" + io.name()); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java index 6d2a54badc1..e835a87023d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java @@ -1,10 +1,16 @@ package com.gregtechceu.gtceu.api.capability.recipe; +import brachy.modularui.api.widget.IWidget; +import brachy.modularui.value.sync.PanelSyncManager; +import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.trait.MachineTraitType; +import com.gregtechceu.gtceu.api.machine.trait.NotifiableRecipeHandlerTrait; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.content.IContentSerializer; +import com.gregtechceu.gtceu.api.recipe.gui.GTRecipeTypeUILayout; import com.gregtechceu.gtceu.api.recipe.lookup.ingredient.AbstractMapIngredient; import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI; import com.gregtechceu.gtceu.api.registry.GTRegistries; @@ -162,10 +168,6 @@ public int getMaxParallelByInput(IRecipeCapabilityHolder holder, GTRecipe recipe return Integer.MAX_VALUE; } - public boolean doAddGuiSlots() { - return isRecipeSearchFilter(); - } - public void addXEIInfo(WidgetGroup group, int xOffset, GTRecipe recipe, List contents, boolean perTick, boolean isInput, MutableInt yOffset) {} @@ -223,4 +225,42 @@ public boolean isTickSlot(int index, IO io, GTRecipe recipe) { public boolean shouldBypassDistinct() { return true; } + + /** + * Gets the trait type of the {@link NotifiableRecipeHandlerTrait} which can handle this capability + * @return The recipe handler trait type + */ + public abstract MachineTraitType getNotifiableHandlerTraitType(); + + /// Capability UI + + /** + * If this capability should be rendered in IO slot columns + * @return If this capability has UI components + */ + public boolean shouldCreateCapabilityUI() { + return false; + } + + /** + * Creates the capability UI to be rendered for singleblock machines + * + * @param machine Machine + * @param syncManager + * @param layout the {@link GTRecipeTypeUILayout} for this recipe type + * @param capabilityAmount The capability amount (only relevant for fluids/items, where it represents the slot count) + * @param io IO mode (IN/OUT) + * @return Capability UI widget + */ + public @Nullable IWidget createCapabilityUI(@NotNull MetaMachine machine, + PanelSyncManager syncManager, + NotifiableRecipeHandlerTrait handler, + GTRecipeTypeUILayout layout, + int capabilityAmount, + int tier, + String themeId, + IO io) { + return null; + } + } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java index 296a7d59087..b31ccd3c88f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java @@ -1,32 +1,24 @@ package com.gregtechceu.gtceu.api.recipe.gui; import com.gregtechceu.gtceu.api.capability.recipe.*; -import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; -import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; +import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.trait.NotifiableRecipeHandlerTrait; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.common.mui.GTMuiWidgets; import brachy.modularui.api.drawable.IDrawable; import brachy.modularui.drawable.UITexture; -import brachy.modularui.theme.ThemeAPI; import brachy.modularui.value.sync.DoubleSyncValue; import brachy.modularui.value.sync.PanelSyncManager; -import brachy.modularui.value.sync.SyncHandlers; import brachy.modularui.widget.ParentWidget; import brachy.modularui.widgets.ProgressWidget; -import brachy.modularui.widgets.SlotGroupWidget; import brachy.modularui.widgets.layout.Flow; -import brachy.modularui.widgets.slot.FluidSlot; -import brachy.modularui.widgets.slot.ItemSlot; -import brachy.modularui.widgets.slot.ModularSlot; -import brachy.modularui.widgets.slot.SlotGroup; import it.unimi.dsi.fastutil.ints.*; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; import lombok.Getter; import lombok.Setter; -import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.function.DoubleSupplier; @@ -44,20 +36,47 @@ public class GTRecipeTypeUILayout { private ProgressWidget.Direction progressDirection; @Getter private Map, Int2ObjectOpenHashMap>> overlays = new EnumMap<>(IO.class); + @Getter private Map, Int2IntArrayMap>> gridLength = new EnumMap<>(IO.class); + @Getter private Map, Int2IntArrayMap>> gridWidths = new EnumMap<>(IO.class); public GTRecipeTypeUILayout() {} + @SuppressWarnings("unchecked") public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, @NotNull String themeId, - @Nullable NotifiableItemStackHandler inputItems, - @Nullable NotifiableItemStackHandler outputItems, - @Nullable NotifiableFluidTank inputFluids, - @Nullable NotifiableFluidTank outputFluids, + @NotNull MetaMachine machine, DoubleSupplier progressSupplier, int tier) { Objects.requireNonNull(recipeType); + Map, NotifiableRecipeHandlerTrait>> handlers = new Object2ObjectOpenHashMap<>(); + handlers.put(IO.IN, new Object2ObjectOpenHashMap<>()); + handlers.put(IO.OUT, new Object2ObjectOpenHashMap<>()); + + for (var capability: recipeType.maxInputs.keySet()) { + if (!capability.shouldCreateCapabilityUI()) continue; + + var traitType = capability.getNotifiableHandlerTraitType(); + List> capHandlers = (List>)machine.getTraitHolder().getTraits(traitType); + + var ioIn = handlers.get(IO.IN); + for (var capHandler: capHandlers) { + if (capHandler.getHandlerIO() == IO.IN) ioIn.putIfAbsent(capability, capHandler); + } + } + for (var capability: recipeType.maxOutputs.keySet()) { + if (!capability.shouldCreateCapabilityUI()) continue; + + var traitType = capability.getNotifiableHandlerTraitType(); + List> capHandlers = (List>)machine.getTraitHolder().getTraits(traitType); + + var ioOut = handlers.get(IO.OUT); + for (var capHandler: capHandlers) { + if (capHandler.getHandlerIO() == IO.OUT) ioOut.putIfAbsent(capability, capHandler); + } + } + DoubleSyncValue progressPercent = syncManager.getOrCreateSyncHandler("progressPercent", DoubleSyncValue.class, () -> new DoubleSyncValue(progressSupplier)); @@ -65,16 +84,14 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, .coverChildren() .horizontalCenter() .childPadding((progressSize / 2) + 2) - .childIf(inputItems != null || inputFluids != null, () -> getIOColumn(syncManager, IO.IN, - inputItems, inputFluids, themeId, tier)) + .childIf(!handlers.get(IO.IN).isEmpty(), () -> getIOColumn(syncManager, machine, IO.IN, handlers.get(IO.IN), themeId, tier)) .child(new ProgressWidget() .value(progressPercent) .name("progressBar") .texture(progressBar, progressSize) .size(progressSize) .direction(progressDirection)) - .childIf(outputFluids != null || outputItems != null, () -> getIOColumn(syncManager, IO.OUT, - outputItems, outputFluids, themeId, tier)); + .childIf(!handlers.get(IO.OUT).isEmpty(), () -> getIOColumn(syncManager, machine, IO.OUT, handlers.get(IO.OUT), themeId, tier)); return new ParentWidget<>() .widthRel(1f) @@ -82,84 +99,24 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, .child(backedSlotsRow); } - @Contract("_, _, null, null, _, _ -> fail") public Flow getIOColumn(@NotNull PanelSyncManager syncManager, + MetaMachine machine, IO io, - @Nullable NotifiableItemStackHandler items, - @Nullable NotifiableFluidTank fluids, + Map, NotifiableRecipeHandlerTrait> handlers, String themeId, int tier) { boolean in = io == IO.IN; - if (items == null && fluids == null) - throw new IllegalArgumentException("Item and fluid handler cannot both be null"); - var caps = (in ? recipeType.maxInputs : recipeType.maxOutputs); Flow ioColumn = Flow.col().coverChildren(); - var widgetGroups = new ArrayList>(); for (var recipeCap : caps.keySet()) { - int maxRecipeTypeSlots = caps.getInt(recipeCap); - int maxMachineSlots = 0; - if (maxRecipeTypeSlots == 0 || recipeCap == EURecipeCapability.CAP) continue; - if (recipeCap == ItemRecipeCapability.CAP) { - if (items == null) continue; - maxMachineSlots = items.getSlots(); - } else if (recipeCap == FluidRecipeCapability.CAP) { - if (fluids == null) continue; - maxMachineSlots = fluids.getTanks(); - } - - var grid = createGrid(io, recipeCap, 's', tier, maxMachineSlots); - - IDrawable defaultSlotBackground = (recipeCap == ItemRecipeCapability.CAP ? - ThemeAPI.INSTANCE.getTheme(themeId).getItemSlotTheme().theme().getBackground() : - ThemeAPI.INSTANCE.getTheme(themeId).getFluidSlotTheme().theme().getBackground()); - - SlotGroupWidget.Builder slotWidgetBuilder = SlotGroupWidget.builder() - .matrix(grid); - - if (recipeCap == ItemRecipeCapability.CAP) { - SlotGroup group = new SlotGroup("item_" + io.name(), grid[0].length()); - slotWidgetBuilder.key('s', i -> { - var overlay = IDrawable.EMPTY; - - if (overlays.containsKey(io) && overlays.get(io).containsKey(recipeCap)) { - overlay = overlays.get(io).get(recipeCap).get(i) != null ? - overlays.get(io).get(recipeCap).get(i) : IDrawable.EMPTY; - } - - return new ItemSlot().slot(new ModularSlot(items, i) - .slotGroup(group)) - .background(defaultSlotBackground, overlay); - }); - } else if (recipeCap == FluidRecipeCapability.CAP) { - String syncHandlerName = "fluid_" + io.name(); - for (int i = 0; i < maxMachineSlots; i++) { - syncManager.syncValue(syncHandlerName, i, SyncHandlers.fluidSlot(fluids.getStorages()[i])); - } - slotWidgetBuilder.key('s', i -> { - var overlay = IDrawable.EMPTY; - - if (overlays.containsKey(io) && overlays.get(io).containsKey(recipeCap)) { - overlay = overlays.get(io).get(recipeCap).get(i) != null ? - overlays.get(io).get(recipeCap).get(i) : IDrawable.EMPTY; - } - - return new FluidSlot() - .syncHandler(syncHandlerName, i) - .background(defaultSlotBackground, overlay); - }); - } - - widgetGroups.add(slotWidgetBuilder.build() - .coverChildren() - .name(recipeCap.name + "_" + io.name())); + var ui = recipeCap.createCapabilityUI(machine, syncManager, handlers.get(recipeCap), this, caps.getInt(recipeCap), tier, themeId, io); + if (ui != null) ioColumn.child(ui); } - widgetGroups.forEach(ioColumn::child); return ioColumn; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCapabilities.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCapabilities.java index 3efd43d9a99..f42f71771db 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCapabilities.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCapabilities.java @@ -16,7 +16,7 @@ public class GTRecipeCapabilities { public final static RecipeCapability ITEM = ItemRecipeCapability.CAP; public final static RecipeCapability FLUID = FluidRecipeCapability.CAP; - public final static RecipeCapability BLOCK_STATE = BlockStateRecipeCapability.CAP; + //public final static RecipeCapability BLOCK_STATE = BlockStateRecipeCapability.CAP; public final static RecipeCapability EU = EURecipeCapability.CAP; public final static RecipeCapability CWU = CWURecipeCapability.CAP; @@ -25,7 +25,7 @@ public static void init() { GTRegistries.RECIPE_CAPABILITIES.register(ITEM.name, ITEM); GTRegistries.RECIPE_CAPABILITIES.register(FLUID.name, FLUID); - GTRegistries.RECIPE_CAPABILITIES.register(BLOCK_STATE.name, BLOCK_STATE); + //GTRegistries.RECIPE_CAPABILITIES.register(BLOCK_STATE.name, BLOCK_STATE); GTRegistries.RECIPE_CAPABILITIES.register(EU.name, EU); GTRegistries.RECIPE_CAPABILITIES.register(CWU.name, CWU); diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTSingleblockMachinePanels.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTSingleblockMachinePanels.java index ea29de3fd39..b9ff0ef72bf 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTSingleblockMachinePanels.java +++ b/src/main/java/com/gregtechceu/gtceu/common/mui/GTSingleblockMachinePanels.java @@ -41,9 +41,7 @@ public class GTSingleblockMachinePanels { parent.child(Flow.row() .size(MachineUIPanel.DEFAULT_CONTENT_WIDTH, 18 + 9 + 18 * Math.max(2, slotHeight)) .childIf(hasXEI, () -> GTRecipeTypeUIs.recipeTypeUIs.get(simpleTieredMachine.getRecipeType()) - .getBackedSlotsRow(syncManager, theme, simpleTieredMachine.importItems, - simpleTieredMachine.exportItems, - simpleTieredMachine.importFluids, simpleTieredMachine.exportFluids, + .getBackedSlotsRow(syncManager, theme, simpleTieredMachine, simpleTieredMachine.recipeLogic::getProgressPercent, -1))); }).build(syncManager, settings).excludeAreaInRecipeViewer(); @@ -73,9 +71,7 @@ public class GTSingleblockMachinePanels { parent.child(Flow.row() .size(MachineUIPanel.DEFAULT_CONTENT_WIDTH, 18 + 9 + 18 * Math.max(2, slotHeight)) .childIf(hasXEI, () -> GTRecipeTypeUIs.recipeTypeUIs.get(simpleTieredMachine.getRecipeType()) - .getBackedSlotsRow(syncManager, theme, simpleTieredMachine.importItems, - simpleTieredMachine.exportItems, - simpleTieredMachine.importFluids, simpleTieredMachine.exportFluids, + .getBackedSlotsRow(syncManager, theme, simpleTieredMachine, simpleTieredMachine.recipeLogic::getProgressPercent, simpleTieredMachine.getTier()) .posRel(Alignment.Center))); @@ -106,9 +102,7 @@ public class GTSingleblockMachinePanels { parent.child(Flow.row() .size(MachineUIPanel.DEFAULT_CONTENT_WIDTH, 18 + 9 + 18 * Math.max(2, slotHeight)) .childIf(hasXEI, () -> GTRecipeTypeUIs.recipeTypeUIs.get(simpleTieredMachine.getRecipeType()) - .getBackedSlotsRow(syncManager, theme, simpleTieredMachine.importItems, - simpleTieredMachine.exportItems, - simpleTieredMachine.importFluids, simpleTieredMachine.exportFluids, + .getBackedSlotsRow(syncManager, theme, simpleTieredMachine, simpleTieredMachine.recipeLogic::getProgressPercent, 0) .posRel(Alignment.Center))); @@ -137,9 +131,7 @@ public class GTSingleblockMachinePanels { parent.child(Flow.row() .size(MachineUIPanel.DEFAULT_CONTENT_WIDTH, 18 + 9 + 18 * Math.max(2, slotHeight)) .childIf(hasXEI, () -> GTRecipeTypeUIs.recipeTypeUIs.get(steamMachine.getRecipeType()) - .getBackedSlotsRow(syncManager, theme, steamMachine.importItems, - steamMachine.exportItems, - null, null, + .getBackedSlotsRow(syncManager, theme, steamMachine, steamMachine.recipeLogic::getProgressPercent, steamMachine.getTier()) .posRel(Alignment.Center))); From f40e88fbdf977c39126523e20ccb97e8b29ed00b Mon Sep 17 00:00:00 2001 From: Gustavo Date: Fri, 24 Apr 2026 20:52:45 +1000 Subject: [PATCH 7/8] clean up ui functions --- .../recipe/FluidRecipeCapability.java | 7 +- .../recipe/ItemRecipeCapability.java | 7 +- .../capability/recipe/RecipeCapability.java | 2 - .../api/recipe/gui/GTRecipeTypeUILayout.java | 13 +-- .../gtceu/common/data/GTMachines.java | 4 - .../mui/GTSingleblockMachinePanels.java | 92 ++----------------- 6 files changed, 19 insertions(+), 106 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java index 2d532df4247..c2be348795b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java @@ -9,6 +9,7 @@ import brachy.modularui.widgets.slot.FluidSlot; import com.gregtechceu.gtceu.api.gui.widget.TankWidget; import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.TieredMachine; import com.gregtechceu.gtceu.api.machine.trait.*; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; @@ -481,11 +482,11 @@ public boolean shouldCreateCapabilityUI() { NotifiableRecipeHandlerTrait handler, GTRecipeTypeUILayout layout, int maxRecipeTypeSlots, - int tier, - String themeId, IO io) { if (maxRecipeTypeSlots == 0) return null; + var tier = ((TieredMachine)machine).getTier(); + var fluidTank = (NotifiableFluidTank)handler; var overlays = layout.getOverlays().computeIfAbsent(io, $ -> new Object2ObjectOpenHashMap<>()).computeIfAbsent(CAP, $ -> new Int2ObjectOpenHashMap<>()); @@ -493,7 +494,7 @@ public boolean shouldCreateCapabilityUI() { var grid = layout.createGrid(io, CAP, 's', tier, maxMachineSlots); - IDrawable defaultSlotBackground = ThemeAPI.INSTANCE.getTheme(themeId).getFluidSlotTheme().theme().getBackground(); + IDrawable defaultSlotBackground = ThemeAPI.INSTANCE.getTheme(machine.getDefinition().getThemeId()).getFluidSlotTheme().theme().getBackground(); SlotGroupWidget.Builder slotWidgetBuilder = SlotGroupWidget.builder() .matrix(grid); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index 96d14f42184..5aa8ed5e048 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -10,6 +10,7 @@ import brachy.modularui.widgets.slot.SlotGroup; import com.gregtechceu.gtceu.api.gui.widget.SlotWidget; import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.TieredMachine; import com.gregtechceu.gtceu.api.machine.trait.*; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; @@ -612,18 +613,18 @@ public boolean shouldCreateCapabilityUI() { NotifiableRecipeHandlerTrait handler, GTRecipeTypeUILayout layout, int maxRecipeTypeSlots, - int tier, - String themeId, IO io) { if (maxRecipeTypeSlots == 0) return null; + var tier = ((TieredMachine)machine).getTier(); + var itemHandler = (NotifiableItemStackHandler)handler; var overlays = layout.getOverlays().computeIfAbsent(io, $ -> new Object2ObjectOpenHashMap<>()).computeIfAbsent(CAP, $ -> new Int2ObjectOpenHashMap<>()); var grid = layout.createGrid(io, CAP, 's', tier, itemHandler.getSlots()); - IDrawable defaultSlotBackground = ThemeAPI.INSTANCE.getTheme(themeId).getItemSlotTheme().theme().getBackground(); + IDrawable defaultSlotBackground = ThemeAPI.INSTANCE.getTheme(machine.getDefinition().getThemeId()).getItemSlotTheme().theme().getBackground(); SlotGroupWidget.Builder slotWidgetBuilder = SlotGroupWidget.builder() .matrix(grid); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java index e835a87023d..2a194c744e3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java @@ -257,8 +257,6 @@ public boolean shouldCreateCapabilityUI() { NotifiableRecipeHandlerTrait handler, GTRecipeTypeUILayout layout, int capabilityAmount, - int tier, - String themeId, IO io) { return null; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java index b31ccd3c88f..eda0567fa60 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java @@ -45,9 +45,8 @@ public GTRecipeTypeUILayout() {} @SuppressWarnings("unchecked") public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, - @NotNull String themeId, @NotNull MetaMachine machine, - DoubleSupplier progressSupplier, int tier) { + DoubleSupplier progressSupplier) { Objects.requireNonNull(recipeType); Map, NotifiableRecipeHandlerTrait>> handlers = new Object2ObjectOpenHashMap<>(); @@ -84,14 +83,14 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, .coverChildren() .horizontalCenter() .childPadding((progressSize / 2) + 2) - .childIf(!handlers.get(IO.IN).isEmpty(), () -> getIOColumn(syncManager, machine, IO.IN, handlers.get(IO.IN), themeId, tier)) + .childIf(!handlers.get(IO.IN).isEmpty(), () -> getIOColumn(syncManager, machine, IO.IN, handlers.get(IO.IN))) .child(new ProgressWidget() .value(progressPercent) .name("progressBar") .texture(progressBar, progressSize) .size(progressSize) .direction(progressDirection)) - .childIf(!handlers.get(IO.OUT).isEmpty(), () -> getIOColumn(syncManager, machine, IO.OUT, handlers.get(IO.OUT), themeId, tier)); + .childIf(!handlers.get(IO.OUT).isEmpty(), () -> getIOColumn(syncManager, machine, IO.OUT, handlers.get(IO.OUT))); return new ParentWidget<>() .widthRel(1f) @@ -102,9 +101,7 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, public Flow getIOColumn(@NotNull PanelSyncManager syncManager, MetaMachine machine, IO io, - Map, NotifiableRecipeHandlerTrait> handlers, - String themeId, - int tier) { + Map, NotifiableRecipeHandlerTrait> handlers) { boolean in = io == IO.IN; var caps = (in ? recipeType.maxInputs : recipeType.maxOutputs); @@ -113,7 +110,7 @@ public Flow getIOColumn(@NotNull PanelSyncManager syncManager, for (var recipeCap : caps.keySet()) { - var ui = recipeCap.createCapabilityUI(machine, syncManager, handlers.get(recipeCap), this, caps.getInt(recipeCap), tier, themeId, io); + var ui = recipeCap.createCapabilityUI(machine, syncManager, handlers.get(recipeCap), this, caps.getInt(recipeCap), io); if (ui != null) ioColumn.child(ui); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java index f0ee613fc6e..b6a63a42894 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java @@ -185,9 +185,6 @@ public class GTMachines { public static final MachineDefinition[] ARC_FURNACE = registerTieredMachines("arc_furnace", (holder, tier) -> new SimpleTieredMachine(holder, tier, defaultTankSizeFunction), (tier, builder) -> builder .langValue("%s Arc Furnace %s".formatted(VLVH[tier], VLVT[tier])) - .ui(GTSingleblockMachinePanels.ARC_FURNACE) - // .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("arc_furnace"), - // GTRecipeTypes.ARC_FURNACE_RECIPES)) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.ARC_FURNACE_RECIPES) .recipeModifier(GTRecipeModifiers.OC_NON_PERFECT) @@ -287,7 +284,6 @@ public class GTMachines { public static final MachineDefinition[] MACERATOR = registerTieredMachines("macerator", (holder, tier) -> new SimpleTieredMachine(holder, tier, defaultTankSizeFunction), (tier, builder) -> builder .langValue("%s Macerator %s".formatted(VLVH[tier], VLVT[tier])) - .ui(GTSingleblockMachinePanels.MACERATOR) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.MACERATOR_RECIPES) .addOutputLimit(ItemRecipeCapability.CAP, switch (tier) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTSingleblockMachinePanels.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTSingleblockMachinePanels.java index b9ff0ef72bf..8d60a520557 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTSingleblockMachinePanels.java +++ b/src/main/java/com/gregtechceu/gtceu/common/mui/GTSingleblockMachinePanels.java @@ -27,85 +27,14 @@ public class GTSingleblockMachinePanels { } return MachineUIPanelBuilder.defaultSimpleSingleblockPanelBuilder(machine).mainContents((parent) -> { - var inputItemGrid = GTMuiWidgets.createGrid(simpleTieredMachine.importItems.getSize(), 3, false, 'i'); - var inputFluidGrid = GTMuiWidgets.createGrid(simpleTieredMachine.importFluids.getSize(), 3, false, 'f'); - var outputItemGrid = GTMuiWidgets.createGrid(simpleTieredMachine.exportItems.getSize(), 3, true, 'i'); - var outputFluidGrid = GTMuiWidgets.createGrid(simpleTieredMachine.exportFluids.getSize(), 3, true, 'f'); - - int slotHeight = Math.max(inputItemGrid.length + inputFluidGrid.length, - outputItemGrid.length + outputFluidGrid.length); boolean hasXEI = GTRecipeTypeUIs.recipeTypeUIs.containsKey(simpleTieredMachine.getRecipeType()); - var theme = machine.getDefinition().getThemeId(); - parent.child(Flow.row() - .size(MachineUIPanel.DEFAULT_CONTENT_WIDTH, 18 + 9 + 18 * Math.max(2, slotHeight)) + .coverChildren(MachineUIPanel.DEFAULT_CONTENT_WIDTH, MachineUIPanel.DEFAULT_CONTENT_HEIGHT) .childIf(hasXEI, () -> GTRecipeTypeUIs.recipeTypeUIs.get(simpleTieredMachine.getRecipeType()) - .getBackedSlotsRow(syncManager, theme, simpleTieredMachine, - simpleTieredMachine.recipeLogic::getProgressPercent, - -1))); - }).build(syncManager, settings).excludeAreaInRecipeViewer(); - }; - - public static PanelFactory MACERATOR = (PosGuiData data, PanelSyncManager syncManager, UISettings settings, - MetaMachine machine) -> { - if (!(machine instanceof SimpleTieredMachine simpleTieredMachine)) { - GTCEu.LOGGER.error("{} is not a SimpleTieredMachine, can not add slots to its content", - machine.getDefinition().getName()); - return new ModularPanel<>(machine.getDefinition().getName()); - } - - return MachineUIPanelBuilder.defaultSimpleSingleblockPanelBuilder(machine).mainContents((parent) -> { - - var inputItemGrid = GTMuiWidgets.createGrid(simpleTieredMachine.importItems.getSize(), 3, false, 'i'); - var inputFluidGrid = GTMuiWidgets.createGrid(simpleTieredMachine.importFluids.getSize(), 3, false, 'f'); - var outputItemGrid = GTMuiWidgets.createGrid(simpleTieredMachine.exportItems.getSize(), 3, true, 'i'); - var outputFluidGrid = GTMuiWidgets.createGrid(simpleTieredMachine.exportFluids.getSize(), 3, true, 'f'); - - int slotHeight = Math.max(inputItemGrid.length + inputFluidGrid.length, - outputItemGrid.length + outputFluidGrid.length); - boolean hasXEI = GTRecipeTypeUIs.recipeTypeUIs.containsKey(simpleTieredMachine.getRecipeType()); - - var theme = machine.getDefinition().getThemeId(); + .getBackedSlotsRow(syncManager, simpleTieredMachine, + simpleTieredMachine.recipeLogic::getProgressPercent))); - parent.child(Flow.row() - .size(MachineUIPanel.DEFAULT_CONTENT_WIDTH, 18 + 9 + 18 * Math.max(2, slotHeight)) - .childIf(hasXEI, () -> GTRecipeTypeUIs.recipeTypeUIs.get(simpleTieredMachine.getRecipeType()) - .getBackedSlotsRow(syncManager, theme, simpleTieredMachine, - simpleTieredMachine.recipeLogic::getProgressPercent, - simpleTieredMachine.getTier()) - .posRel(Alignment.Center))); - }).build(syncManager, settings).excludeAreaInRecipeViewer(); - }; - - public static PanelFactory ARC_FURNACE = (PosGuiData data, PanelSyncManager syncManager, UISettings settings, - MetaMachine machine) -> { - if (!(machine instanceof SimpleTieredMachine simpleTieredMachine)) { - GTCEu.LOGGER.error("{} is not a WorkableTieredMachine, can not add slots to its content", - machine.getDefinition().getName()); - return new ModularPanel<>(machine.getDefinition().getName()); - } - - return MachineUIPanelBuilder.defaultSimpleSingleblockPanelBuilder(machine).mainContents((parent) -> { - var inputItemGrid = GTMuiWidgets.createGrid(simpleTieredMachine.importItems.getSize(), 3, false, 'i'); - var inputFluidGrid = GTMuiWidgets.createGrid(simpleTieredMachine.importFluids.getSize(), 3, false, 'f'); - var outputItemGrid = GTMuiWidgets.createGrid(simpleTieredMachine.exportItems.getSize(), 3, true, 'i'); - var outputFluidGrid = GTMuiWidgets.createGrid(simpleTieredMachine.exportFluids.getSize(), 3, true, 'f'); - - int slotHeight = Math.max(inputItemGrid.length + inputFluidGrid.length, - outputItemGrid.length + outputFluidGrid.length); - - var theme = machine.getDefinition().getThemeId(); - - boolean hasXEI = GTRecipeTypeUIs.recipeTypeUIs.containsKey(simpleTieredMachine.getRecipeType()); - - parent.child(Flow.row() - .size(MachineUIPanel.DEFAULT_CONTENT_WIDTH, 18 + 9 + 18 * Math.max(2, slotHeight)) - .childIf(hasXEI, () -> GTRecipeTypeUIs.recipeTypeUIs.get(simpleTieredMachine.getRecipeType()) - .getBackedSlotsRow(syncManager, theme, simpleTieredMachine, - simpleTieredMachine.recipeLogic::getProgressPercent, - 0) - .posRel(Alignment.Center))); }).build(syncManager, settings).excludeAreaInRecipeViewer(); }; @@ -118,22 +47,13 @@ public class GTSingleblockMachinePanels { } return MachineUIPanelBuilder.defaultSteamMachineBuilder(machine).mainContents(parent -> { - var inputItemGrid = GTMuiWidgets.createGrid(steamMachine.importItems.getSize(), 3, false, 'i'); - var outputItemGrid = GTMuiWidgets.createGrid(steamMachine.exportItems.getSize(), 3, true, 'i'); - - int slotHeight = Math.max(inputItemGrid.length, - outputItemGrid.length); - boolean hasXEI = GTRecipeTypeUIs.recipeTypeUIs.containsKey(steamMachine.getRecipeType()); - var theme = machine.getDefinition().getThemeId(); - parent.child(Flow.row() - .size(MachineUIPanel.DEFAULT_CONTENT_WIDTH, 18 + 9 + 18 * Math.max(2, slotHeight)) + .coverChildren(MachineUIPanel.DEFAULT_CONTENT_WIDTH, MachineUIPanel.DEFAULT_CONTENT_HEIGHT) .childIf(hasXEI, () -> GTRecipeTypeUIs.recipeTypeUIs.get(steamMachine.getRecipeType()) - .getBackedSlotsRow(syncManager, theme, steamMachine, - steamMachine.recipeLogic::getProgressPercent, - steamMachine.getTier()) + .getBackedSlotsRow(syncManager, steamMachine, + steamMachine.recipeLogic::getProgressPercent) .posRel(Alignment.Center))); }).build(syncManager, settings).excludeAreaInRecipeViewer(); }; From 2e1a4089ded902a24ec8f671d1dd742c7be067e9 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Fri, 24 Apr 2026 20:57:10 +1000 Subject: [PATCH 8/8] a --- .../api/recipe/gui/GTRecipeTypeUILayout.java | 45 ++++--------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java index eda0567fa60..398139e66c7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/GTRecipeTypeUILayout.java @@ -43,39 +43,11 @@ public class GTRecipeTypeUILayout { public GTRecipeTypeUILayout() {} - @SuppressWarnings("unchecked") public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, @NotNull MetaMachine machine, DoubleSupplier progressSupplier) { Objects.requireNonNull(recipeType); - Map, NotifiableRecipeHandlerTrait>> handlers = new Object2ObjectOpenHashMap<>(); - handlers.put(IO.IN, new Object2ObjectOpenHashMap<>()); - handlers.put(IO.OUT, new Object2ObjectOpenHashMap<>()); - - for (var capability: recipeType.maxInputs.keySet()) { - if (!capability.shouldCreateCapabilityUI()) continue; - - var traitType = capability.getNotifiableHandlerTraitType(); - List> capHandlers = (List>)machine.getTraitHolder().getTraits(traitType); - - var ioIn = handlers.get(IO.IN); - for (var capHandler: capHandlers) { - if (capHandler.getHandlerIO() == IO.IN) ioIn.putIfAbsent(capability, capHandler); - } - } - for (var capability: recipeType.maxOutputs.keySet()) { - if (!capability.shouldCreateCapabilityUI()) continue; - - var traitType = capability.getNotifiableHandlerTraitType(); - List> capHandlers = (List>)machine.getTraitHolder().getTraits(traitType); - - var ioOut = handlers.get(IO.OUT); - for (var capHandler: capHandlers) { - if (capHandler.getHandlerIO() == IO.OUT) ioOut.putIfAbsent(capability, capHandler); - } - } - DoubleSyncValue progressPercent = syncManager.getOrCreateSyncHandler("progressPercent", DoubleSyncValue.class, () -> new DoubleSyncValue(progressSupplier)); @@ -83,14 +55,14 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, .coverChildren() .horizontalCenter() .childPadding((progressSize / 2) + 2) - .childIf(!handlers.get(IO.IN).isEmpty(), () -> getIOColumn(syncManager, machine, IO.IN, handlers.get(IO.IN))) + .child(getIOColumn(syncManager, machine, IO.IN)) .child(new ProgressWidget() .value(progressPercent) .name("progressBar") .texture(progressBar, progressSize) .size(progressSize) .direction(progressDirection)) - .childIf(!handlers.get(IO.OUT).isEmpty(), () -> getIOColumn(syncManager, machine, IO.OUT, handlers.get(IO.OUT))); + .child(getIOColumn(syncManager, machine, IO.OUT)); return new ParentWidget<>() .widthRel(1f) @@ -100,17 +72,16 @@ public ParentWidget getBackedSlotsRow(@NotNull PanelSyncManager syncManager, public Flow getIOColumn(@NotNull PanelSyncManager syncManager, MetaMachine machine, - IO io, - Map, NotifiableRecipeHandlerTrait> handlers) { - boolean in = io == IO.IN; + IO io) { - var caps = (in ? recipeType.maxInputs : recipeType.maxOutputs); + var caps = (io == IO.IN ? recipeType.maxInputs : recipeType.maxOutputs); Flow ioColumn = Flow.col().coverChildren(); - - for (var recipeCap : caps.keySet()) { - var ui = recipeCap.createCapabilityUI(machine, syncManager, handlers.get(recipeCap), this, caps.getInt(recipeCap), io); + List> handlers = (List>)machine.getTraitHolder().getTraits(recipeCap.getNotifiableHandlerTraitType()); + var handler = handlers.stream().filter(h -> h.getHandlerIO() == io).findFirst(); + if (handler.isEmpty()) continue; + var ui = recipeCap.createCapabilityUI(machine, syncManager, handler.get(), this, caps.getInt(recipeCap), io); if (ui != null) ioColumn.child(ui); }