Added null check to right click framed wire

This commit is contained in:
Calclavia 2014-01-03 16:53:29 +08:00
parent a0a1d68f7b
commit 1dd2151b9b
3 changed files with 494 additions and 490 deletions

@ -1 +1 @@
Subproject commit 9fb37199c4375ce8e07576cf843272355b66ad92 Subproject commit 9ef65f568555a0b95f18f642b3306fcb3e63b1ab

View file

@ -45,493 +45,497 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PartFramedWire extends PartAdvancedWire implements TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects public class PartFramedWire extends PartAdvancedWire implements TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects
{ {
/** Client Side Connection Check */ /** Client Side Connection Check */
private ForgeDirection testingSide; private ForgeDirection testingSide;
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];
/** /**
* Bitmask connections * Bitmask connections
*/ */
public byte currentWireConnections = 0x00; public byte currentWireConnections = 0x00;
public byte currentAcceptorConnections = 0x00; public byte currentAcceptorConnections = 0x00;
public PartFramedWire() public PartFramedWire()
{ {
super(); super();
} }
public PartFramedWire(int typeID) public PartFramedWire(int typeID)
{ {
this(EnumWireMaterial.values()[typeID]); this(EnumWireMaterial.values()[typeID]);
} }
public PartFramedWire(EnumWireMaterial type) public PartFramedWire(EnumWireMaterial type)
{ {
super(); super();
material = type; material = type;
} }
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));
} }
@Override @Override
public String getType() public String getType()
{ {
return "resonant_induction_wire"; return "resonant_induction_wire";
} }
@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;
} }
@Override @Override
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item) public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
{ {
if (!world().isRemote) if (!world().isRemote)
{ {
System.out.println(this.getNetwork()); System.out.println(this.getNetwork());
} }
TileMultipart tile = tile();
World w = world(); TileMultipart tile = tile();
World w = world();
if (item.getItem().itemID == Block.lever.blockID)
{ if (item != null)
if (!w.isRemote) {
{ if (item.getItem().itemID == Block.lever.blockID)
PartFramedSwitchWire wire = (PartFramedSwitchWire) MultiPartRegistry.createPart("resonant_induction_switch_wire", false); {
wire.copyFrom(this); if (!w.isRemote)
{
if (tile.canReplacePart(this, wire)) PartFramedSwitchWire wire = (PartFramedSwitchWire) MultiPartRegistry.createPart("resonant_induction_switch_wire", false);
{ wire.copyFrom(this);
tile.remPart(this);
TileMultipart.addPart(w, new BlockCoord(tile), wire); if (tile.canReplacePart(this, wire))
{
if (!player.capabilities.isCreativeMode) tile.remPart(this);
{ TileMultipart.addPart(w, new BlockCoord(tile), wire);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
} if (!player.capabilities.isCreativeMode)
} {
} player.inventory.decrStackSize(player.inventory.currentItem, 1);
return true; }
} }
else }
{ return true;
return super.activate(player, part, item); }
} }
}
return super.activate(player, part, item);
public void preparePlacement(int meta) }
{
this.setMaterial(meta); public void preparePlacement(int meta)
} {
this.setMaterial(meta);
@Override }
public Iterable<Cuboid6> getCollisionBoxes()
{ @Override
Set<Cuboid6> collisionBoxes = new HashSet<Cuboid6>(); public Iterable<Cuboid6> getCollisionBoxes()
collisionBoxes.addAll((Collection<? extends Cuboid6>) getSubParts()); {
Set<Cuboid6> collisionBoxes = new HashSet<Cuboid6>();
return collisionBoxes; collisionBoxes.addAll((Collection<? extends Cuboid6>) getSubParts());
}
return collisionBoxes;
@Override }
public float getStrength(MovingObjectPosition hit, EntityPlayer player)
{ @Override
return 10F; public float getStrength(MovingObjectPosition hit, EntityPlayer player)
} {
return 10F;
@Override }
@SideOnly(Side.CLIENT)
public void renderStatic(codechicken.lib.vec.Vector3 pos, LazyLightMatrix olm, int pass) @Override
{ @SideOnly(Side.CLIENT)
if (pass == 0) public void renderStatic(codechicken.lib.vec.Vector3 pos, LazyLightMatrix olm, int pass)
{ {
RenderPartWire.INSTANCE.renderStatic(this); if (pass == 0)
} {
} RenderPartWire.INSTANCE.renderStatic(this);
}
@Override }
@SideOnly(Side.CLIENT)
public void renderDynamic(codechicken.lib.vec.Vector3 pos, float frame, int pass) @Override
{ @SideOnly(Side.CLIENT)
if (getMaterial() == EnumWireMaterial.SILVER) public void renderDynamic(codechicken.lib.vec.Vector3 pos, float frame, int pass)
{ {
RenderPartWire.INSTANCE.renderShine(this, pos.x, pos.y, pos.z, frame); if (getMaterial() == EnumWireMaterial.SILVER)
} {
} RenderPartWire.INSTANCE.renderShine(this, pos.x, pos.y, pos.z, frame);
}
@Override }
public void drawBreaking(RenderBlocks renderBlocks)
{ @Override
CCRenderState.reset(); public void drawBreaking(RenderBlocks renderBlocks)
RenderUtils.renderBlock(sides[6], 0, new Translation(x(), y(), z()), new IconTransformation(renderBlocks.overrideBlockTexture), null); {
} CCRenderState.reset();
RenderUtils.renderBlock(sides[6], 0, new Translation(x(), y(), z()), new IconTransformation(renderBlocks.overrideBlockTexture), null);
@Override }
public Iterable<Cuboid6> getOcclusionBoxes()
{ @Override
return getCollisionBoxes(); public Iterable<Cuboid6> getOcclusionBoxes()
} {
return getCollisionBoxes();
@Override }
public int getSlotMask()
{ @Override
return PartMap.CENTER.mask; public int getSlotMask()
} {
return PartMap.CENTER.mask;
@Override }
public int getHollowSize()
{ @Override
return isInsulated ? 8 : 6; public int getHollowSize()
} {
return isInsulated ? 8 : 6;
@Override }
public Cuboid6 getBounds()
{ @Override
return new Cuboid6(0.375, 0.375, 0.375, 0.625, 0.625, 0.625); 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)
{ @Override
return RenderPartWire.breakIcon; public Icon getBreakingIcon(Object subPart, int side)
} {
return RenderPartWire.breakIcon;
@Override }
public Icon getBrokenIcon(int side)
{ @Override
return RenderPartWire.breakIcon; public Icon getBrokenIcon(int side)
} {
return RenderPartWire.breakIcon;
@Override }
public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer)
{ @Override
IconHitEffects.addHitEffects(this, hit, effectRenderer); public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer)
} {
IconHitEffects.addHitEffects(this, hit, effectRenderer);
@Override }
public void addDestroyEffects(EffectRenderer effectRenderer)
{ @Override
IconHitEffects.addDestroyEffects(this, effectRenderer, false); public void addDestroyEffects(EffectRenderer effectRenderer)
} {
IconHitEffects.addDestroyEffects(this, effectRenderer, false);
@Override }
public void onPartChanged(TMultiPart part)
{ @Override
refresh(); public void onPartChanged(TMultiPart part)
} {
refresh();
public boolean isBlockedOnSide(ForgeDirection side) }
{
TMultiPart blocker = tile().partMap(side.ordinal()); public boolean isBlockedOnSide(ForgeDirection side)
testingSide = side; {
boolean expandable = NormalOcclusionTest.apply(this, blocker); TMultiPart blocker = tile().partMap(side.ordinal());
testingSide = null; testingSide = side;
return !expandable; 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()); public static boolean connectionMapContainsSide(byte connections, ForgeDirection side)
return ((connections & tester) > 0); {
} byte tester = (byte) (1 << side.ordinal());
return ((connections & tester) > 0);
@Override }
public void bind(TileMultipart t)
{ @Override
if (tile() != null && this.getNetwork() != null) public void bind(TileMultipart t)
{ {
getNetwork().getConnectors().remove(tile()); if (tile() != null && this.getNetwork() != null)
super.bind(t); {
getNetwork().getConnectors().add((IConductor) tile()); getNetwork().getConnectors().remove(tile());
} super.bind(t);
else getNetwork().getConnectors().add((IConductor) tile());
{ }
super.bind(t); else
} {
} super.bind(t);
}
/** }
* CONNECTION LOGIC CODE
*/ /**
* CONNECTION LOGIC CODE
public boolean canConnectBothSides(TileEntity tile, ForgeDirection side) */
{
boolean notPrevented = !isConnectionPrevented(tile, side); public boolean canConnectBothSides(TileEntity tile, ForgeDirection side)
{
if (tile instanceof IConductor) boolean notPrevented = !isConnectionPrevented(tile, side);
{
notPrevented &= ((IConductor) tile).canConnect(side.getOpposite()); if (tile instanceof IConductor)
} {
notPrevented &= ((IConductor) tile).canConnect(side.getOpposite());
return notPrevented; }
}
return notPrevented;
/** }
* Override if there are ways of preventing a connection
* /**
* @param tile The TileEntity on the given side * Override if there are ways of preventing a connection
* @param side The side we're checking *
* @return Whether we're preventing connections on given side or to given tileEntity * @param tile The TileEntity on the given side
*/ * @param side The side we're checking
public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side) * @return Whether we're preventing connections on given side or to given tileEntity
{ */
return (tile instanceof IConductor ? this.canConnectTo(tile) : false) || (isBlockedOnSide(side)); public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side)
// || tile instanceof IBlockableConnection && ((IBlockableConnection) {
// tile).isBlockedOnSide(side.getOpposite()))*/; return (tile instanceof IConductor ? this.canConnectTo(tile) : false) || (isBlockedOnSide(side));
} // || tile instanceof IBlockableConnection && ((IBlockableConnection)
// tile).isBlockedOnSide(side.getOpposite()))*/;
public byte getPossibleWireConnections() }
{
byte connections = 0x00; public byte getPossibleWireConnections()
{
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) byte connections = 0x00;
{
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side); for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
if (tileEntity instanceof IConductor && canConnectBothSides(tileEntity, side)) TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
{
connections |= 1 << side.ordinal(); if (tileEntity instanceof IConductor && canConnectBothSides(tileEntity, side))
} {
} connections |= 1 << side.ordinal();
}
return connections; }
}
return connections;
public byte getPossibleAcceptorConnections() }
{
byte connections = 0x00; public byte getPossibleAcceptorConnections()
{
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) byte connections = 0x00;
{
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side); for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
if (CompatibilityModule.canConnect(tileEntity, side.getOpposite()) && canConnectBothSides(tileEntity, side)) TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
{
connections |= 1 << side.ordinal(); if (CompatibilityModule.canConnect(tileEntity, side.getOpposite()) && canConnectBothSides(tileEntity, side))
} {
} connections |= 1 << side.ordinal();
}
return connections; }
}
return connections;
public void refresh() }
{
if (!world().isRemote) public void refresh()
{ {
byte possibleWireConnections = getPossibleWireConnections(); if (!world().isRemote)
byte possibleAcceptorConnections = getPossibleAcceptorConnections(); {
byte possibleWireConnections = getPossibleWireConnections();
if (possibleWireConnections != this.currentWireConnections) byte possibleAcceptorConnections = getPossibleAcceptorConnections();
{
byte or = (byte) (possibleWireConnections | this.currentWireConnections); if (possibleWireConnections != this.currentWireConnections)
{
// Connections have been removed byte or = (byte) (possibleWireConnections | this.currentWireConnections);
if (or != possibleWireConnections)
{ // Connections have been removed
try if (or != possibleWireConnections)
{ {
this.getNetwork().removeConnector(this); try
this.getNetwork().split((IConductor) tile()); {
} this.getNetwork().removeConnector(this);
catch (NullPointerException e) {} this.getNetwork().split((IConductor) tile());
this.setNetwork(null); }
} catch (NullPointerException e)
{
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) }
{ this.setNetwork(null);
if (connectionMapContainsSide(possibleWireConnections, side)) }
{
TileEntity tileEntity = VectorHelper.getConnectorFromSide(world(), new Vector3(tile()), side); for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
if (tileEntity instanceof IConductor) if (connectionMapContainsSide(possibleWireConnections, side))
{ {
this.getNetwork().merge(((IConductor) tileEntity).getNetwork()); TileEntity tileEntity = VectorHelper.getConnectorFromSide(world(), new Vector3(tile()), side);
}
} if (tileEntity instanceof IConductor)
} {
this.getNetwork().merge(((IConductor) tileEntity).getNetwork());
this.currentWireConnections = possibleWireConnections; }
} }
}
this.currentAcceptorConnections = possibleAcceptorConnections;
this.getNetwork().reconstruct(); this.currentWireConnections = possibleWireConnections;
this.sendConnectionUpdate(); }
}
this.currentAcceptorConnections = possibleAcceptorConnections;
tile().markRender(); this.getNetwork().reconstruct();
} this.sendConnectionUpdate();
}
/**
* Should include connections that are in the current connection maps even if those connections tile().markRender();
* aren't allowed any more. This is so that networks split correctly. }
*/
@Override /**
public TileEntity[] getConnections() * 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.
TileEntity[] connections = new TileEntity[6]; */
@Override
for (byte i = 0; i < 6; i++) public TileEntity[] getConnections()
{ {
ForgeDirection side = ForgeDirection.getOrientation(i); TileEntity[] connections = new TileEntity[6];
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
for (byte i = 0; i < 6; i++)
if (isCurrentlyConnected(side)) {
{ ForgeDirection side = ForgeDirection.getOrientation(i);
connections[i] = tileEntity; TileEntity tileEntity = VectorHelper.getTileEntityFromSide(world(), new Vector3(tile()), side);
}
} if (isCurrentlyConnected(side))
{
return connections; connections[i] = tileEntity;
} }
}
public boolean isCurrentlyConnected(ForgeDirection side)
{ return connections;
return connectionMapContainsSide(getAllCurrentConnections(), side); }
}
public boolean isCurrentlyConnected(ForgeDirection side)
/** {
* Shouldn't need to be overridden. Override connectionPrevented instead return connectionMapContainsSide(getAllCurrentConnections(), side);
*/ }
@Override
public boolean canConnect(ForgeDirection direction) /**
{ * Shouldn't need to be overridden. Override connectionPrevented instead
if (world().isBlockIndirectlyGettingPowered(x(), y(), z())) */
{ @Override
return false; public boolean canConnect(ForgeDirection direction)
} {
if (world().isBlockIndirectlyGettingPowered(x(), y(), z()))
Vector3 connectPos = new Vector3(tile()).modifyPositionFromSide(direction); {
TileEntity connectTile = connectPos.getTileEntity(world()); return false;
return !isConnectionPrevented(connectTile, direction); }
}
Vector3 connectPos = new Vector3(tile()).modifyPositionFromSide(direction);
@Override TileEntity connectTile = connectPos.getTileEntity(world());
public void onAdded() return !isConnectionPrevented(connectTile, direction);
{ }
super.onAdded();
refresh(); @Override
} public void onAdded()
{
@Override super.onAdded();
public void onMoved() refresh();
{ }
this.refresh();
} @Override
public void onMoved()
@Override {
public void onChunkLoad() this.refresh();
{ }
super.onChunkLoad();
refresh(); @Override
} public void onChunkLoad()
{
@Override super.onChunkLoad();
public void onNeighborChanged() refresh();
{ }
super.onNeighborChanged();
refresh(); @Override
} public void onNeighborChanged()
{
/** super.onNeighborChanged();
* Packets refresh();
*/ }
public void sendConnectionUpdate()
{ /**
tile().getWriteStream(this).writeByte(0).writeByte(this.currentWireConnections).writeByte(this.currentAcceptorConnections); * Packets
} */
public void sendConnectionUpdate()
@Override {
public void readDesc(MCDataInput packet) tile().getWriteStream(this).writeByte(0).writeByte(this.currentWireConnections).writeByte(this.currentAcceptorConnections);
{ }
super.readDesc(packet);
this.currentWireConnections = packet.readByte(); @Override
this.currentAcceptorConnections = packet.readByte(); public void readDesc(MCDataInput packet)
} {
super.readDesc(packet);
@Override this.currentWireConnections = packet.readByte();
public void writeDesc(MCDataOutput packet) this.currentAcceptorConnections = packet.readByte();
{ }
super.writeDesc(packet);
packet.writeByte(this.currentWireConnections); @Override
packet.writeByte(this.currentAcceptorConnections); public void writeDesc(MCDataOutput packet)
} {
super.writeDesc(packet);
@Override packet.writeByte(this.currentWireConnections);
public void read(MCDataInput packet) packet.writeByte(this.currentAcceptorConnections);
{ }
read(packet, packet.readUByte());
} @Override
public void read(MCDataInput packet)
@Override {
public void read(MCDataInput packet, int packetID) read(packet, packet.readUByte());
{ }
if (packetID == 0)
{ @Override
this.currentWireConnections = packet.readByte(); public void read(MCDataInput packet, int packetID)
this.currentAcceptorConnections = packet.readByte(); {
tile().markRender(); if (packetID == 0)
} {
else this.currentWireConnections = packet.readByte();
{ this.currentAcceptorConnections = packet.readByte();
super.read(packet, packetID); tile().markRender();
} }
} else
{
public void copyFrom(PartFramedWire otherCable) super.read(packet, packetID);
{ }
this.isInsulated = otherCable.isInsulated; }
this.color = otherCable.color;
this.connections = otherCable.connections; public void copyFrom(PartFramedWire otherCable)
this.material = otherCable.material; {
this.currentWireConnections = otherCable.currentWireConnections; this.isInsulated = otherCable.isInsulated;
this.currentAcceptorConnections = otherCable.currentAcceptorConnections; this.color = otherCable.color;
this.setNetwork(otherCable.getNetwork()); this.connections = otherCable.connections;
this.getNetwork().setBufferFor(this, otherCable.getNetwork().getBufferOf(otherCable)); this.material = otherCable.material;
} this.currentWireConnections = otherCable.currentWireConnections;
this.currentAcceptorConnections = otherCable.currentAcceptorConnections;
this.setNetwork(otherCable.getNetwork());
this.getNetwork().setBufferFor(this, otherCable.getNetwork().getBufferOf(otherCable));
}
} }

View file

@ -34,7 +34,7 @@ tooltip.transformer.stepDown=Step Down
tooltip.wire.resistance=Resistance: %v tooltip.wire.resistance=Resistance: %v
tooltip.wire.current=Current: %v tooltip.wire.current=Current: %v
tooltip.wire.damage=Damage: %v tooltip.wire.damage=Damage: %v
tooltip.wire.helpText=The energy transfer rate can be increased and the energy loss may be reduced by using a higher the voltage. tooltip.wire.helpText=The energy transfer rate can be increased and the energy loss may be reduced by using a higher the voltage. Hold control when placing the wire to place down a framed wire.
# %0 goes before the localized name of the shift key, %1 goes after # %0 goes before the localized name of the shift key, %1 goes after
tooltip.noShift=Hold %0shift %1for more information" tooltip.noShift=Hold %0shift %1for more information"
# %0 is the color for the charge level, %1 is grey to reset it back to normal (optional), %v0 is the current charge, %v1 is the max charge # %0 is the color for the charge level, %1 is grey to reset it back to normal (optional), %v0 is the current charge, %v1 is the max charge