Added toString to several tiles allowing better debug
This commit is contained in:
parent
67d7114f1b
commit
990f83d5ce
9 changed files with 2027 additions and 2023 deletions
|
@ -17,101 +17,101 @@ import calclavia.lib.network.IPacketSender;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
/**
|
||||
* A modular battery box that allows shared connections with boxes next to it.
|
||||
/** A modular battery box that allows shared connections with boxes next to it.
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
* @author Calclavia */
|
||||
public class TileBattery extends TileEnergyDistribution implements IVoltageInput, IVoltageOutput, IPacketSender, IPacketReceiver, IEnergyInterface, IEnergyContainer
|
||||
{
|
||||
/**
|
||||
* Tiers: 0, 1, 2
|
||||
*/
|
||||
public static final int MAX_TIER = 2;
|
||||
/** Tiers: 0, 1, 2 */
|
||||
public static final int MAX_TIER = 2;
|
||||
|
||||
/** The transfer rate **/
|
||||
public static final long DEFAULT_WATTAGE = getEnergyForTier(0);
|
||||
/** The transfer rate **/
|
||||
public static final long DEFAULT_WATTAGE = getEnergyForTier(0);
|
||||
|
||||
public TileBattery()
|
||||
{
|
||||
this.setEnergyHandler(new EnergyStorageHandler(0));
|
||||
this.getEnergyHandler().setCapacity(Long.MAX_VALUE);
|
||||
this.ioMap = 0;
|
||||
this.saveIOMap = true;
|
||||
}
|
||||
public TileBattery()
|
||||
{
|
||||
this.setEnergyHandler(new EnergyStorageHandler(0));
|
||||
this.getEnergyHandler().setCapacity(Long.MAX_VALUE);
|
||||
this.ioMap = 0;
|
||||
this.saveIOMap = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tier - 0, 1, 2
|
||||
* @return
|
||||
*/
|
||||
public static long getEnergyForTier(int tier)
|
||||
{
|
||||
return Math.round(Math.pow(500000000, (tier / (MAX_TIER + 0.7f)) + 1) / (500000000)) * (500000000);
|
||||
}
|
||||
/** @param tier - 0, 1, 2
|
||||
* @return */
|
||||
public static long getEnergyForTier(int tier)
|
||||
{
|
||||
return Math.round(Math.pow(500000000, (tier / (MAX_TIER + 0.7f)) + 1) / (500000000)) * (500000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
super.initiate();
|
||||
getEnergyHandler().setCapacity(getEnergyForTier(getBlockMetadata()));
|
||||
getEnergyHandler().setMaxTransfer(getEnergyHandler().getEnergyCapacity());
|
||||
}
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
super.initiate();
|
||||
getEnergyHandler().setCapacity(getEnergyForTier(getBlockMetadata()));
|
||||
getEnergyHandler().setMaxTransfer(getEnergyHandler().getEnergyCapacity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
markDistributionUpdate |= produce() > 0;
|
||||
}
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
markDistributionUpdate |= produce() > 0;
|
||||
}
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, getPacketData(0).toArray());
|
||||
}
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return ResonantInduction.PACKET_TILE.getPacket(this, getPacketData(0).toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
getEnergyHandler().setEnergy(data.readLong());
|
||||
ioMap = data.readShort();
|
||||
}
|
||||
@Override
|
||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
getEnergyHandler().setEnergy(data.readLong());
|
||||
ioMap = data.readShort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getPacketData(int type)
|
||||
{
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(renderEnergyAmount);
|
||||
data.add(ioMap);
|
||||
return data;
|
||||
}
|
||||
@Override
|
||||
public ArrayList getPacketData(int type)
|
||||
{
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(renderEnergyAmount);
|
||||
data.add(ioMap);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVoltageOutput(ForgeDirection side)
|
||||
{
|
||||
return UniversalElectricity.DEFAULT_VOLTAGE;
|
||||
}
|
||||
@Override
|
||||
public long getVoltageOutput(ForgeDirection side)
|
||||
{
|
||||
return UniversalElectricity.DEFAULT_VOLTAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVoltageInput(ForgeDirection direction)
|
||||
{
|
||||
return UniversalElectricity.DEFAULT_VOLTAGE;
|
||||
}
|
||||
@Override
|
||||
public long getVoltageInput(ForgeDirection direction)
|
||||
{
|
||||
return UniversalElectricity.DEFAULT_VOLTAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWrongVoltage(ForgeDirection direction, long voltage)
|
||||
{
|
||||
@Override
|
||||
public void onWrongVoltage(ForgeDirection direction, long voltage)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIO(ForgeDirection dir, int type)
|
||||
{
|
||||
super.setIO(dir, type);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
@Override
|
||||
public void setIO(ForgeDirection dir, int type)
|
||||
{
|
||||
super.setIO(dir, type);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[TileBattery]" + x() + "x " + y() + "y " + z() + "z ";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,4 +140,10 @@ public class PartCharger extends PartInventoryPanel implements IEnergyInterface
|
|||
{
|
||||
return slot < this.getSizeInventory() && stack != null && CompatibilityModule.isHandler(stack.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[PartCharger]" + x() + "x " + y() + "y " + z() + "z " + getSlotMask() + "s ";
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -343,4 +343,10 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[PartAdvancedWire]" + x() + "x " + y() + "y " + z() + "z ";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,173 +22,169 @@ import codechicken.multipart.TMultiPart;
|
|||
@Deprecated
|
||||
public abstract class PartConductor extends PartAdvanced implements IConductor
|
||||
{
|
||||
private IEnergyNetwork network;
|
||||
private IEnergyNetwork network;
|
||||
|
||||
protected Object[] connections = new Object[6];
|
||||
protected Object[] connections = new Object[6];
|
||||
|
||||
/**
|
||||
* Universal Electricity conductor functions.
|
||||
*/
|
||||
@Override
|
||||
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
|
||||
{
|
||||
return this.getNetwork().produce(this, from.getOpposite(), receive, doReceive);
|
||||
}
|
||||
/** Universal Electricity conductor functions. */
|
||||
@Override
|
||||
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
|
||||
{
|
||||
return this.getNetwork().produce(this, from.getOpposite(), receive, doReceive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long onExtractEnergy(ForgeDirection from, long request, boolean doExtract)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public long onExtractEnergy(ForgeDirection from, long request, boolean doExtract)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEnergyNetwork getNetwork()
|
||||
{
|
||||
if (this.network == null)
|
||||
{
|
||||
this.setNetwork(EnergyNetworkLoader.getNewNetwork(this));
|
||||
}
|
||||
@Override
|
||||
public IEnergyNetwork getNetwork()
|
||||
{
|
||||
if (this.network == null)
|
||||
{
|
||||
this.setNetwork(EnergyNetworkLoader.getNewNetwork(this));
|
||||
}
|
||||
|
||||
return this.network;
|
||||
}
|
||||
return this.network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetwork(IEnergyNetwork network)
|
||||
{
|
||||
this.network = network;
|
||||
}
|
||||
@Override
|
||||
public void setNetwork(IEnergyNetwork network)
|
||||
{
|
||||
this.network = network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesTick()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean doesTick()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getConnections()
|
||||
{
|
||||
return this.connections;
|
||||
}
|
||||
@Override
|
||||
public Object[] getConnections()
|
||||
{
|
||||
return this.connections;
|
||||
}
|
||||
|
||||
/**
|
||||
* EXTERNAL USE Can this wire be connected by another block?
|
||||
*/
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction, Object source)
|
||||
{
|
||||
Vector3 connectPos = new Vector3(tile()).translate(direction);
|
||||
TileEntity connectTile = connectPos.getTileEntity(world());
|
||||
/** EXTERNAL USE Can this wire be connected by another block? */
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction, Object source)
|
||||
{
|
||||
Vector3 connectPos = new Vector3(tile()).translate(direction);
|
||||
TileEntity connectTile = connectPos.getTileEntity(world());
|
||||
|
||||
if (connectTile instanceof IConductor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (connectTile instanceof IConductor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CompatibilityModule.isHandler(connectTile);
|
||||
}
|
||||
return CompatibilityModule.isHandler(connectTile);
|
||||
}
|
||||
|
||||
public abstract boolean canConnectTo(Object obj);
|
||||
public abstract boolean canConnectTo(Object obj);
|
||||
|
||||
/**
|
||||
* Recalculates all the network connections
|
||||
*/
|
||||
protected void recalculateConnections()
|
||||
{
|
||||
this.connections = new Object[6];
|
||||
/**
|
||||
* Calculate all external connections with this conductor.
|
||||
*/
|
||||
for (byte i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation(i);
|
||||
/** Recalculates all the network connections */
|
||||
protected void recalculateConnections()
|
||||
{
|
||||
this.connections = new Object[6];
|
||||
/** Calculate all external connections with this conductor. */
|
||||
for (byte i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation(i);
|
||||
|
||||
if (this.canConnect(side, this))
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
|
||||
connections[i] = tileEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.canConnect(side, this))
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
|
||||
connections[i] = tileEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* IC2 Functions
|
||||
*/
|
||||
@Override
|
||||
public void onWorldJoin()
|
||||
{
|
||||
if (tile() instanceof IEnergyTile && !world().isRemote)
|
||||
{
|
||||
// Check if there's another part that's an IEnergyTile
|
||||
boolean foundAnotherPart = false;
|
||||
/** IC2 Functions */
|
||||
@Override
|
||||
public void onWorldJoin()
|
||||
{
|
||||
if (tile() instanceof IEnergyTile && !world().isRemote)
|
||||
{
|
||||
// Check if there's another part that's an IEnergyTile
|
||||
boolean foundAnotherPart = false;
|
||||
|
||||
for (int i = 0; i < tile().partList().size(); i++)
|
||||
{
|
||||
TMultiPart part = tile().partMap(i);
|
||||
for (int i = 0; i < tile().partList().size(); i++)
|
||||
{
|
||||
TMultiPart part = tile().partMap(i);
|
||||
|
||||
if (part instanceof IEnergyTile && part != this)
|
||||
{
|
||||
foundAnotherPart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (part instanceof IEnergyTile && part != this)
|
||||
{
|
||||
foundAnotherPart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundAnotherPart)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile) tile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundAnotherPart)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile) tile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRemove()
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
this.getNetwork().split(this);
|
||||
@Override
|
||||
public void preRemove()
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
this.getNetwork().split(this);
|
||||
|
||||
if (tile() instanceof IEnergyTile)
|
||||
{
|
||||
// Check if there's another part that's an IEnergyTile
|
||||
boolean foundAnotherPart = false;
|
||||
if (tile() instanceof IEnergyTile)
|
||||
{
|
||||
// Check if there's another part that's an IEnergyTile
|
||||
boolean foundAnotherPart = false;
|
||||
|
||||
for (int i = 0; i < tile().partList().size(); i++)
|
||||
{
|
||||
TMultiPart part = tile().partMap(i);
|
||||
for (int i = 0; i < tile().partList().size(); i++)
|
||||
{
|
||||
TMultiPart part = tile().partMap(i);
|
||||
|
||||
if (part instanceof IEnergyTile && part != this)
|
||||
{
|
||||
foundAnotherPart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (part instanceof IEnergyTile && part != this)
|
||||
{
|
||||
foundAnotherPart = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundAnotherPart)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) tile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundAnotherPart)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergyTile) tile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.preRemove();
|
||||
}
|
||||
super.preRemove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConnector<IEnergyNetwork> getInstance(ForgeDirection dir)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public IConnector<IEnergyNetwork> getInstance(ForgeDirection dir)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(NBTTagCompound nbt)
|
||||
{
|
||||
super.save(nbt);
|
||||
nbt.setLong("savedBuffer", getNetwork().getBufferOf(this));
|
||||
}
|
||||
@Override
|
||||
public void save(NBTTagCompound nbt)
|
||||
{
|
||||
super.save(nbt);
|
||||
nbt.setLong("savedBuffer", getNetwork().getBufferOf(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbt)
|
||||
{
|
||||
super.load(nbt);
|
||||
getNetwork().setBufferFor(this, nbt.getLong("savedBuffer"));
|
||||
}
|
||||
@Override
|
||||
public void load(NBTTagCompound nbt)
|
||||
{
|
||||
super.load(nbt);
|
||||
getNetwork().setBufferFor(this, nbt.getLong("savedBuffer"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[PartConductor]" + x() + "x " + y() + "y " + z() + "z ";
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,12 +8,10 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import calclavia.lib.prefab.damage.ElectricalDamage;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
@ -29,6 +27,7 @@ import universalelectricity.api.electricity.IElectricalNetwork;
|
|||
import universalelectricity.api.energy.EnergyNetworkLoader;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import universalelectricity.api.energy.IEnergyNetwork;
|
||||
import calclavia.lib.prefab.damage.ElectricalDamage;
|
||||
import codechicken.lib.lighting.LazyLightMatrix;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.render.IconTransformation;
|
||||
|
@ -349,7 +348,7 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
|
|||
{
|
||||
return new ItemStack(Electrical.itemWire, 1, getMaterialID());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(Entity entity)
|
||||
{
|
||||
|
@ -357,4 +356,10 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
|
|||
ElectricalDamage.handleElectrocution(entity, this, (IElectricalNetwork) this.getNetwork());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[PartFramedWire]" + x() + "x " + y() + "y " + z() + "z " + getSlotMask() + "s ";
|
||||
}
|
||||
|
||||
}
|
|
@ -550,4 +550,10 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
{
|
||||
return Cuboid6.full.copy().expand(multiBlockRadius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[PartGear]" + x() + "x " + y() + "y " + z() + "z " + getSlotMask() + "s ";
|
||||
}
|
||||
}
|
|
@ -35,399 +35,395 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public abstract class PartFramedConnection<M extends Enum, C extends IConnector<N>, N extends INodeNetwork> extends PartColorableMaterial<M> implements IConnector<N>, TSlottedPart, JNormalOcclusion, IHollowConnect
|
||||
{
|
||||
public static IndexedCuboid6[] sides = new IndexedCuboid6[7];
|
||||
public static IndexedCuboid6[] insulatedSides = new IndexedCuboid6[7];
|
||||
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));
|
||||
}
|
||||
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 Object[] connections = new Object[6];
|
||||
|
||||
protected N network;
|
||||
protected N network;
|
||||
|
||||
/**
|
||||
* Bitmask connections
|
||||
*/
|
||||
public byte currentWireConnections = 0x00;
|
||||
public byte currentAcceptorConnections = 0x00;
|
||||
/** Bitmask connections */
|
||||
public byte currentWireConnections = 0x00;
|
||||
public byte currentAcceptorConnections = 0x00;
|
||||
|
||||
/** Client Side */
|
||||
private ForgeDirection testingSide;
|
||||
/** Client Side */
|
||||
private ForgeDirection testingSide;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected Icon breakIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected Icon breakIcon;
|
||||
|
||||
public PartFramedConnection(Item insulationType)
|
||||
{
|
||||
super(insulationType);
|
||||
}
|
||||
public PartFramedConnection(Item insulationType)
|
||||
{
|
||||
super(insulationType);
|
||||
}
|
||||
|
||||
public void preparePlacement(int meta)
|
||||
{
|
||||
this.setMaterial(meta);
|
||||
}
|
||||
public void preparePlacement(int meta)
|
||||
{
|
||||
this.setMaterial(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean occlusionTest(TMultiPart other)
|
||||
{
|
||||
return NormalOcclusionTest.apply(this, other);
|
||||
}
|
||||
@Override
|
||||
public boolean occlusionTest(TMultiPart other)
|
||||
{
|
||||
return NormalOcclusionTest.apply(this, other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IndexedCuboid6> getSubParts()
|
||||
{
|
||||
Set<IndexedCuboid6> subParts = new HashSet<IndexedCuboid6>();
|
||||
IndexedCuboid6[] currentSides = isInsulated() ? insulatedSides : sides;
|
||||
@Override
|
||||
public Iterable<IndexedCuboid6> getSubParts()
|
||||
{
|
||||
Set<IndexedCuboid6> subParts = new HashSet<IndexedCuboid6>();
|
||||
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]);
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
subParts.add(currentSides[6]);
|
||||
return subParts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rendering and block bounds.
|
||||
*/
|
||||
@Override
|
||||
public Iterable<Cuboid6> getCollisionBoxes()
|
||||
{
|
||||
Set<Cuboid6> collisionBoxes = new HashSet<Cuboid6>();
|
||||
collisionBoxes.addAll((Collection<? extends Cuboid6>) getSubParts());
|
||||
/** Rendering and block bounds. */
|
||||
@Override
|
||||
public Iterable<Cuboid6> getCollisionBoxes()
|
||||
{
|
||||
Set<Cuboid6> collisionBoxes = new HashSet<Cuboid6>();
|
||||
collisionBoxes.addAll((Collection<? extends Cuboid6>) getSubParts());
|
||||
|
||||
return collisionBoxes;
|
||||
}
|
||||
return collisionBoxes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrength(MovingObjectPosition hit, EntityPlayer player)
|
||||
{
|
||||
return 10F;
|
||||
}
|
||||
@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 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 Iterable<Cuboid6> getOcclusionBoxes()
|
||||
{
|
||||
return getCollisionBoxes();
|
||||
}
|
||||
@Override
|
||||
public Iterable<Cuboid6> getOcclusionBoxes()
|
||||
{
|
||||
return getCollisionBoxes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotMask()
|
||||
{
|
||||
return PartMap.CENTER.mask;
|
||||
}
|
||||
@Override
|
||||
public int getSlotMask()
|
||||
{
|
||||
return PartMap.CENTER.mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHollowSize()
|
||||
{
|
||||
return isInsulated ? 8 : 6;
|
||||
}
|
||||
@Override
|
||||
public int getHollowSize()
|
||||
{
|
||||
return isInsulated ? 8 : 6;
|
||||
}
|
||||
|
||||
public boolean isBlockedOnSide(ForgeDirection side)
|
||||
{
|
||||
TMultiPart blocker = tile().partMap(side.ordinal());
|
||||
testingSide = side;
|
||||
boolean expandable = NormalOcclusionTest.apply(this, blocker);
|
||||
testingSide = null;
|
||||
return !expandable;
|
||||
}
|
||||
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) (currentWireConnections | currentAcceptorConnections);
|
||||
}
|
||||
public byte getAllCurrentConnections()
|
||||
{
|
||||
return (byte) (currentWireConnections | currentAcceptorConnections);
|
||||
}
|
||||
|
||||
public static boolean connectionMapContainsSide(byte connections, ForgeDirection side)
|
||||
{
|
||||
byte tester = (byte) (1 << side.ordinal());
|
||||
return ((connections & tester) > 0);
|
||||
}
|
||||
public static boolean connectionMapContainsSide(byte connections, ForgeDirection side)
|
||||
{
|
||||
byte tester = (byte) (1 << side.ordinal());
|
||||
return ((connections & tester) > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(TileMultipart t)
|
||||
{
|
||||
if (this.getNetwork() != null)
|
||||
{
|
||||
getNetwork().getConnectors().remove(this);
|
||||
super.bind(t);
|
||||
getNetwork().getConnectors().add(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.bind(t);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void bind(TileMultipart t)
|
||||
{
|
||||
if (this.getNetwork() != null)
|
||||
{
|
||||
getNetwork().getConnectors().remove(this);
|
||||
super.bind(t);
|
||||
getNetwork().getConnectors().add(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.bind(t);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CONNECTION LOGIC CODE
|
||||
*/
|
||||
protected abstract boolean canConnectTo(TileEntity tile, ForgeDirection to);
|
||||
/** CONNECTION LOGIC CODE */
|
||||
protected abstract boolean canConnectTo(TileEntity tile, ForgeDirection to);
|
||||
|
||||
protected abstract C getConnector(TileEntity tile);
|
||||
protected abstract C getConnector(TileEntity tile);
|
||||
|
||||
public boolean canConnectBothSides(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
boolean notPrevented = !isConnectionPrevented(tile, side);
|
||||
public boolean canConnectBothSides(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
boolean notPrevented = !isConnectionPrevented(tile, side);
|
||||
|
||||
if (getConnector(tile) != null)
|
||||
{
|
||||
notPrevented &= getConnector(tile).canConnect(side.getOpposite(), this);
|
||||
}
|
||||
if (getConnector(tile) != null)
|
||||
{
|
||||
notPrevented &= getConnector(tile).canConnect(side.getOpposite(), this);
|
||||
}
|
||||
|
||||
return notPrevented;
|
||||
}
|
||||
return notPrevented;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override if there are ways of preventing a connection
|
||||
*
|
||||
* @param tile The TileEntity on the given side
|
||||
* @param side The side we're checking
|
||||
* @return Whether we're preventing connections on given side or to given tileEntity
|
||||
*/
|
||||
public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
return (!this.canConnectTo(tile, side)) || (isBlockedOnSide(side));
|
||||
}
|
||||
/** Override if there are ways of preventing a connection
|
||||
*
|
||||
* @param tile The TileEntity on the given side
|
||||
* @param side The side we're checking
|
||||
* @return Whether we're preventing connections on given side or to given tileEntity */
|
||||
public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
return (!this.canConnectTo(tile, side)) || (isBlockedOnSide(side));
|
||||
}
|
||||
|
||||
public byte getPossibleWireConnections()
|
||||
{
|
||||
byte connections = 0x00;
|
||||
public byte getPossibleWireConnections()
|
||||
{
|
||||
byte connections = 0x00;
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
|
||||
|
||||
if (getConnector(tileEntity) != null && canConnectBothSides(tileEntity, side))
|
||||
{
|
||||
connections |= 1 << side.ordinal();
|
||||
}
|
||||
}
|
||||
if (getConnector(tileEntity) != null && canConnectBothSides(tileEntity, side))
|
||||
{
|
||||
connections |= 1 << side.ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
return connections;
|
||||
}
|
||||
return connections;
|
||||
}
|
||||
|
||||
public byte getPossibleAcceptorConnections()
|
||||
{
|
||||
byte connections = 0x00;
|
||||
public byte getPossibleAcceptorConnections()
|
||||
{
|
||||
byte connections = 0x00;
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
|
||||
|
||||
if (canConnectTo(tileEntity, side) && canConnectBothSides(tileEntity, side))
|
||||
{
|
||||
connections |= 1 << side.ordinal();
|
||||
}
|
||||
}
|
||||
if (canConnectTo(tileEntity, side) && canConnectBothSides(tileEntity, side))
|
||||
{
|
||||
connections |= 1 << side.ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
return connections;
|
||||
}
|
||||
return connections;
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
byte possibleWireConnections = getPossibleWireConnections();
|
||||
byte possibleAcceptorConnections = getPossibleAcceptorConnections();
|
||||
public void refresh()
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
byte possibleWireConnections = getPossibleWireConnections();
|
||||
byte possibleAcceptorConnections = getPossibleAcceptorConnections();
|
||||
|
||||
if (possibleWireConnections != this.currentWireConnections)
|
||||
{
|
||||
byte or = (byte) (possibleWireConnections | this.currentWireConnections);
|
||||
if (possibleWireConnections != this.currentWireConnections)
|
||||
{
|
||||
byte or = (byte) (possibleWireConnections | this.currentWireConnections);
|
||||
|
||||
// Connections have been removed
|
||||
if (or != possibleWireConnections)
|
||||
{
|
||||
this.getNetwork().removeConnector(this);
|
||||
this.getNetwork().split(this);
|
||||
setNetwork(null);
|
||||
}
|
||||
// Connections have been removed
|
||||
if (or != possibleWireConnections)
|
||||
{
|
||||
this.getNetwork().removeConnector(this);
|
||||
this.getNetwork().split(this);
|
||||
setNetwork(null);
|
||||
}
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (connectionMapContainsSide(possibleWireConnections, side))
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getConnectorFromSide(world(), new Vector3(tile()), side, this);
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (connectionMapContainsSide(possibleWireConnections, side))
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getConnectorFromSide(world(), new Vector3(tile()), side, this);
|
||||
|
||||
if (getConnector(tileEntity) != null)
|
||||
{
|
||||
getNetwork().merge(getConnector(tileEntity).getNetwork());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getConnector(tileEntity) != null)
|
||||
{
|
||||
getNetwork().merge(getConnector(tileEntity).getNetwork());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.currentWireConnections = possibleWireConnections;
|
||||
}
|
||||
this.currentWireConnections = possibleWireConnections;
|
||||
}
|
||||
|
||||
this.currentAcceptorConnections = possibleAcceptorConnections;
|
||||
this.getNetwork().reconstruct();
|
||||
this.sendConnectionUpdate();
|
||||
}
|
||||
this.currentAcceptorConnections = possibleAcceptorConnections;
|
||||
this.getNetwork().reconstruct();
|
||||
this.sendConnectionUpdate();
|
||||
}
|
||||
|
||||
tile().markRender();
|
||||
}
|
||||
tile().markRender();
|
||||
}
|
||||
|
||||
/**
|
||||
* Should include connections that are in the current connection maps even if those connections
|
||||
* aren't allowed any more. This is so that networks split correctly.
|
||||
*/
|
||||
@Override
|
||||
public TileEntity[] getConnections()
|
||||
{
|
||||
TileEntity[] connections = new TileEntity[6];
|
||||
/** Should include connections that are in the current connection maps even if those connections
|
||||
* aren't allowed any more. This is so that networks split correctly. */
|
||||
@Override
|
||||
public TileEntity[] getConnections()
|
||||
{
|
||||
TileEntity[] connections = new TileEntity[6];
|
||||
|
||||
if (world() != null)
|
||||
{
|
||||
for (byte i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation(i);
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
|
||||
if (world() != null)
|
||||
{
|
||||
for (byte i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation(i);
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
|
||||
|
||||
if (isCurrentlyConnected(side))
|
||||
{
|
||||
connections[i] = tileEntity;
|
||||
}
|
||||
}
|
||||
if (isCurrentlyConnected(side))
|
||||
{
|
||||
connections[i] = tileEntity;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return connections;
|
||||
}
|
||||
}
|
||||
return connections;
|
||||
}
|
||||
|
||||
public boolean isCurrentlyConnected(ForgeDirection side)
|
||||
{
|
||||
return connectionMapContainsSide(getAllCurrentConnections(), side);
|
||||
}
|
||||
public boolean isCurrentlyConnected(ForgeDirection side)
|
||||
{
|
||||
return connectionMapContainsSide(getAllCurrentConnections(), side);
|
||||
}
|
||||
|
||||
/** Shouldn't need to be overridden. Override connectionPrevented instead */
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction, Object source)
|
||||
{
|
||||
Vector3 connectPos = new Vector3(tile()).translate(direction);
|
||||
TileEntity connectTile = connectPos.getTileEntity(world());
|
||||
return !isConnectionPrevented(connectTile, direction);
|
||||
}
|
||||
/** Shouldn't need to be overridden. Override connectionPrevented instead */
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction, Object source)
|
||||
{
|
||||
Vector3 connectPos = new Vector3(tile()).translate(direction);
|
||||
TileEntity connectTile = connectPos.getTileEntity(world());
|
||||
return !isConnectionPrevented(connectTile, direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdded()
|
||||
{
|
||||
super.onAdded();
|
||||
refresh();
|
||||
}
|
||||
@Override
|
||||
public void onAdded()
|
||||
{
|
||||
super.onAdded();
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldJoin()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
@Override
|
||||
public void onWorldJoin()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
super.onNeighborChanged();
|
||||
refresh();
|
||||
}
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
super.onNeighborChanged();
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPartChanged(TMultiPart part)
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
@Override
|
||||
public void onPartChanged(TMultiPart part)
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void copyFrom(PartFramedConnection<M, C, N> other)
|
||||
{
|
||||
this.isInsulated = other.isInsulated;
|
||||
this.color = other.color;
|
||||
this.connections = other.connections;
|
||||
this.material = other.material;
|
||||
this.currentWireConnections = other.currentWireConnections;
|
||||
this.currentAcceptorConnections = other.currentAcceptorConnections;
|
||||
this.setNetwork(other.getNetwork());
|
||||
}
|
||||
public void copyFrom(PartFramedConnection<M, C, N> other)
|
||||
{
|
||||
this.isInsulated = other.isInsulated;
|
||||
this.color = other.color;
|
||||
this.connections = other.connections;
|
||||
this.material = other.material;
|
||||
this.currentWireConnections = other.currentWireConnections;
|
||||
this.currentAcceptorConnections = other.currentAcceptorConnections;
|
||||
this.setNetwork(other.getNetwork());
|
||||
}
|
||||
|
||||
/** Packet Methods */
|
||||
public void sendConnectionUpdate()
|
||||
{
|
||||
tile().getWriteStream(this).writeByte(0).writeByte(this.currentWireConnections).writeByte(this.currentAcceptorConnections);
|
||||
}
|
||||
/** Packet Methods */
|
||||
public void sendConnectionUpdate()
|
||||
{
|
||||
tile().getWriteStream(this).writeByte(0).writeByte(this.currentWireConnections).writeByte(this.currentAcceptorConnections);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readDesc(MCDataInput packet)
|
||||
{
|
||||
super.readDesc(packet);
|
||||
this.currentWireConnections = packet.readByte();
|
||||
this.currentAcceptorConnections = packet.readByte();
|
||||
}
|
||||
@Override
|
||||
public void readDesc(MCDataInput packet)
|
||||
{
|
||||
super.readDesc(packet);
|
||||
this.currentWireConnections = packet.readByte();
|
||||
this.currentAcceptorConnections = packet.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDesc(MCDataOutput packet)
|
||||
{
|
||||
super.writeDesc(packet);
|
||||
packet.writeByte(this.currentWireConnections);
|
||||
packet.writeByte(this.currentAcceptorConnections);
|
||||
}
|
||||
@Override
|
||||
public void writeDesc(MCDataOutput packet)
|
||||
{
|
||||
super.writeDesc(packet);
|
||||
packet.writeByte(this.currentWireConnections);
|
||||
packet.writeByte(this.currentAcceptorConnections);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(MCDataInput packet)
|
||||
{
|
||||
read(packet, packet.readUByte());
|
||||
}
|
||||
@Override
|
||||
public void read(MCDataInput packet)
|
||||
{
|
||||
read(packet, packet.readUByte());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(MCDataInput packet, int packetID)
|
||||
{
|
||||
if (packetID == 0)
|
||||
{
|
||||
this.currentWireConnections = packet.readByte();
|
||||
this.currentAcceptorConnections = packet.readByte();
|
||||
tile().markRender();
|
||||
}
|
||||
else
|
||||
{
|
||||
super.read(packet, packetID);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void read(MCDataInput packet, int packetID)
|
||||
{
|
||||
if (packetID == 0)
|
||||
{
|
||||
this.currentWireConnections = packet.readByte();
|
||||
this.currentAcceptorConnections = packet.readByte();
|
||||
tile().markRender();
|
||||
}
|
||||
else
|
||||
{
|
||||
super.read(packet, packetID);
|
||||
}
|
||||
}
|
||||
|
||||
/** Network Methods */
|
||||
@Override
|
||||
public void setNetwork(N network)
|
||||
{
|
||||
this.network = network;
|
||||
}
|
||||
/** Network Methods */
|
||||
@Override
|
||||
public void setNetwork(N network)
|
||||
{
|
||||
this.network = network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConnector<N> getInstance(ForgeDirection dir)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public IConnector<N> getInstance(ForgeDirection dir)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[PartFramedConnection]" + x() + "x " + y() + "y " + z() + "z " + getSlotMask() + "s ";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue