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