Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose ME hatch additionalConnections for MM #3829

Merged
merged 3 commits into from
Jan 20, 2025
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
13 changes: 13 additions & 0 deletions src/main/java/gregtech/api/interfaces/IMEConnectable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gregtech.api.interfaces;

/**
* A hatch that has a connection to an ME cable.
* Used by the matter manipulator to copy this setting.
*/
public interface IMEConnectable {

/** If this hatch can accept connects on the side, or just the front. */
boolean connectsToAllSides();

void setConnectsToAllSides(boolean connects);
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.IConfigurationCircuitSupport;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IAddGregtechLogo;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
Expand All @@ -104,7 +105,7 @@

public class MTEHatchCraftingInputME extends MTEHatchInputBus
implements IConfigurationCircuitSupport, IAddGregtechLogo, IAddUIWidgets, IPowerChannelState, ICraftingProvider,
IGridProxyable, IDualInputHatch, ICustomNameObject, IInterfaceViewable {
IGridProxyable, IDualInputHatch, ICustomNameObject, IInterfaceViewable, IMEConnectable {

// Each pattern slot in the crafting input hatch has its own internal inventory
public static class PatternSlot implements IDualInputInventory {
Expand Down Expand Up @@ -477,6 +478,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.IConfigurationCircuitSupport;
import gregtech.api.interfaces.IDataCopyable;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IAddGregtechLogo;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
Expand All @@ -79,8 +80,9 @@
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;

public class MTEHatchInputBusME extends MTEHatchInputBus implements IConfigurationCircuitSupport,
IRecipeProcessingAwareHatch, IAddGregtechLogo, IAddUIWidgets, IPowerChannelState, ISmartInputHatch, IDataCopyable {
public class MTEHatchInputBusME extends MTEHatchInputBus
implements IConfigurationCircuitSupport, IRecipeProcessingAwareHatch, IAddGregtechLogo, IAddUIWidgets,
IPowerChannelState, ISmartInputHatch, IDataCopyable, IMEConnectable {

protected static final int SLOT_COUNT = 16;
public static final String COPIED_DATA_IDENTIFIER = "stockingBus";
Expand Down Expand Up @@ -179,6 +181,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.IDataCopyable;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IAddGregtechLogo;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
Expand All @@ -83,7 +84,7 @@
import mcp.mobius.waila.api.IWailaDataAccessor;

public class MTEHatchInputME extends MTEHatchInput implements IPowerChannelState, IAddGregtechLogo, IAddUIWidgets,
IRecipeProcessingAwareHatch, ISmartInputHatch, IDataCopyable {
IRecipeProcessingAwareHatch, ISmartInputHatch, IDataCopyable, IMEConnectable {

private static final int SLOT_COUNT = 16;
public static final String COPIED_DATA_IDENTIFIER = "stockingHatch";
Expand Down Expand Up @@ -333,6 +334,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import gregtech.GTMod;
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GTUIInfos;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
Expand All @@ -58,7 +59,7 @@
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;

public class MTEHatchOutputBusME extends MTEHatchOutputBus implements IPowerChannelState {
public class MTEHatchOutputBusME extends MTEHatchOutputBus implements IPowerChannelState, IMEConnectable {

protected static final long DEFAULT_CAPACITY = 1_600;
protected long baseCapacity = DEFAULT_CAPACITY;
Expand Down Expand Up @@ -203,6 +204,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import gregtech.api.enums.GTValues;
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GTUIInfos;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
Expand All @@ -65,7 +66,7 @@
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;

public class MTEHatchOutputME extends MTEHatchOutput implements IPowerChannelState {
public class MTEHatchOutputME extends MTEHatchOutput implements IPowerChannelState, IMEConnectable {

private static final long DEFAULT_CAPACITY = 128_000;
private long baseCapacity = DEFAULT_CAPACITY;
Expand Down Expand Up @@ -236,6 +237,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down
Loading