From c02999350027530805bd61720a465afad2bb22ad Mon Sep 17 00:00:00 2001 From: Calclavia Date: Sat, 8 Mar 2014 00:40:02 -0800 Subject: [PATCH] Unfinished errored work on nodes --- .../mechanical/MultipartMechanical.java | 3 +- .../network/IMechanicalNodeProvider.java | 2 +- .../energy/network/TileMechanical.java | 3 +- .../mechanical/fluid/pipe/PartPipe.java | 151 +++++----- .../mechanical/fluid/transport/TilePump.java | 55 ++-- .../api/mechanical/fluid/IPressure.java | 10 - .../core/fluid/IPressurizedNode.java | 27 -- .../core/fluid/PressureNetwork.java | 206 ------------- .../core/grid/INodeProvider.java | 16 +- .../resonantinduction/core/grid/Node.java | 5 + .../grid/fluid/IPressureNodeProvider.java | 2 +- .../core/grid/fluid/PressureNode.java | 7 +- .../core/prefab/part/PartFramedNode.java | 280 ++++++++++++++++++ 13 files changed, 415 insertions(+), 352 deletions(-) delete mode 100644 src/main/java/resonantinduction/api/mechanical/fluid/IPressure.java delete mode 100644 src/main/java/resonantinduction/core/fluid/IPressurizedNode.java delete mode 100644 src/main/java/resonantinduction/core/fluid/PressureNetwork.java create mode 100644 src/main/java/resonantinduction/core/prefab/part/PartFramedNode.java diff --git a/mechanical/src/main/java/resonantinduction/mechanical/MultipartMechanical.java b/mechanical/src/main/java/resonantinduction/mechanical/MultipartMechanical.java index 20e07ee4..99160c49 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/MultipartMechanical.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/MultipartMechanical.java @@ -17,8 +17,7 @@ public class MultipartMechanical implements IPartFactory public MultipartMechanical() { MultiPartRegistry.registerParts(this, PART_TYPES); - MultipartGenerator.registerPassThroughInterface("resonantinduction.core.fluid.IPressurizedNode"); - MultipartGenerator.registerPassThroughInterface("resonantinduction.api.mechanical.fluid.IPressure"); + MultipartGenerator.registerPassThroughInterface("resonantinduction.core.grid.fluid.IPressureNodeProvider"); MultipartGenerator.registerTrait("resonantinduction.mechanical.energy.network.IMechanicalNodeProvider", "resonantinduction.mechanical.trait.TraitMechanical"); } diff --git a/mechanical/src/main/java/resonantinduction/mechanical/energy/network/IMechanicalNodeProvider.java b/mechanical/src/main/java/resonantinduction/mechanical/energy/network/IMechanicalNodeProvider.java index 321e786f..ff4894cf 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/energy/network/IMechanicalNodeProvider.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/energy/network/IMechanicalNodeProvider.java @@ -2,7 +2,7 @@ package resonantinduction.mechanical.energy.network; import resonantinduction.core.grid.INodeProvider; -public interface IMechanicalNodeProvider extends INodeProvider +public interface IMechanicalNodeProvider extends INodeProvider { } diff --git a/mechanical/src/main/java/resonantinduction/mechanical/energy/network/TileMechanical.java b/mechanical/src/main/java/resonantinduction/mechanical/energy/network/TileMechanical.java index 38bd95d7..b69a4e26 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/energy/network/TileMechanical.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/energy/network/TileMechanical.java @@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.ForgeDirection; import resonantinduction.core.ResonantInduction; +import resonantinduction.core.grid.Node; import resonantinduction.mechanical.Mechanical; import universalelectricity.api.vector.Vector3; import calclavia.lib.network.IPacketReceiver; @@ -68,7 +69,7 @@ public abstract class TileMechanical extends TileAdvanced implements IMechanical } @Override - public MechanicalNode getNode(ForgeDirection dir) + public MechanicalNode getNode(Class clazz, ForgeDirection dir) { return mechanicalNode; } diff --git a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java index a2001ba2..45c41e4c 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java @@ -1,5 +1,6 @@ package resonantinduction.mechanical.fluid.pipe; +import calclavia.lib.utility.WorldUtility; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -12,9 +13,9 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; import resonantinduction.core.ResonantInduction; -import resonantinduction.core.fluid.IPressurizedNode; -import resonantinduction.core.fluid.PressureNetwork; -import resonantinduction.core.prefab.part.PartFramedConnection; +import resonantinduction.core.grid.fluid.IPressureNodeProvider; +import resonantinduction.core.grid.fluid.PressureNode; +import resonantinduction.core.prefab.part.PartFramedNode; import resonantinduction.mechanical.Mechanical; import codechicken.lib.data.MCDataInput; import codechicken.lib.render.CCRenderState; @@ -28,10 +29,9 @@ import codechicken.multipart.TileMultipart; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class PartPipe extends PartFramedConnection implements IPressurizedNode, TSlottedPart, JNormalOcclusion, IHollowConnect +public class PartPipe extends PartFramedNode implements IPressureNodeProvider, TSlottedPart, JNormalOcclusion, IHollowConnect { protected FluidTank tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME); - private int pressure; private boolean markPacket = true; public PartPipe(int typeID) @@ -39,6 +39,76 @@ public class PartPipe extends PartFramedConnection 0) + { + if (dir == getDirection()) + { + return (int) Math.max((((double) mechanicalNode.getPower() / (double) maximumPower) * 100), 2); + } + else if (dir == getDirection().getOpposite()) + { + return (int) -Math.max((((double) mechanicalNode.getPower() / (double) maximumPower) * 100), 2); + } + } + + return 0; + } + } + } @Override public void updateEntity() @@ -28,7 +54,7 @@ public class TilePump extends TileMechanical implements IFluidHandler, IRotatabl */ TileEntity tileIn = new Vector3(this).translate(getDirection().getOpposite()).getTileEntity(this.worldObj); - if (tileIn instanceof IFluidHandler && !(tileIn instanceof IPressurizedNode)) + if (tileIn instanceof IFluidHandler && !(tileIn instanceof IPressureNodeProvider)) { int flowRate = (int) (((double) mechanicalNode.getPower() / (double) maximumPower) * 500); FluidStack drain = ((IFluidHandler) tileIn).drain(getDirection(), flowRate, false); @@ -98,26 +124,9 @@ public class TilePump extends TileMechanical implements IFluidHandler, IRotatabl } @Override - public void setPressure(int amount) + public FluidTank getPressureTank() { - } - - @Override - public int getPressure(ForgeDirection dir) - { - if (mechanicalNode.getPower() > 0) - { - if (dir == getDirection()) - { - return (int) Math.max((((double) mechanicalNode.getPower() / (double) maximumPower) * 100), 2); - } - else if (dir == getDirection().getOpposite()) - { - return (int) -Math.max((((double) mechanicalNode.getPower() / (double) maximumPower) * 100), 2); - } - } - - return 0; + return null; } } diff --git a/src/main/java/resonantinduction/api/mechanical/fluid/IPressure.java b/src/main/java/resonantinduction/api/mechanical/fluid/IPressure.java deleted file mode 100644 index 9a972a35..00000000 --- a/src/main/java/resonantinduction/api/mechanical/fluid/IPressure.java +++ /dev/null @@ -1,10 +0,0 @@ -package resonantinduction.api.mechanical.fluid; - -import net.minecraftforge.common.ForgeDirection; - -public interface IPressure -{ - public void setPressure(int amount); - - public int getPressure(ForgeDirection dir); -} diff --git a/src/main/java/resonantinduction/core/fluid/IPressurizedNode.java b/src/main/java/resonantinduction/core/fluid/IPressurizedNode.java deleted file mode 100644 index 0dc5b798..00000000 --- a/src/main/java/resonantinduction/core/fluid/IPressurizedNode.java +++ /dev/null @@ -1,27 +0,0 @@ -package resonantinduction.core.fluid; - -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.IFluidHandler; -import resonantinduction.api.mechanical.fluid.IPressure; -import universalelectricity.api.net.IConnector; - -/** - * Applied to tiles that are pipes and support pressure - * - * @author DarkGuardsman - */ -public interface IPressurizedNode extends IConnector, IFluidHandler, IPressure -{ - public FluidTank getInternalTank(); - - public void onFluidChanged(); - - public boolean canFlow(); - - /** - * Max flow rate of fluid this pipe can support - * - * @return amount in liters. - */ - public int getMaxFlowRate(); -} diff --git a/src/main/java/resonantinduction/core/fluid/PressureNetwork.java b/src/main/java/resonantinduction/core/fluid/PressureNetwork.java deleted file mode 100644 index 7fe79dd1..00000000 --- a/src/main/java/resonantinduction/core/fluid/PressureNetwork.java +++ /dev/null @@ -1,206 +0,0 @@ -package resonantinduction.core.fluid; - -import net.minecraftforge.common.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.IFluidHandler; -import resonantinduction.api.mechanical.fluid.IPressure; -import universalelectricity.api.net.IUpdate; -import universalelectricity.core.net.NetworkTickHandler; -import universalelectricity.core.net.NodeNetwork; - -/** - * The network for pipe fluid transfer. getNodes() is NOT used. - * - * @author Calclavia - */ -public class PressureNetwork extends NodeNetwork implements IUpdate -{ - public PressureNetwork() - { - super(IPressurizedNode.class); - } - - @Override - public void update() - { - for (IPressurizedNode connector : getConnectors()) - { - calculatePressure((IPressurizedNode) connector); - distribute((IPressurizedNode) connector); - } - } - - @Override - public boolean canUpdate() - { - return getConnectors().size() > 0; - } - - @Override - public boolean continueUpdate() - { - return canUpdate(); - } - - /** - * Calculate pressure in this pipe. - */ - public void calculatePressure(IPressurizedNode sourcePipe) - { - int totalPressure = 0; - int findCount = 0; - int minPressure = 0; - int maxPressure = 0; - - Object[] connections = sourcePipe.getConnections(); - - if (connections != null) - { - for (int i = 0; i < connections.length; i++) - { - Object obj = connections[i]; - - if (obj instanceof IPressure) - { - int pressure = ((IPressure) obj).getPressure(ForgeDirection.getOrientation(i).getOpposite()); - - minPressure = Math.min(pressure, minPressure); - maxPressure = Math.max(pressure, maxPressure); - totalPressure += pressure; - findCount++; - } - } - } - - if (findCount == 0) - { - sourcePipe.setPressure(0); - } - else - { - /** - * Create pressure loss. - */ - if (minPressure < 0) - minPressure += 1; - if (maxPressure > 0) - maxPressure -= 1; - - sourcePipe.setPressure(Math.max(minPressure, Math.min(maxPressure, totalPressure / findCount + Integer.signum(totalPressure)))); - } - } - - /** - * Distribute fluid in this pipe based on pressure. - */ - public void distribute(IPressurizedNode sourcePipe) - { - Object[] connections = sourcePipe.getConnections(); - - for (int i = 0; i < connections.length; i++) - { - Object obj = connections[i]; - - if (obj instanceof IPressurizedNode) - { - IPressurizedNode otherPipe = (IPressurizedNode) obj; - - /** - * Move fluid from higher pressure to lower. In this case, move from tankA to tankB. - */ - ForgeDirection dir = ForgeDirection.getOrientation(i); - int pressureA = sourcePipe.getPressure(dir); - int pressureB = otherPipe.getPressure(dir.getOpposite()); - - if (pressureA >= pressureB) - { - FluidTank tankA = sourcePipe.getInternalTank(); - FluidStack fluidA = tankA.getFluid(); - - if (tankA != null && fluidA != null) - { - int amountA = fluidA.amount; - - if (amountA > 0) - { - FluidTank tankB = otherPipe.getInternalTank(); - - if (tankB != null) - { - int amountB = tankB.getFluidAmount(); - - int quantity = Math.max(pressureA > pressureB ? (pressureA - pressureB) * sourcePipe.getMaxFlowRate() : 0, Math.min((amountA - amountB) / 2, sourcePipe.getMaxFlowRate())); - quantity = Math.min(Math.min(quantity, tankB.getCapacity() - amountB), amountA); - - if (quantity > 0) - { - FluidStack drainStack = sourcePipe.drain(dir.getOpposite(), quantity, false); - - if (drainStack != null && drainStack.amount > 0) - sourcePipe.drain(dir.getOpposite(), otherPipe.fill(dir, drainStack, true), true); - } - } - } - } - } - } - else if (obj instanceof IFluidHandler) - { - IFluidHandler fluidHandler = (IFluidHandler) obj; - ForgeDirection dir = ForgeDirection.getOrientation(i); - int pressure = sourcePipe.getPressure(dir); - int tankPressure = fluidHandler instanceof IPressure ? ((IPressure) fluidHandler).getPressure(dir.getOpposite()) : 0; - FluidTank sourceTank = sourcePipe.getInternalTank(); - - int transferAmount = (Math.max(pressure, tankPressure) - Math.min(pressure, tankPressure)) * sourcePipe.getMaxFlowRate(); - - if (pressure > tankPressure) - { - if (sourceTank.getFluidAmount() > 0 && transferAmount > 0) - { - FluidStack drainStack = sourcePipe.drain(dir.getOpposite(), transferAmount, false); - sourcePipe.drain(dir.getOpposite(), fluidHandler.fill(dir.getOpposite(), drainStack, true), true); - } - } - else if (pressure < tankPressure) - { - if (transferAmount > 0) - { - FluidStack drainStack = fluidHandler.drain(dir.getOpposite(), transferAmount, false); - - if (drainStack != null) - { - fluidHandler.drain(dir.getOpposite(), sourcePipe.fill(dir.getOpposite(), drainStack, true), true); - } - } - } - } - } - } - - @Override - public Class getConnectorClass() - { - return IPressurizedNode.class; - } - - @Override - public PressureNetwork newInstance() - { - return new PressureNetwork(); - } - - @Override - public void reconstructConnector(IPressurizedNode connector) - { - connector.setNetwork(this); - } - - @Override - public void reconstruct() - { - NetworkTickHandler.addNetwork(this); - super.reconstruct(); - } -} diff --git a/src/main/java/resonantinduction/core/grid/INodeProvider.java b/src/main/java/resonantinduction/core/grid/INodeProvider.java index c3599a4c..1b944f52 100644 --- a/src/main/java/resonantinduction/core/grid/INodeProvider.java +++ b/src/main/java/resonantinduction/core/grid/INodeProvider.java @@ -2,7 +2,19 @@ package resonantinduction.core.grid; import net.minecraftforge.common.ForgeDirection; -public interface INodeProvider +/** + * Any inheritance of INodeProvider should have a method "getNode()" + * + * @author Calclavia + * + * @param - Node type. + */ +public interface INodeProvider { - public N getNode(ForgeDirection from); + /** + * @param nodeType - The type of node we are looking for. + * @param from - The direction. + * @return Returns the node object. + */ + public Object getNode(Class nodeType, ForgeDirection from); } diff --git a/src/main/java/resonantinduction/core/grid/Node.java b/src/main/java/resonantinduction/core/grid/Node.java index 5bf10173..0a648d3c 100644 --- a/src/main/java/resonantinduction/core/grid/Node.java +++ b/src/main/java/resonantinduction/core/grid/Node.java @@ -95,6 +95,11 @@ public abstract class Node

return connections; } + public boolean canConnect(ForgeDirection from, Object source) + { + return false; + } + /** * Must be called to load the node's data. */ diff --git a/src/main/java/resonantinduction/core/grid/fluid/IPressureNodeProvider.java b/src/main/java/resonantinduction/core/grid/fluid/IPressureNodeProvider.java index fbce10e0..1121be08 100644 --- a/src/main/java/resonantinduction/core/grid/fluid/IPressureNodeProvider.java +++ b/src/main/java/resonantinduction/core/grid/fluid/IPressureNodeProvider.java @@ -4,7 +4,7 @@ import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidHandler; import resonantinduction.core.grid.INodeProvider; -public interface IPressureNodeProvider extends INodeProvider, IFluidHandler +public interface IPressureNodeProvider extends INodeProvider, IFluidHandler { FluidTank getPressureTank(); } diff --git a/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java b/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java index a8fa2260..27af98a2 100644 --- a/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java +++ b/src/main/java/resonantinduction/core/grid/fluid/PressureNode.java @@ -10,7 +10,6 @@ import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidHandler; -import resonantinduction.api.mechanical.fluid.IPressure; import resonantinduction.core.grid.Node; import resonantinduction.core.grid.TickingGrid; import universalelectricity.api.vector.Vector3; @@ -53,9 +52,9 @@ public class PressureNode extends Node entry = it.next(); Object obj = entry.getKey(); - if (obj instanceof IPressure) + if (obj instanceof PressureNode) { - int pressure = ((IPressure) obj).getPressure(entry.getValue().getOpposite()); + int pressure = ((PressureNode) obj).getPressure(entry.getValue().getOpposite()); minPressure = Math.min(pressure, minPressure); maxPressure = Math.max(pressure, maxPressure); @@ -138,7 +137,7 @@ public class PressureNode extends Node extends PartColorableMaterial implements INodeProvider, TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects +{ + public static IndexedCuboid6[] sides = new IndexedCuboid6[7]; + public static IndexedCuboid6[] insulatedSides = new IndexedCuboid6[7]; + + static + { + sides[0] = new IndexedCuboid6(0, new Cuboid6(0.36, 0.000, 0.36, 0.64, 0.36, 0.64)); + sides[1] = new IndexedCuboid6(1, new Cuboid6(0.36, 0.64, 0.36, 0.64, 1.000, 0.64)); + sides[2] = new IndexedCuboid6(2, new Cuboid6(0.36, 0.36, 0.000, 0.64, 0.64, 0.36)); + sides[3] = new IndexedCuboid6(3, new Cuboid6(0.36, 0.36, 0.64, 0.64, 0.64, 1.000)); + sides[4] = new IndexedCuboid6(4, new Cuboid6(0.000, 0.36, 0.36, 0.36, 0.64, 0.64)); + sides[5] = new IndexedCuboid6(5, new Cuboid6(0.64, 0.36, 0.36, 1.000, 0.64, 0.64)); + sides[6] = new IndexedCuboid6(6, new Cuboid6(0.36, 0.36, 0.36, 0.64, 0.64, 0.64)); + insulatedSides[0] = new IndexedCuboid6(0, new Cuboid6(0.3, 0.0, 0.3, 0.7, 0.3, 0.7)); + insulatedSides[1] = new IndexedCuboid6(1, new Cuboid6(0.3, 0.7, 0.3, 0.7, 1.0, 0.7)); + insulatedSides[2] = new IndexedCuboid6(2, new Cuboid6(0.3, 0.3, 0.0, 0.7, 0.7, 0.3)); + insulatedSides[3] = new IndexedCuboid6(3, new Cuboid6(0.3, 0.3, 0.7, 0.7, 0.7, 1.0)); + insulatedSides[4] = new IndexedCuboid6(4, new Cuboid6(0.0, 0.3, 0.3, 0.3, 0.7, 0.7)); + insulatedSides[5] = new IndexedCuboid6(5, new Cuboid6(0.7, 0.3, 0.3, 1.0, 0.7, 0.7)); + insulatedSides[6] = new IndexedCuboid6(6, new Cuboid6(0.3, 0.3, 0.3, 0.7, 0.7, 0.7)); + } + + protected Object[] connections = new Object[6]; + + protected N node; + + /** + * Bitmask connections + */ + public byte currentConnections = 0x00; + + /** Client Side */ + private ForgeDirection testingSide; + + @SideOnly(Side.CLIENT) + protected Icon breakIcon; + + public void preparePlacement(int meta) + { + this.setMaterial(meta); + } + + @Override + public boolean occlusionTest(TMultiPart other) + { + return NormalOcclusionTest.apply(this, other); + } + + @Override + public Iterable getSubParts() + { + Set subParts = new HashSet(); + IndexedCuboid6[] currentSides = isInsulated() ? insulatedSides : sides; + + if (tile() != null) + { + for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) + { + int ord = side.ordinal(); + if (connectionMapContainsSide(getAllCurrentConnections(), side) || side == testingSide) + subParts.add(currentSides[ord]); + } + } + + subParts.add(currentSides[6]); + return subParts; + } + + /** + * Rendering and block bounds. + */ + @Override + public Iterable getCollisionBoxes() + { + Set collisionBoxes = new HashSet(); + collisionBoxes.addAll((Collection) getSubParts()); + + return collisionBoxes; + } + + @Override + public float getStrength(MovingObjectPosition hit, EntityPlayer player) + { + return 10F; + } + + @Override + public void drawBreaking(RenderBlocks renderBlocks) + { + if (breakIcon != null) + { + CCRenderState.reset(); + RenderUtils.renderBlock(sides[6], 0, new Translation(x(), y(), z()), new IconTransformation(breakIcon), null); + } + } + + @Override + public Cuboid6 getBounds() + { + return new Cuboid6(0.375, 0.375, 0.375, 0.625, 0.625, 0.625); + } + + @Override + public Icon getBreakingIcon(Object subPart, int side) + { + return breakIcon; + } + + @Override + public Icon getBrokenIcon(int side) + { + return breakIcon; + } + + @Override + public Iterable getOcclusionBoxes() + { + return getCollisionBoxes(); + } + + @Override + public int getSlotMask() + { + return PartMap.CENTER.mask; + } + + @Override + public int getHollowSize() + { + return isInsulated ? 8 : 6; + } + + @Override + public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer) + { + IconHitEffects.addHitEffects(this, hit, effectRenderer); + } + + @Override + public void addDestroyEffects(EffectRenderer effectRenderer) + { + IconHitEffects.addDestroyEffects(this, effectRenderer, false); + } + + public boolean isBlockedOnSide(ForgeDirection side) + { + TMultiPart blocker = tile().partMap(side.ordinal()); + testingSide = side; + boolean expandable = NormalOcclusionTest.apply(this, blocker); + testingSide = null; + return !expandable; + } + + public byte getAllCurrentConnections() + { + return (byte) (currentConnections); + } + + public static boolean connectionMapContainsSide(byte connections, ForgeDirection side) + { + byte tester = (byte) (1 << side.ordinal()); + return ((connections & tester) > 0); + } + + @Override + public void bind(TileMultipart t) + { + node.deconstruct(); + super.bind(t); + node.reconstruct(); + } + + public boolean isCurrentlyConnected(ForgeDirection side) + { + return connectionMapContainsSide(getAllCurrentConnections(), side); + } + + @Override + public void onWorldJoin() + { + node.reconstruct(); + } + + @Override + public void onWorldSeparate() + { + node.deconstruct(); + } + + public void copyFrom(PartFramedNode other) + { + this.isInsulated = other.isInsulated; + this.color = other.color; + this.connections = other.connections; + this.material = other.material; + } + + /** Packet Methods */ + public void sendConnectionUpdate() + { + tile().getWriteStream(this).writeByte(0).writeByte(currentConnections); + } + + @Override + public void readDesc(MCDataInput packet) + { + super.readDesc(packet); + currentConnections = packet.readByte(); + } + + @Override + public void writeDesc(MCDataOutput packet) + { + super.writeDesc(packet); + packet.writeByte(currentConnections); + } + + @Override + public void read(MCDataInput packet) + { + read(packet, packet.readUByte()); + } + + @Override + public void read(MCDataInput packet, int packetID) + { + if (packetID == 0) + { + currentConnections= packet.readByte(); + tile().markRender(); + } + else + { + super.read(packet, packetID); + } + } + + public N getNode(ForgeDirection from) + { + return node; + } +} \ No newline at end of file