Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e14c92a
refactor AE2 grid node machine trait
gateguardian523 Mar 24, 2026
d5bf0be
refactor base classes for me part machine
gateguardian523 Mar 24, 2026
57290b3
refactor ME input bus/hatch machines
gateguardian523 Mar 24, 2026
25d229f
remove export-only AE2 slot classes
gateguardian523 Mar 24, 2026
1bcb42f
remove AE2 multiblock part interfaces
gateguardian523 Mar 24, 2026
c029a38
refactor ME stocking bus/hatch machines
gateguardian523 Mar 24, 2026
991fa1b
refactor ME part machine subscription logic
gateguardian523 Mar 25, 2026
d90b9c6
refactor ME data stick config handling
gateguardian523 Mar 25, 2026
dc35c24
fixed ME part machine constructors
gateguardian523 Mar 25, 2026
3e5af28
refactor stocking fancy configurator to generic class
gateguardian523 Mar 25, 2026
7cdae29
reorganize packages
gateguardian523 Mar 25, 2026
ba1f5b6
refactor ME stocking bus/hatch config handling
gateguardian523 Mar 26, 2026
0657500
optimize stocking config handler autoPull
gateguardian523 Mar 26, 2026
23f1ccf
fix stocking config handler slot padding
gateguardian523 Mar 27, 2026
18ba9fb
adjust ME part autoIO update checks
gateguardian523 Mar 27, 2026
d622cce
refactor ME part sync tick logic
gateguardian523 Mar 27, 2026
4ca8a33
refactor ME output bus/hatch to use KeyStorageBaked
gateguardian523 Mar 27, 2026
e11aa1b
fix typo
gateguardian523 Mar 27, 2026
af2acd9
refactor AEKeyStorage transfer logic to AEUtil
gateguardian523 Mar 27, 2026
5872dee
clear circuit inventory when ghost circuit disabled
gateguardian523 Mar 27, 2026
ac9282f
inline GridNodeHost listener
gateguardian523 Mar 27, 2026
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.gregtechceu.gtceu.api.machine.feature;

import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;

public interface IDataStickConfigurable extends IMachineFeature, IDataStickInteractable {

@Override
default InteractionResult onDataStickShiftUse(Player player, ItemStack dataStick) {
if (!self().isRemote()) {
CompoundTag root = dataStick.getOrCreateTag();
CompoundTag config = new CompoundTag();
writeConfig(config);
root.put(getConfigKey(), config);
dataStick.setHoverName(getConfigName());
player.sendSystemMessage(Component.translatable("gtceu.machine.me.import_copy_settings"));
}
return InteractionResult.SUCCESS;
}

@Override
default InteractionResult onDataStickUse(Player player, ItemStack dataStick) {
String tagKey = getConfigKey();
CompoundTag root = dataStick.getTag();
if (root == null || !root.contains(tagKey)) {
return InteractionResult.PASS;
}
if (!self().isRemote()) {
readConfig(root.getCompound(tagKey));
player.sendSystemMessage(Component.translatable("gtceu.machine.me.import_paste_settings"));
}
return InteractionResult.sidedSuccess(self().isRemote());
}

default String getConfigKey() {
return getClass().getSimpleName();
}

default Component getConfigName() {
return Component.literal(getConfigKey());
}

void writeConfig(CompoundTag tag);

void readConfig(CompoundTag tag);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class GTAEMachines {

public final static MachineDefinition ITEM_IMPORT_BUS_ME = REGISTRATE
.machine("me_input_bus", MEInputBusPartMachine::new)
.machine("me_input_bus", be -> new MEInputBusPartMachine(be, EV, 16))
.langValue("ME Input Bus")
.tier(EV)
.rotationState(RotationState.ALL)
Expand All @@ -30,7 +30,7 @@ public class GTAEMachines {
.register();

public final static MachineDefinition STOCKING_IMPORT_BUS_ME = REGISTRATE
.machine("me_stocking_input_bus", MEStockingBusPartMachine::new)
.machine("me_stocking_input_bus", be -> new MEStockingBusPartMachine(be, LuV, 16))
.langValue("ME Stocking Input Bus")
.tier(LuV)
.rotationState(RotationState.ALL)
Expand All @@ -46,7 +46,7 @@ public class GTAEMachines {
.register();

public final static MachineDefinition ITEM_EXPORT_BUS_ME = REGISTRATE
.machine("me_output_bus", MEOutputBusPartMachine::new)
.machine("me_output_bus", be -> new MEOutputBusPartMachine(be, EV))
.langValue("ME Output Bus")
.tier(EV)
.rotationState(RotationState.ALL)
Expand All @@ -60,7 +60,7 @@ public class GTAEMachines {
.register();

public final static MachineDefinition FLUID_IMPORT_HATCH_ME = REGISTRATE
.machine("me_input_hatch", MEInputHatchPartMachine::new)
.machine("me_input_hatch", be -> new MEInputHatchPartMachine(be, EV, 16))
.langValue("ME Input Hatch")
.tier(EV)
.rotationState(RotationState.ALL)
Expand All @@ -74,7 +74,7 @@ public class GTAEMachines {
.register();

public final static MachineDefinition STOCKING_IMPORT_HATCH_ME = REGISTRATE
.machine("me_stocking_input_hatch", MEStockingHatchPartMachine::new)
.machine("me_stocking_input_hatch", be -> new MEStockingHatchPartMachine(be, LuV, 16))
.langValue("ME Stocking Input Hatch")
.tier(LuV)
.rotationState(RotationState.ALL)
Expand All @@ -90,7 +90,7 @@ public class GTAEMachines {
.register();

public final static MachineDefinition FLUID_EXPORT_HATCH_ME = REGISTRATE
.machine("me_output_hatch", MEOutputHatchPartMachine::new)
.machine("me_output_hatch", be -> new MEOutputHatchPartMachine(be, EV))
.langValue("ME Output Hatch")
.tier(EV)
.rotationState(RotationState.ALL)
Expand Down Expand Up @@ -118,7 +118,7 @@ public class GTAEMachines {
Component.translatable("gtceu.part_sharing.enabled"))
.register();
public static final MachineDefinition ME_PATTERN_BUFFER_PROXY = REGISTRATE
.machine("me_pattern_buffer_proxy", MEPatternBufferProxyPartMachine::new)
.machine("me_pattern_buffer_proxy", MEPatternProxyPartMachine::new)
.tier(LuV)
.rotationState(RotationState.ALL)
.abilities(PartAbility.IMPORT_ITEMS, PartAbility.IMPORT_FLUIDS, PartAbility.EXPORT_FLUIDS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine;
import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine;
import com.gregtechceu.gtceu.api.machine.trait.MachineTrait;
import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer;
import com.gregtechceu.gtceu.integration.ae2.machine.trait.GridNodeHostTrait;
import com.gregtechceu.gtceu.integration.ae2.machine.trait.GridNodeHost;

import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture;
import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted;
import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder;

import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.TickTask;
import net.minecraft.server.level.ServerLevel;

import appeng.me.helpers.IGridConnectedBlockEntity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.annotation.ParametersAreNonnullByDefault;

Expand All @@ -32,14 +28,14 @@ public class HullMachine extends TieredPartMachine implements IMonitorComponent
protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(HullMachine.class,
MultiblockPartMachine.MANAGED_FIELD_HOLDER);

private final Object gridNodeHost;
private final @Nullable MachineTrait gridNodeHost;
@Persisted
protected NotifiableEnergyContainer energyContainer;

public HullMachine(IMachineBlockEntity holder, int tier) {
super(holder, tier);
if (GTCEu.Mods.isAE2Loaded()) {
this.gridNodeHost = new GridNodeHostTrait(this);
this.gridNodeHost = new GridNodeHost(this);
} else {
this.gridNodeHost = null;
}
Expand All @@ -52,56 +48,11 @@ protected void reinitializeEnergyContainer() {
this.energyContainer.setSideOutputCondition(s -> s == getFrontFacing());
}

@Override
public void onLoad() {
super.onLoad();
if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity &&
getLevel() instanceof ServerLevel level) {
level.getServer().tell(new TickTask(0, connectedBlockEntity::init));
}
}

@Override
public void onUnload() {
super.onUnload();
if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity) {
connectedBlockEntity.getMainNode().destroy();
}
}

@Override
public void setFrontFacing(Direction facing) {
super.setFrontFacing(facing);
if (isFacingValid(facing)) {
if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity) {
connectedBlockEntity.init();
}
}
}

@Override
public ManagedFieldHolder getFieldHolder() {
return MANAGED_FIELD_HOLDER;
}

@Override
public void saveCustomPersistedData(@NotNull CompoundTag tag, boolean forDrop) {
super.saveCustomPersistedData(tag, forDrop);
if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof IGridConnectedBlockEntity connectedBlockEntity) {
CompoundTag nbt = new CompoundTag();
connectedBlockEntity.getMainNode().saveToNBT(nbt);
tag.put("grid_node", nbt);
}
}

@Override
public void loadCustomPersistedData(@NotNull CompoundTag tag) {
super.loadCustomPersistedData(tag);
if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof IGridConnectedBlockEntity connectedBlockEntity) {
connectedBlockEntity.getMainNode().loadFromNBT(tag.getCompound("grid_node"));
}
}

//////////////////////////////////////
// ********** Misc **********//
//////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,10 +810,6 @@ protected static void init(RegistrateLangProvider provider) {
"Minimum Item Stack Size for Automated Pulling");
provider.add("gtceu.gui.adv_stocking_config.min_fluid_count",
"Minimum Fluid Stack Size for Automated Pulling");
provider.add("gtceu.gui.title.adv_stocking_config.ticks_per_cycle",
"Ticks Per Cycle");
provider.add("gtceu.gui.adv_stocking_config.ticks_per_cycle",
"Delay between item list updates");
provider.add("gtceu.gui.adv_stocking_config.title",
"Configure Automatic Stocking");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.gregtechceu.gtceu.integration.ae2.gui;

import com.gregtechceu.gtceu.integration.ae2.gui.slot.AEFluidConfigSlotWidget;
import com.gregtechceu.gtceu.integration.ae2.slot.ConfigurableFluidList;
import com.gregtechceu.gtceu.integration.ae2.slot.ConfigurableFluidSlot;
import com.gregtechceu.gtceu.integration.ae2.slot.ConfigurableSlot;

import appeng.api.stacks.GenericStack;

public class AEFluidConfigWidget extends ConfigWidget {

private final ConfigurableFluidList fluidList;

public AEFluidConfigWidget(int x, int y, ConfigurableFluidList list) {
super(x, y, list.getInventory(), list.isStocking());
this.fluidList = list;
}

@Override
void init() {
int line;
this.displayList = new ConfigurableSlot[this.config.length];
this.cached = new ConfigurableSlot[this.config.length];
for (int index = 0; index < this.config.length; index++) {
this.displayList[index] = new ConfigurableFluidSlot();
this.cached[index] = new ConfigurableFluidSlot();
line = index / 8;
this.addWidget(new AEFluidConfigSlotWidget((index - line * 8) * 18, line * (18 * 2 + 2), this, index));
}
}

public boolean hasStackInConfig(GenericStack stack) {
return fluidList.isStackConfigured(stack, true);
}

public boolean isAutoPull() {
return fluidList.isAutoPull();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.gregtechceu.gtceu.integration.ae2.gui;

import com.gregtechceu.gtceu.integration.ae2.gui.slot.AEItemConfigSlotWidget;
import com.gregtechceu.gtceu.integration.ae2.slot.ConfigurableItemList;
import com.gregtechceu.gtceu.integration.ae2.slot.ConfigurableItemSlot;
import com.gregtechceu.gtceu.integration.ae2.slot.ConfigurableSlot;

import appeng.api.stacks.GenericStack;

public class AEItemConfigWidget extends ConfigWidget {

private static final int SLOTS_PER_ROW = 8;
private static final int SLOT_SIZE = 18;
private static final int ROW_SPACING = 2;

private final ConfigurableItemList itemList;

public AEItemConfigWidget(int x, int y, ConfigurableItemList list) {
super(x, y, list.getInventory(), list.isStocking());
this.itemList = list;
}

@Override
void init() {
int line;
this.displayList = new ConfigurableSlot[this.config.length];
this.cached = new ConfigurableSlot[this.config.length];
for (int index = 0; index < this.config.length; index++) {
this.displayList[index] = new ConfigurableItemSlot();
this.cached[index] = new ConfigurableItemSlot();
line = index / SLOTS_PER_ROW;
this.addWidget(new AEItemConfigSlotWidget((index - line * SLOTS_PER_ROW) * SLOT_SIZE,
line * (SLOT_SIZE * 2 + ROW_SPACING), this, index));
}
}

public boolean hasStackInConfig(GenericStack stack) {
return itemList.isStackConfigured(stack, true);
}

public boolean isAutoPull() {
return itemList.isAutoPull();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gregtechceu.gtceu.integration.ae2.gui.widget;
package com.gregtechceu.gtceu.integration.ae2.gui;

import com.gregtechceu.gtceu.api.gui.GuiTextures;
import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.gregtechceu.gtceu.integration.ae2.gui.widget;
package com.gregtechceu.gtceu.integration.ae2.gui;

import com.gregtechceu.gtceu.api.gui.GuiTextures;
import com.gregtechceu.gtceu.integration.ae2.slot.IConfigurableSlot;
import com.gregtechceu.gtceu.integration.ae2.slot.ConfigurableSlot;

import com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget;
import com.lowdragmc.lowdraglib.gui.widget.Widget;
Expand Down Expand Up @@ -47,7 +47,7 @@ public String getAmountStr() {
if (this.index < 0) {
return "0";
}
IConfigurableSlot slot = this.parentWidget.getConfig(this.index);
ConfigurableSlot slot = this.parentWidget.getConfig(this.index);
if (slot.getConfig() != null) {
return String.valueOf(slot.getConfig().amount());
}
Expand All @@ -60,7 +60,7 @@ public void setNewAmount(String amount) {
if (this.index < 0) {
return;
}
IConfigurableSlot slot = this.parentWidget.getConfig(this.index);
ConfigurableSlot slot = this.parentWidget.getConfig(this.index);
if (newAmount > 0 && slot.getConfig() != null) {
slot.setConfig(new GenericStack(slot.getConfig().what(), newAmount));
}
Expand Down
Loading