Got colors working, need to fix connections

This commit is contained in:
Aidan Brady 2013-12-20 21:05:44 -05:00
parent 2cf6fdc18c
commit d3661b3cd8
6 changed files with 30 additions and 39 deletions

View file

@ -28,6 +28,9 @@ public enum TransmissionType
{
return true;
}
else {
System.out.println(((ITransmitter)sideTile).getTransmissionType());
}
}
if(this == GAS && currentTile instanceof IGasTransmitter)

View file

@ -476,12 +476,14 @@ public class RenderPartTransmitter implements IIconRegister
boolean connected = PartTransmitter.connectionMapContainsSide(transmitter.getAllCurrentConnections(), side);
Icon renderIcon = transmitter.getIconForSide(side);
Colour c = null;
if(transmitter.getRenderColor() != null)
{
GL11.glColor4f(transmitter.getRenderColor().getColor(0), transmitter.getRenderColor().getColor(1), transmitter.getRenderColor().getColor(2), 1.0F);
c = new ColourRGBA(transmitter.getRenderColor().getColor(0), transmitter.getRenderColor().getColor(1), transmitter.getRenderColor().getColor(2), 1);
}
renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z());
renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z(), c);
}
public void renderEnergySide(ForgeDirection side, PartUniversalCable cable)
@ -496,9 +498,9 @@ public class RenderPartTransmitter implements IIconRegister
renderTransparency(tube.getTransmitterNetwork().refGas.getIcon(), tube.getModelForSide(side, true), new ColourRGBA(1.0, 1.0, 1.0, tube.currentScale));
}
public void renderPart(Icon icon, CCModel cc, double x, double y, double z)
public void renderPart(Icon icon, CCModel cc, double x, double y, double z, Colour color)
{
cc.render(0, cc.verts.length, new Translation(x, y, z), new IconTransformation(icon), null);
cc.render(0, cc.verts.length, new Translation(x, y, z), new IconTransformation(icon), color != null ? new ColourMultiplier(color) : null);
}
public void renderTransparency(Icon icon, CCModel cc, Colour colour)

View file

@ -4,9 +4,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import mekanism.api.EnumColor;
import mekanism.api.Coord4D;
import mekanism.common.EntityBalloon;
import mekanism.api.EnumColor;
import mekanism.common.IConfigurable;
import mekanism.common.IInvConfiguration;
import mekanism.common.PacketHandler;
@ -63,8 +62,6 @@ public class ItemConfigurator extends ItemEnergized implements IToolWrench
{
if(!world.isRemote)
{
world.spawnEntityInWorld(new EntityBalloon(world, x, y, z, EnumColor.RED));
TileEntity tile = world.getBlockTileEntity(x, y, z);
if(tile instanceof IConfigurable)

View file

@ -113,12 +113,6 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
{
connections |= 1 << side.ordinal();
}
else {
System.out.println("Invalid type " + getTransmitter().getType());
}
}
else {
System.out.println("can't connect");
}
}
@ -449,6 +443,8 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
{
int c = dataStream.readInt();
EnumColor prev = color;
if(c != -1)
{
color = TransporterUtils.colors.get(c);
@ -457,6 +453,11 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti
color = null;
}
if(prev != color)
{
tile().markRender();
}
transit.clear();
int amount = dataStream.readInt();

View file

@ -67,13 +67,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
public boolean sendDesc = false;
public boolean redstonePowered = false;
public ConnectionType[] connectionTypes = {ConnectionType.NORMAL,
ConnectionType.NORMAL,
ConnectionType.NORMAL,
ConnectionType.NORMAL,
ConnectionType.NORMAL,
ConnectionType.NORMAL
};
public ConnectionType[] connectionTypes = {ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL};
static
{
@ -141,7 +135,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
}
}
if(sendDesc)
if(sendDesc && !world().isRemote)
{
sendDescUpdate();
sendDesc = false;
@ -456,6 +450,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
if(!world().isRemote)
{
System.out.println("send desc");
currentTransmitterConnections = possibleTransmitters;
currentAcceptorConnections = possibleAcceptors;
@ -593,6 +588,16 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
return false;
}
public boolean canConnectToAcceptor(ForgeDirection side)
{
if(!isValidAcceptor(Coord4D.get(tile()).getFromSide(side).getTileEntity(world()), side))
{
return false;
}
return getConnectionType(side) == ConnectionType.NORMAL || getConnectionType(side) == ConnectionType.PUSH;
}
public static enum ConnectionType
{

View file

@ -36,12 +36,6 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa
super.bind(t);
}
}
public static boolean connectionMapContainsSide(byte connections, ForgeDirection side)
{
byte tester = (byte)(1 << side.ordinal());
return (connections & tester) > 0;
}
@Override
public void refreshTransmitterNetwork()
@ -233,15 +227,4 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa
@Override
public void chunkLoad() {}
@Override
public boolean canConnectToAcceptor(ForgeDirection side)
{
if(!isValidAcceptor(Coord4D.get(tile()).getFromSide(side).getTileEntity(world()), side))
{
return false;
}
return getConnectionType(side) == ConnectionType.NORMAL || getConnectionType(side) == ConnectionType.PUSH;
}
}