Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
qwer523 committed Jun 2, 2024
1 parent 3ca5f77 commit 2889b46
Show file tree
Hide file tree
Showing 13 changed files with 1,077 additions and 428 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod_authors= YourNameHere, OtherNameHere
mod_description = Example mod description.\nNewline characters can be used and will be replaced properly.
mod_license = AGPL-3.0
mod_url = https://github.com/
mod_version = 1.0.2
mod_version = 1.0.4

maven_group = com.epimorphismmc.gregiceng

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.epimorphismmc.gregiceng.api.gui.wight;

import com.gregtechceu.gtceu.api.gui.GuiTextures;
import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget;
import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup;
import com.lowdragmc.lowdraglib.gui.texture.TextTexture;
import com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget;
import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup;
import com.lowdragmc.lowdraglib.utils.Position;
import com.lowdragmc.lowdraglib.utils.Size;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.function.Consumer;

public class TextInputButtonWidget extends WidgetGroup {

@Setter
@Accessors(chain = true)
private Consumer<String> onConfirm;
@Setter
@Accessors(chain = true)
@Getter
private String text = "";
@Getter
private boolean isInputting;
private TextFieldWidget textField;

public TextInputButtonWidget() {
}

public TextInputButtonWidget(int x, int y, int width, int height) {
super(x, y, width, height);
}

public TextInputButtonWidget(Position position) {
super(position);
}

public TextInputButtonWidget(Position position, Size size) {
super(position, size);
}

@Override
public void initWidget() {
super.initWidget();
this.addWidget(new ToggleButtonWidget(getSizeWidth() - getSizeHeight(), 0,
getSizeHeight(), getSizeHeight(),
this::isInputting, pressed -> {
isInputting = pressed;
if (pressed) {
this.textField = new TextFieldWidget(0, 0, getSizeWidth() - getSizeHeight() - 2, getSizeHeight(), this::getText, this::setText);
this.addWidget(textField);
} else {
onConfirm.accept(text);
this.removeWidget(textField);
}
}).setTexture(
new GuiTextureGroup(GuiTextures.VANILLA_BUTTON, new TextTexture("✎")),
new GuiTextureGroup(GuiTextures.VANILLA_BUTTON, new TextTexture("✎"))
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.epimorphismmc.gregiceng.common.machine.multiblock.part.BufferPartMachine;
import com.epimorphismmc.gregiceng.common.machine.multiblock.part.CraftingIOBufferPartMachine;
import com.epimorphismmc.gregiceng.common.machine.multiblock.part.CraftingIOSlavePartMachine;
import com.gregtechceu.gtceu.api.capability.recipe.IO;
import com.gregtechceu.gtceu.api.data.RotationState;
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
Expand Down Expand Up @@ -33,6 +34,14 @@ public class GEMachines {
.tooltips(Component.translatable("block.gregiceng.crafting_io_buffer.desc.0"))
.register();

public final static MachineDefinition CRAFTING_IO_SLAVE = registrate().machine("crafting_io_slave", CraftingIOSlavePartMachine::new)
.tier(LuV)
.rotationState(RotationState.ALL)
.abilities(PartAbility.IMPORT_ITEMS, PartAbility.IMPORT_FLUIDS, PartAbility.EXPORT_ITEMS, PartAbility.EXPORT_FLUIDS)
.overlayTieredHullRenderer("crafting_io_slave")
.tooltips(Component.translatable("block.gregiceng.crafting_io_slave.desc.0"))
.register();

public static final MachineDefinition[] INPUT_BUFFER = registerTieredGEMachines("input_buffer",
(holder, tier) -> new BufferPartMachine(holder, tier, IO.IN),
(tier, builder) -> builder
Expand Down
Loading

0 comments on commit 2889b46

Please sign in to comment.