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 @@ -129,6 +130,7 @@ public class GTMultiMachines {
.or(Predicates.custom(bws -> GTUtil.isBlockSnow(bws.getBlockState()), null)))
.where('Y', Predicates.controller(blocks(definition.getBlock())))
.build())
.themeId((i) -> GTGuiTheme.PRIMITIVE.getId())
.register();

public static final MultiblockMachineDefinition ELECTRIC_BLAST_FURNACE = REGISTRATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,39 @@
import com.gregtechceu.gtceu.api.blockentity.BlockEntityCreationInfo;
import com.gregtechceu.gtceu.api.capability.recipe.IO;
import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability;
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.machine.TickableSubscription;
import com.gregtechceu.gtceu.api.machine.feature.IUIMachine;
import com.gregtechceu.gtceu.api.machine.feature.IMuiMachine;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IFluidRenderMulti;
import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler;
import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic;
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.ItemSlotSyncHandler;
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.ItemSlot;
import com.gregtechceu.gtceu.api.mui.widgets.slot.ModularSlot;
import com.gregtechceu.gtceu.api.mui.widgets.slot.SlotGroup;
import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection;
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.gregtechceu.gtceu.syncsystem.annotations.RerenderOnChanged;
import com.gregtechceu.gtceu.syncsystem.annotations.SyncToClient;
import com.gregtechceu.gtceu.utils.GTUtil;

import com.lowdragmc.lowdraglib.gui.modular.ModularUI;
import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup;
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;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.api.distmarker.Dist;
Expand All @@ -39,6 +45,7 @@
import lombok.Getter;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
Expand All @@ -47,7 +54,7 @@

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class PrimitiveBlastFurnaceMachine extends PrimitiveWorkableMachine implements IUIMachine, IFluidRenderMulti {
public class PrimitiveBlastFurnaceMachine extends PrimitiveWorkableMachine implements IMuiMachine, IFluidRenderMulti {

private TickableSubscription hurtSubscription;

Expand Down Expand Up @@ -146,32 +153,65 @@ public void clientTick() {
}

@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, 20, true, true)
.setBackgroundTexture(
new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_INGOT_OVERLAY)))
.widget(new SlotWidget(importItems.storage, 1, 52, 38, true, true)
.setBackgroundTexture(
new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY)))
.widget(new SlotWidget(importItems.storage, 2, 52, 56, true, true)
.setBackgroundTexture(
new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY)))
.widget(new ProgressWidget(recipeLogic::getProgressPercent, 77, 39, 20, 15,
GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR))
.widget(new SlotWidget(exportItems.storage, 0, 104, 38, true, false)
.setBackgroundTexture(
new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_INGOT_OVERLAY)))
.widget(new SlotWidget(exportItems.storage, 1, 122, 38, true, false)
.setBackgroundTexture(
new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY)))
.widget(new SlotWidget(exportItems.storage, 2, 140, 38, true, false)
.setBackgroundTexture(
new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY)))
.widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(),
GuiTextures.PRIMITIVE_SLOT, 7, 84, true));
public ModularPanel buildUI(PosGuiData data, PanelSyncManager syncManager, UISettings settings) {
ITheme theme = ThemeAPI.INSTANCE.getTheme(getDefinition().getThemeId());
return new ModularPanel(this.getDefinition().getName())
.size(176, 166)
// Top half of the screen
.child(createImportItemSlot(syncManager, theme).margin(52, 16))
.child(new ProgressWidget().progress(recipeLogic::getProgressPercent).size(20, 15)
.texture(GTGuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, 0).margin(77, 35))
.child(createExportItemSlot(syncManager, theme).margin(104, 0, 34, 0))

.child(GTMuiWidgets.createTitleBar(getDefinition(), 176, (UITexture) theme.getPanelTheme().getTheme()
.getBackground()))
.child(SlotGroupWidget
.playerInventory(false).left(7)
.bottom(7));
}

private SlotGroupWidget createImportItemSlot(PanelSyncManager syncManager, ITheme theme) {
int size = importItems.storage.getSlots();
SlotGroup slotGroup = new SlotGroup("import", size);
String[] matrix = new String[size];
char key = 'I';
Arrays.fill(matrix, String.valueOf(key));
return SlotGroupWidget.builder()
.matrix(matrix)
.key(key, i -> {
ModularSlot slot = new ModularSlot(importItems.storage, i);
ItemSlotSyncHandler syncHandler = new ItemSlotSyncHandler(slot.slotGroup(slotGroup));
syncManager.syncValue("import", i, syncHandler);
return new ItemSlot()
.syncHandler("import", i)
.background(theme.getItemSlotTheme().getTheme().getBackground(),
(i == 0) ? GTGuiTextures.PRIMITIVE_INGOT_OVERLAY : (i == 1) ?
GTGuiTextures.PRIMITIVE_DUST_OVERLAY :
GTGuiTextures.PRIMITIVE_FURNACE_OVERLAY);
})
.build();
}

private SlotGroupWidget createExportItemSlot(PanelSyncManager syncManager, ITheme theme) {
int size = exportItems.storage.getSlots();
SlotGroup slotGroup = new SlotGroup("export", size);
String[] matrix = new String[1];
char key = 'I';
matrix[0] = String.valueOf(key).repeat(size);
return SlotGroupWidget.builder()
.matrix(matrix)
.key(key, i -> {
ModularSlot slot = new ModularSlot(exportItems.storage, i);
slot.accessibility(false, true);
ItemSlotSyncHandler syncHandler = new ItemSlotSyncHandler(slot.slotGroup(slotGroup));
syncManager.syncValue("export", i, syncHandler);
return new ItemSlot()
.syncHandler("export", i)
.background(theme.getItemSlotTheme().getTheme().getBackground(),
(i == 0) ? GTGuiTextures.PRIMITIVE_INGOT_OVERLAY :
GTGuiTextures.PRIMITIVE_DUST_OVERLAY);
})
.build();
}

@Override
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,9 @@ 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 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 +329,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 +437,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
Loading