Skip to content
Open
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 @@ -29,6 +29,7 @@
import com.gregtechceu.gtceu.common.machine.multiblock.primitive.PrimitiveBlastFurnaceMachine;
import com.gregtechceu.gtceu.common.machine.multiblock.primitive.PrimitivePumpMachine;
import com.gregtechceu.gtceu.common.machine.multiblock.steam.SteamParallelMultiblockMachine;
import com.gregtechceu.gtceu.common.mui.GTGuiTheme;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.utils.FormattingUtil;
import com.gregtechceu.gtceu.utils.GTUtil;
Expand Down Expand Up @@ -108,6 +109,7 @@ public class GTMultiMachines {
.build())
.workableCasingModel(GTCEu.id("block/casings/solid/machine_coke_bricks"),
GTCEu.id("block/multiblock/coke_oven"))
.themeId((i) -> GTGuiTheme.PRIMITIVE.getId())
.register();

public static final MultiblockMachineDefinition PRIMITIVE_BLAST_FURNACE = REGISTRATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.gregtechceu.gtceu.api.mui.widgets.layout.Flow;
import com.gregtechceu.gtceu.api.mui.widgets.layout.Grid;
import com.gregtechceu.gtceu.api.mui.widgets.layout.Row;
import com.gregtechceu.gtceu.api.mui.widgets.slot.FluidSlot;
import com.gregtechceu.gtceu.api.mui.widgets.slot.ItemSlot;
import com.gregtechceu.gtceu.api.mui.widgets.slot.ModularSlot;
import com.gregtechceu.gtceu.api.recipe.gui.GTRecipeTypeUILayout;
Expand Down Expand Up @@ -111,6 +112,10 @@ public static ProgressWidget createProgressBar(IRecipeLogicMachine workableMachi
.progress(() -> workableMachine.getProgress() / (double) workableMachine.getMaxProgress());
}

public static FluidSlot createTankWidget() {
return new FluidSlot().size(20, 58).alwaysShowFull(false);
}

public static ItemSlot createBatterySlot(SimpleTieredMachine tieredMachine, PanelSyncManager syncManager) {
ItemSlotSH battery = new ItemSlotSH(new ModularSlot(tieredMachine.getChargerInventory(), 0));
syncManager.syncValue("battery", battery);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
package com.gregtechceu.gtceu.common.machine.multiblock.primitive;

import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.gui.GuiTextures;
import com.gregtechceu.gtceu.api.gui.UITemplate;
import com.gregtechceu.gtceu.api.gui.widget.SlotWidget;
import com.gregtechceu.gtceu.api.gui.widget.TankWidget;
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.api.machine.feature.IUIMachine;
import com.gregtechceu.gtceu.api.machine.feature.IMuiMachine;
import com.gregtechceu.gtceu.api.mui.base.ITheme;
import com.gregtechceu.gtceu.api.mui.drawable.UITexture;
import com.gregtechceu.gtceu.api.mui.factory.PosGuiData;
import com.gregtechceu.gtceu.api.mui.theme.ThemeAPI;
import com.gregtechceu.gtceu.api.mui.value.sync.FluidSlotSyncHandler;
import com.gregtechceu.gtceu.api.mui.value.sync.ItemSlotSH;
import com.gregtechceu.gtceu.api.mui.value.sync.PanelSyncManager;
import com.gregtechceu.gtceu.api.mui.widgets.ProgressWidget;
import com.gregtechceu.gtceu.api.mui.widgets.SlotGroupWidget;
import com.gregtechceu.gtceu.api.mui.widgets.slot.*;
import com.gregtechceu.gtceu.client.mui.screen.ModularPanel;
import com.gregtechceu.gtceu.client.mui.screen.UISettings;
import com.gregtechceu.gtceu.common.data.mui.GTMuiWidgets;
import com.gregtechceu.gtceu.common.mui.GTGuiTextures;
import com.gregtechceu.gtceu.config.ConfigHolder;

import com.lowdragmc.lowdraglib.gui.modular.ModularUI;
import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup;
import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture;
import com.lowdragmc.lowdraglib.gui.widget.LabelWidget;
import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget;

import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand All @@ -32,36 +36,74 @@

import javax.annotation.ParametersAreNonnullByDefault;

import static com.gregtechceu.gtceu.common.data.mui.GTMuiWidgets.createTankWidget;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class CokeOvenMachine extends PrimitiveWorkableMachine implements IUIMachine {
public class CokeOvenMachine extends PrimitiveWorkableMachine implements IMuiMachine {

public CokeOvenMachine(IMachineBlockEntity holder, Object... args) {
super(holder, args);
}

@Override
public ModularUI createUI(Player entityPlayer) {
return new ModularUI(176, 166, this, entityPlayer)
.background(GuiTextures.PRIMITIVE_BACKGROUND)
.widget(new LabelWidget(5, 5, getBlockState().getBlock().getDescriptionId()))
.widget(new SlotWidget(importItems.storage, 0, 52, 30, true, true)
.setBackgroundTexture(
new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)))
.widget(new ProgressWidget(recipeLogic::getProgressPercent, 76, 32, 20, 15,
GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR))
.widget(new SlotWidget(exportItems.storage, 0, 103, 30, true, false)
.setBackgroundTexture(
new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)))
.widget(new TankWidget(exportFluids.getStorages()[0], 134, 13, 20, 58, true, false)
.setBackground(GuiTextures.PRIMITIVE_LARGE_FLUID_TANK)
.setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP)
.setShowAmountOverlay(false)
.setOverlay(GuiTextures.PRIMITIVE_LARGE_FLUID_TANK_OVERLAY))
.widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.PRIMITIVE_SLOT, 7, 84,
true));
public ModularPanel buildUI(PosGuiData data, PanelSyncManager syncManager, UISettings settings) {
ITheme uiTheme = ThemeAPI.INSTANCE.getTheme(getDefinition().getThemeId());
return new ModularPanel(this.getDefinition().getName())
.size(176, 166)
// Top half of the screen
.child(new ItemSlot().syncHandler(new ItemSlotSH(
new ModularSlot(importItems.storage, 0)
.slotGroup(new SlotGroup("import_items", 1))))
.background(uiTheme.getItemSlotTheme().getTheme().getBackground(),
GTGuiTextures.PRIMITIVE_FURNACE_OVERLAY)
.margin(52, 0, 30, 0))

.child(new ItemSlot().syncHandler(new ItemSlotSH(
new ModularSlot(exportItems.storage, 0)
.slotGroup(new SlotGroup("export_items", 1))
.accessibility(false, true)))
.background(uiTheme.getItemSlotTheme().getTheme().getBackground(),
GTGuiTextures.PRIMITIVE_FURNACE_OVERLAY)
.margin(103, 0, 30, 0))
.child(new ProgressWidget().progress(recipeLogic::getProgressPercent).size(20, 15)
.texture(GTGuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, 18).margin(76, 32))

.child(createTankWidget()
.overlayTexture(GTGuiTextures.PRIMITIVE_LARGE_FLUID_TANK_OVERLAY)
.background(GTGuiTextures.PRIMITIVE_LARGE_FLUID_TANK)
.syncHandler(new FluidSlotSyncHandler(
exportFluids.getStorages()[0])
.canFillSlot(false))
.margin(134, 0, 13, 0))
.child(GTMuiWidgets.createTitleBar(getDefinition(), 176, (UITexture) uiTheme.getPanelTheme().getTheme()
.getBackground()))
.child(SlotGroupWidget.playerInventory(false).left(7).bottom(7));
}

/*
* @Override
* public ModularUI createUI(Player entityPlayer) {
* return new ModularUI(176, 166, this, entityPlayer)
* .background(GuiTextures.PRIMITIVE_BACKGROUND)
* .widget(new LabelWidget(5, 5, getBlockState().getBlock().getDescriptionId()))
* .widget(new SlotWidget(importItems.storage, 0, 52, 30, true, true)
* .setBackgroundTexture(
* new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)))
* .widget(new ProgressWidget(recipeLogic::getProgressPercent, 76, 32, 20, 15,
* GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR))
* .widget(new SlotWidget(exportItems.storage, 0, 103, 30, true, false)
* .setBackgroundTexture(
* new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)))
* .widget(new TankWidget(exportFluids.getStorages()[0], 134, 13, 20, 58, true, false)
* .setBackground(GuiTextures.PRIMITIVE_LARGE_FLUID_TANK)
* .setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP)
* .setShowAmountOverlay(false)
* .setOverlay(GuiTextures.PRIMITIVE_LARGE_FLUID_TANK_OVERLAY))
* .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.PRIMITIVE_SLOT, 7, 84,
* true));
* }
*/

@Override
public void animateTick(RandomSource random) {
if (this.isActive()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ public static class IDs {
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(
"textures/gui/primitive/overlay_primitive_dust.png", ColorType.DEFAULT);
public static final UITexture EXTRACTOR_OVERLAY = fullImage("textures/gui/overlay/extractor_overlay.png",
ColorType.DEFAULT);
public static final UITexture EXTRACTOR_OVERLAY_BRONZE = fullImage(
Expand All @@ -306,6 +308,15 @@ public static class IDs {
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(
"textures/gui/primitive/overlay_primitive_furnace.png",
ColorType.DEFAULT);
public static final 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(
"textures/gui/primitive/primitive_large_fluid_tank_overlay.png",
ColorType.DEFAULT);
public static final UITexture HAMMER_OVERLAY = fullImage("textures/gui/overlay/hammer_overlay.png",
ColorType.DEFAULT);
public static final UITexture HAMMER_OVERLAY_BRONZE = fullImage("textures/gui/overlay/hammer_overlay_bronze.png");
Expand All @@ -324,6 +335,9 @@ public static class IDs {
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",
ColorType.DEFAULT);
public static final 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",
ColorType.DEFAULT);
public static final UITexture LENS_OVERLAY = fullImage("textures/gui/overlay/lens_overlay.png", ColorType.DEFAULT);
Expand Down Expand Up @@ -429,6 +443,8 @@ public static class IDs {
// PROGRESS BARS
public static final 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(
"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",
ColorType.DEFAULT);
public static final UITexture PROGRESS_BAR_ARROW_BRONZE = progressBar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class GTGuiTheme {
public static final GTGuiTheme PRIMITIVE = templateBuilder("gregtech_primitive")
.panel(GTGuiTextures.IDs.PRIMITIVE_BACKGROUND)
.itemSlot(GTGuiTextures.IDs.PRIMITIVE_SLOT)
.fluidSlot(GTGuiTextures.IDs.PRIMITIVE_SLOT)
.build();

private final String themeId;
Expand Down