Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@

import net.minecraftforge.fluids.FluidStack;

import lombok.Getter;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

public class SteamEnergyRecipeHandler implements IRecipeHandler<EnergyStack> {

@Getter
private final NotifiableFluidTank steamTank;
private final double conversionRate; // mB steam per EU

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public static SlotGroupWidget playerInventory(int bottom, boolean horizontalCent
* @return player inventory group
*/
public static SlotGroupWidget playerInventory(SlotConsumer slotConsumer) {
SlotGroupWidget slotGroupWidget = new SlotGroupWidget();
slotGroupWidget.coverChildren();
slotGroupWidget.name("player_inventory");
SlotGroupWidget slotGroupWidget = new SlotGroupWidget()
.coverChildren()
.name("player_inventory");
String key = "player";
for (int i = 0; i < 9; i++) {
slotGroupWidget.child(slotConsumer.apply(i, new ItemSlot())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public class MachineBuilder<DEFINITION extends MachineDefinition, TYPE extends M
private boolean regressWhenWaiting = true;
private boolean allowCoverOnFront = false;
@Getter
private PanelFactory UI = null;
private PanelFactory ui = null;
@Getter
private String themeId = ThemeAPI.DEFAULT_ID;
private Supplier<BlockState> appearance;
Expand Down Expand Up @@ -302,8 +302,8 @@ public TYPE appearance(Supplier<BlockState> appearance) {
return getThis();
}

public TYPE UI(PanelFactory ui) {
this.UI = ui;
public TYPE ui(PanelFactory ui) {
this.ui = ui;
return getThis();
}

Expand Down Expand Up @@ -695,8 +695,8 @@ public DEFINITION register() {
blockEntityBuilder = blockEntityBuilder.renderer(() -> BlockEntityWithBERModelRenderer::new);
}
var blockEntity = blockEntityBuilder.register();
if (this.UI != null) {
definition.setUI(UI);
if (this.ui != null) {
definition.setUI(ui);
}
if (this.themeId != null) {
definition.setThemeId(themeId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public ParentWidget<?> createCoverUI(SidedPosGuiData data, PanelSyncManager sync
syncManager.syncValue("io", ioSync);

if (createThroughputRow()) {
column.child(GTMuiWidgets.createIntInputWithButtons(transferRate, 1, maxItemTransferRate));
column.child(GTMuiWidgets.createIntInputWithButtons(transferRate, () -> 1, () -> maxItemTransferRate));
}

if (createFilterRow()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,10 @@ public ParentWidget<?> createCoverUI(SidedPosGuiData data, PanelSyncManager sync
.lang(IKey.dynamic(() -> Component.translatable(getTransferMode().tooltip)))
.build());

column.child(GTMuiWidgets.createIntInputWithBucketMode(transferSize, transferBucketMode, maxFluidTransferRate));
column.child(GTMuiWidgets.createIntInputWithBucketMode(transferSize, transferBucketMode,
() -> maxFluidTransferRate));

column.child(GTMuiWidgets.createIntInputWithButtons(transferSize, 1, MAX_STACK_SIZE)
column.child(GTMuiWidgets.createIntInputWithButtons(transferSize, () -> 1, () -> MAX_STACK_SIZE)
.setEnabledIf($ -> shouldShowTransferSize()));

return column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ public ParentWidget<?> createCoverUI(SidedPosGuiData data, PanelSyncManager sync
syncManager.syncValue("io", ioSync);
syncManager.syncValue("manualIO", manualIOModeSync);

column.child(GTMuiWidgets.createIntInputWithBucketMode(transferRateSync, bucketModeSync, maxFluidTransferRate));
column.child(GTMuiWidgets.createIntInputWithBucketMode(transferRateSync, bucketModeSync,
() -> maxFluidTransferRate));

column.child(GTMuiWidgets.createFilterRow(filterHandler, FluidFilter::loadFilter, data, syncManager, settings)
.child(0, GTMuiWidgets.createIOCycleButton(ioSync, false).marginRight(2)).marginBottom(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public ParentWidget<?> createCoverUI(SidedPosGuiData data, PanelSyncManager sync
var column = super.createCoverUI(data, syncManager, settings);

var transferMode = new EnumSyncValue<>(TransferMode.class, this::getTransferMode, this::setTransferMode);
var transferSize = new IntSyncValue(this::getGlobalTransferLimit, this::setGlobalTransferLimit);
var transferSize = new IntSyncValue(this::getGlobalTransferLimit, v -> this.globalTransferLimit = v);

syncManager.syncValue("transferMode", transferMode);
syncManager.syncValue("transferSize", transferSize);
Expand All @@ -191,7 +191,7 @@ public ParentWidget<?> createCoverUI(SidedPosGuiData data, PanelSyncManager sync
.lang(IKey.dynamic(() -> Component.translatable(getTransferMode().tooltip)))
.build());

column.child(GTMuiWidgets.createIntInputWithButtons(transferSize, 1, getTransferMode().maxStackSize)
column.child(GTMuiWidgets.createIntInputWithButtons(transferSize, () -> 1, () -> getTransferMode().maxStackSize)
.setEnabledIf($ -> shouldShowStackSize()));

return column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public ParentWidget<?> createCoverUI(SidedPosGuiData data, PanelSyncManager sync
.marginTop(2));

column.child(
GTMuiWidgets.createIntInputWithBucketMode(voidingLimit, bucketModeSync, getVoidingMode().maxStackSize)
GTMuiWidgets
.createIntInputWithBucketMode(voidingLimit, bucketModeSync, () -> getVoidingMode().maxStackSize)
.setEnabledIf($ -> shouldShowStackSize()));

return column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public ParentWidget<?> createCoverUI(SidedPosGuiData data, PanelSyncManager sync
.build()
.marginTop(2));

column.child(GTMuiWidgets.createIntInputWithButtons(voidingLimit, 1, getVoidingMode().maxStackSize)
column.child(GTMuiWidgets.createIntInputWithButtons(voidingLimit, () -> 1, () -> getVoidingMode().maxStackSize)
.setEnabledIf($ -> shouldShowStackSize()));

return column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public class GTMachines {
.recipeModifier(SimpleSteamMachine::recipeModifier)
.addOutputLimit(ItemRecipeCapability.CAP, 1)
.themeId((i) -> i > 0 ? GTGuiTheme.STEEL.getId() : GTGuiTheme.BRONZE.getId())
.UI(GTSingleblockMachinePanels.STEAM_MACHINE)
.ui(GTSingleblockMachinePanels.STEAM_MACHINE)
.modelProperty(GTMachineModelProperties.VENT_DIRECTION, RelativeDirection.BACK)
.workableSteamHullModel(pressure, GTCEu.id("block/machines/macerator"))
.register());
Expand Down Expand Up @@ -184,7 +184,7 @@ 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)
.ui(GTSingleblockMachinePanels.ARC_FURNACE)
// .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("arc_furnace"),
// GTRecipeTypes.ARC_FURNACE_RECIPES))
.rotationState(RotationState.NON_Y_AXIS)
Expand Down Expand Up @@ -286,7 +286,7 @@ 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)
.ui(GTSingleblockMachinePanels.MACERATOR)
// .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("macerator"),
// GTRecipeTypes.MACERATOR_RECIPES))
.rotationState(RotationState.NON_Y_AXIS)
Expand All @@ -313,7 +313,7 @@ public class GTMachines {
.langValue("%s Rock Crusher %s".formatted(VLVH[tier], VLVT[tier]))
.editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("rock_crusher"),
GTRecipeTypes.ROCK_BREAKER_RECIPES))
.UI(GTSingleblockMachinePanels.GENERAL_MACHINE)
.ui(GTSingleblockMachinePanels.GENERAL_MACHINE)
.rotationState(RotationState.NON_Y_AXIS)
.recipeType(GTRecipeTypes.ROCK_BREAKER_RECIPES)
.recipeModifier(GTRecipeModifiers.OC_NON_PERFECT)
Expand All @@ -328,7 +328,7 @@ public class GTMachines {
.langValue("%s Air Scrubber %s".formatted(VLVH[tier], VLVT[tier]))
.editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("air_scrubber"),
GTRecipeTypes.AIR_SCRUBBER_RECIPES))
.UI(GTSingleblockMachinePanels.GENERAL_MACHINE)
.ui(GTSingleblockMachinePanels.GENERAL_MACHINE)
.rotationState(RotationState.NON_Y_AXIS)
.recipeType(GTRecipeTypes.AIR_SCRUBBER_RECIPES)
.recipeModifier(GTRecipeModifiers.OC_NON_PERFECT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void init() {}
.abilities(PartAbility.PARALLEL_HATCH)
.modelProperty(IS_FORMED, false)
.modelProperty(GTMachineModelProperties.RECIPE_LOGIC_STATUS, RecipeLogic.Status.IDLE)
.UI((guiData, syncManager, uiSettings, machine) -> {
.ui((guiData, syncManager, uiSettings, machine) -> {
return ((ParallelHatchPartMachine) machine).buildUI(guiData, syncManager, uiSettings);
})
.model(createWorkableTieredHullMachineModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public static Pair<MachineDefinition, MachineDefinition> registerSimpleSteamMach
.recipeType(recipeType)
.recipeModifier(SimpleSteamMachine::recipeModifier)
.themeId((i) -> i > 0 ? GTGuiTheme.STEEL.getId() : GTGuiTheme.BRONZE.getId())
.UI(GTSingleblockMachinePanels.STEAM_MACHINE)
.ui(GTSingleblockMachinePanels.STEAM_MACHINE)
.modelProperty(GTMachineModelProperties.VENT_DIRECTION, RelativeDirection.BACK)
.workableSteamHullModel(pressure, GTCEu.id("block/machines/" + name))
.register());
Expand Down Expand Up @@ -1013,7 +1013,7 @@ public MachineDefinition[] register() {
.workableTieredHullModel(GTCEu.id("block/machines/" + name))
.tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType,
tankScalingFunction.applyAsInt(tier), true))
.UI(panelFactory)
.ui(panelFactory)
.register();
},
tiers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ public class GTMultiMachines {
.multiblock("steam_grinder", SteamParallelMultiblockMachine::new)
.rotationState(RotationState.ALL)
.appearanceBlock(CASING_BRONZE_BRICKS)
.themeId(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks ? GTGuiTheme.STEEL.getId() :
GTGuiTheme.BRONZE.getId())
.recipeType(GTRecipeTypes.MACERATOR_RECIPES)
.recipeModifier(SteamParallelMultiblockMachine::recipeModifier, true)
.addOutputLimit(ItemRecipeCapability.CAP, 1)
Expand All @@ -625,6 +627,8 @@ public class GTMultiMachines {
.multiblock("steam_oven", SteamParallelMultiblockMachine::new)
.rotationState(RotationState.ALL)
.appearanceBlock(CASING_BRONZE_BRICKS)
.themeId(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks ? GTGuiTheme.STEEL.getId() :
GTGuiTheme.BRONZE.getId())
.recipeType(GTRecipeTypes.FURNACE_RECIPES)
.recipeModifier(SteamParallelMultiblockMachine::recipeModifier, true)
.addOutputLimit(ItemRecipeCapability.CAP, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static Flow createTitleBar(ItemStack stack, int panelWidth, UITexture bac
.crossAxisAlignment(Alignment.CrossAxis.CENTER)
.width(rowWidth)
.top(-(textHeight + borderRadius))
.rightRel(0.45f)
.horizontalCenter()
.background(background.getSubArea(0f, 0f, 1.0f, 0.75f))
.child(new ItemDrawable(stack)
.asIcon().size(iconSize)
Expand Down Expand Up @@ -440,7 +440,8 @@ private static IKey createAdjustOverlay(boolean increment) {
.scale(scale);
}

public static ParentWidget<?> createIntInputWithButtons(IntSyncValue syncValue, int minValue, int maxValue) {
public static ParentWidget<?> createIntInputWithButtons(IntSyncValue syncValue, IntSupplier minValue,
IntSupplier maxValue) {
StringSyncValue formattedValue = new StringSyncValue(syncValue::getStringValue,
syncValue::setStringValue);

Expand All @@ -452,7 +453,7 @@ public static ParentWidget<?> createIntInputWithButtons(IntSyncValue syncValue,
.left(0).width(18)
.onMousePressed((x, y, button) -> {
int val = syncValue.getIntValue() - getIncrementValue(MouseData.create(button));
val = Mth.clamp(val, minValue, maxValue);
val = Mth.clamp(val, minValue.getAsInt(), maxValue.getAsInt());
syncValue.setIntValue(val, true, true);
return true;
})
Expand All @@ -464,7 +465,8 @@ public static ParentWidget<?> createIntInputWithButtons(IntSyncValue syncValue,
.setNumbers(minValue, maxValue)
.onMouseScrolled((mouseX, mouseY, delta) -> {
int inc = (int) delta * getIncrementValue(MouseData.create(-1));
int val = Mth.clamp(syncValue.getIntValue() + inc, minValue, maxValue);
int val = Mth.clamp(syncValue.getIntValue() + inc, minValue.getAsInt(),
maxValue.getAsInt());
syncValue.setIntValue(val, true, true);
return true;
})
Expand All @@ -474,7 +476,7 @@ public static ParentWidget<?> createIntInputWithButtons(IntSyncValue syncValue,
.right(0).width(18)
.onMousePressed((x, y, button) -> {
int val = syncValue.getIntValue() + getIncrementValue(MouseData.create(button));
val = Mth.clamp(val, minValue, maxValue);
val = Mth.clamp(val, minValue.getAsInt(), maxValue.getAsInt());
syncValue.setIntValue(val, true, true);
return true;
})
Expand All @@ -483,10 +485,10 @@ public static ParentWidget<?> createIntInputWithButtons(IntSyncValue syncValue,

public static ParentWidget<?> createIntInputWithBucketMode(IntSyncValue intSyncValue,
EnumSyncValue<BucketMode> bucketModeSyncValue,
int maxMB) {
IntSupplier maxMB) {
StringSyncValue formattedValue = new StringSyncValue(
() -> String.valueOf((intSyncValue.getValue() / bucketModeSyncValue.getValue().multiplier)),
(v) -> intSyncValue.setValue(Integer.parseInt(v) * bucketModeSyncValue.getValue().multiplier, true,
() -> String.valueOf(intSyncValue.getValue()),
(v) -> intSyncValue.setValue(Integer.parseInt(v), true,
true));

return Flow.row()
Expand All @@ -498,7 +500,7 @@ public static ParentWidget<?> createIntInputWithBucketMode(IntSyncValue intSyncV
.onMousePressed((x, y, button) -> {
int val = intSyncValue.getIntValue() - (getIncrementValue(MouseData.create(button)) *
bucketModeSyncValue.getValue().multiplier);
val = Mth.clamp(val, 0, maxMB);
val = Mth.clamp(val, 0, maxMB.getAsInt());
intSyncValue.setIntValue(val, true, true);
return true;
})
Expand All @@ -507,11 +509,11 @@ public static ParentWidget<?> createIntInputWithBucketMode(IntSyncValue intSyncV
.left(18).right(36)
.setTextAlignment(Alignment.Center)
.setTextColor(Color.WHITE.darker(1))
.setNumbers(0, maxMB)
.setNumbers(0, maxMB.getAsInt())
.onMouseScrolled((mouseX, mouseY, delta) -> {
int inc = (int) delta * (getIncrementValue(MouseData.create(-1)) *
bucketModeSyncValue.getValue().multiplier);
int val = Mth.clamp(intSyncValue.getIntValue() + inc, 0, maxMB);
int val = Mth.clamp(intSyncValue.getIntValue() + inc, 0, maxMB.getAsInt());
intSyncValue.setIntValue(val, true, true);
return true;
})
Expand All @@ -523,7 +525,7 @@ public static ParentWidget<?> createIntInputWithBucketMode(IntSyncValue intSyncV
.onMousePressed((x, y, button) -> {
int val = intSyncValue.getIntValue() + (getIncrementValue(MouseData.create(button)) *
bucketModeSyncValue.getValue().multiplier);
val = Mth.clamp(val, 0, maxMB);
val = Mth.clamp(val, 0, maxMB.getAsInt());
intSyncValue.setIntValue(val, true, true);
return true;
})
Expand Down
Loading