mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 13:10:13 +00:00
Holy mother of god, connections are finally working.
This commit is contained in:
1 parent
8e933c1db3
commit
488b504e8f
4 files changed
+59
-32
No files matched your search
@@ -11,7 +11,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
import cofh.api.transport.IItemDuct;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
@@ -23,7 +23,7 @@ import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
@Interface(iface = "appeng.me.helpers.IGridProxyable", modid = "appliedenergistics2")
|
||||
public interface IConduitBundle extends IInternalPowerReceptor, IFluidHandler, IItemDuct, IGasHandler, IGridProxyable {
|
||||
public interface IConduitBundle extends IInternalPowerReceptor, IFluidHandler, IItemDuct, IGasHandler, IGridHost {
|
||||
|
||||
TileEntity getEntity();
|
||||
|
||||
|
||||
@@ -888,26 +888,4 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
public void securityBreak() {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "appliedenergistics2")
|
||||
public DimensionalCoord getLocation() {
|
||||
return new DimensionalCoord(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "appliedenergistics2")
|
||||
public AENetworkProxy getProxy() {
|
||||
IMEConduit cond = getConduit(IMEConduit.class);
|
||||
if (cond != null) {
|
||||
return cond.getGrid();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "appliedenergistics2")
|
||||
public void gridChanged() {
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -140,11 +140,6 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
public ConnectionMode getNextConnectionMode(ForgeDirection dir) {
|
||||
ConnectionMode mode = getConnectionMode(dir);
|
||||
mode = mode == ConnectionMode.IN_OUT ? ConnectionMode.DISABLED : ConnectionMode.IN_OUT;
|
||||
if (mode == ConnectionMode.DISABLED) {
|
||||
validConnections.remove(dir);
|
||||
} else {
|
||||
validConnections.add(dir);
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
@@ -154,6 +149,17 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
return mode == null ? validConnections.contains(dir) ? ConnectionMode.IN_OUT : ConnectionMode.DISABLED : mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConnectionMode(ForgeDirection dir, ConnectionMode mode) {
|
||||
super.setConnectionMode(dir, mode);
|
||||
if (mode == ConnectionMode.DISABLED) {
|
||||
validConnections.remove(dir);
|
||||
} else {
|
||||
validConnections.add(dir);
|
||||
}
|
||||
getNode().updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "appliedenergistics2")
|
||||
protected void connectionsChanged() {
|
||||
|
||||
@@ -4,15 +4,20 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.GridNotification;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
|
||||
public class MEConduitGrid extends AENetworkProxy {
|
||||
public class MEConduitGrid implements IGridBlock {
|
||||
|
||||
private IMEConduit conduit;
|
||||
|
||||
public MEConduitGrid(IMEConduit conduit) {
|
||||
super(conduit.getBundle(), "EnderIO:conduit", conduit.createItem(), true);
|
||||
this.conduit = conduit;
|
||||
}
|
||||
|
||||
@@ -35,4 +40,42 @@ public class MEConduitGrid extends AENetworkProxy {
|
||||
public ItemStack getMachineRepresentation() {
|
||||
return conduit.createItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<GridFlags> getFlags() {
|
||||
return EnumSet.noneOf(GridFlags.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWorldAccessable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DimensionalCoord getLocation() {
|
||||
return new DimensionalCoord(conduit.getBundle().getEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGridNotification(GridNotification notification) {
|
||||
gridChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetworkStatus(IGrid grid, int channelsInUse) {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridHost getMachine() {
|
||||
return conduit.getBundle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gridChanged() {
|
||||
IGridNode node = conduit.getBundle().getGridNode(null);
|
||||
if(node != null) {
|
||||
node.updateState();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user