Minor color and texture tweak

This commit is contained in:
Calclavia 2013-12-22 13:24:55 +08:00
parent b5e4fa9fc0
commit 8c63bbb457
3 changed files with 57 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -19,7 +19,7 @@ public enum EnumWireMaterial
COPPER("Copper", 12.5F, 3, 20, 184, 115, 51), TIN("Tin", 13, 2, 5, 132, 132, 130),
IRON("Iron", 0.1F, 20, 40, 97, 102, 105), ALUMINUM("Aluminum", 0.025F, 6, 150, 215, 205, 181),
SILVER("Silver", 5F, 1, 20, 192, 192, 192),
SUPERCONDUCTOR("Superconductor", 0, 1, 100, 192, 192, 192);
SUPERCONDUCTOR("Superconductor", 0, 1, 100, 255, 255, 1);
public final float resistance;
public final int damage;

View file

@ -143,7 +143,6 @@ public class FlatWire extends PartWireBase implements TFacePart, JNormalOcclusio
@Override
public void read(MCDataInput packet)
{
super.read(packet);
read(packet, packet.readUByte());
}
@ -158,9 +157,12 @@ public class FlatWire extends PartWireBase implements TFacePart, JNormalOcclusio
public void sendConnUpdate()
{
tile().getWriteStream(this).writeByte(0).writeInt(connMap);
tile().getWriteStream(this).writeByte(0).writeInt(this.connMap);
}
/**
* WORLD EVENTS
*/
@Override
public void onRemoved()
{
@ -196,13 +198,54 @@ public class FlatWire extends PartWireBase implements TFacePart, JNormalOcclusio
connMap = 0;
updateInternalConnections();
if (updateOpenConnections())
{
updateExternalConnections();
}
tile().markDirty();
}
}
@Override
public void onAdded()
{
super.onAdded();
if (!world().isRemote)
{
updateOpenConnections();
boolean changed = updateInternalConnections();
// don't use || because it's fail fast
changed |= updateExternalConnections();
if (changed)
{
sendConnUpdate();
this.getNetwork().reconstruct();
}
}
}
@Override
public void onNeighborChanged()
{
if (!world().isRemote)
{
if (dropIfCantStay())
{
return;
}
if (updateExternalConnections())
{
sendConnUpdate();
this.getNetwork().reconstruct();
}
}
}
public boolean canStay()
{
BlockCoord pos = new BlockCoord(tile()).offset(side);
@ -233,13 +276,18 @@ public class FlatWire extends PartWireBase implements TFacePart, JNormalOcclusio
protected boolean updateExternalConnections()
{
int newConn = 0;
for (int r = 0; r < 4; r++)
{
if (!maskOpen(r))
/*if (!maskOpen(r))
{
continue;
}*/
if (connectStraight(r))
{
newConn |= 0x10 << r;
}
else
{
int cnrMode = connectCorner(r);
@ -315,7 +363,7 @@ public class FlatWire extends PartWireBase implements TFacePart, JNormalOcclusio
{
int absDir = Rotation.rotateSide(side, r);
TMultiPart facePart = tile().partMap(absDir);
if (facePart != null && (!(facePart instanceof FlatWire) || !canConnectToType((FlatWire) facePart)))
if (facePart != null && (!(facePart instanceof FlatWire) || !canConnect((FlatWire) facePart)))
return false;
if (tile().partMap(PartMap.edgeBetween(side, absDir)) != null)
@ -436,7 +484,7 @@ public class FlatWire extends PartWireBase implements TFacePart, JNormalOcclusio
public boolean connectCorner(IAdvancedConductor wire, int r)
{
if (canConnectToType(wire) && maskOpen(r))
if (canConnect(wire) && maskOpen(r))
{
int oldConn = connMap;
connMap |= 0x1 << r;
@ -452,7 +500,7 @@ public class FlatWire extends PartWireBase implements TFacePart, JNormalOcclusio
public boolean connectStraight(IAdvancedConductor wire, int r)
{
if (canConnectToType(wire) && maskOpen(r))
if (canConnect(wire) && maskOpen(r))
{
int oldConn = connMap;
connMap |= 0x10 << r;
@ -465,7 +513,7 @@ public class FlatWire extends PartWireBase implements TFacePart, JNormalOcclusio
public boolean connectInternal(IAdvancedConductor wire, int r)
{
if (canConnectToType(wire))
if (canConnect(wire))
{
int oldConn = connMap;
connMap |= 0x100 << r;
@ -583,7 +631,7 @@ public class FlatWire extends PartWireBase implements TFacePart, JNormalOcclusio
public boolean useStaticRenderer()
{
return false;
return true;
}
@Override