Logistical Transporters now render color in glass instead of frame

This commit is contained in:
Aidan C. Brady 2015-03-31 08:47:40 -04:00
parent c85bdcd8ab
commit 413fac32fa
19 changed files with 156 additions and 78 deletions

View file

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.client.model.ModelTransporterBox;
import mekanism.client.render.MekanismRenderer.DisplayInteger;
import mekanism.client.render.MekanismRenderer.Model3D;
@ -144,7 +145,17 @@ public class RenderPartTransmitter implements IIconSelfRegister
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
renderSide(side, type);
renderSide(side, type, false);
}
CCRenderState.draw();
CCRenderState.reset();
CCRenderState.startDrawing();
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
renderSide(side, type, true);
}
CCRenderState.draw();
@ -512,7 +523,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
pop();
}
public void renderStatic(PartSidedPipe transmitter)
public void renderStatic(PartSidedPipe transmitter, int pass)
{
CCRenderState.reset();
CCRenderState.hasColour = true;
@ -520,29 +531,49 @@ public class RenderPartTransmitter implements IIconSelfRegister
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
renderSide(side, transmitter);
renderSide(side, transmitter, pass);
}
}
public void renderSide(ForgeDirection side, PartSidedPipe transmitter)
public void renderSide(ForgeDirection side, PartSidedPipe transmitter, int pass)
{
IIcon renderIcon = transmitter.getIconForSide(side);
Colour c = null;
if(transmitter.getRenderColor() != null)
if(pass == 1)
{
c = new ColourRGBA(transmitter.getRenderColor().getColor(0), transmitter.getRenderColor().getColor(1), transmitter.getRenderColor().getColor(2), 1);
if(transmitter.transparencyRender())
{
IIcon renderIcon = transmitter.getIconForSide(side, false);
EnumColor color = transmitter.getRenderColor(false);
Colour c = null;
if(color != null)
{
c = new ColourRGBA(color.getColor(0), color.getColor(1), color.getColor(2), 1);
}
renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z(), c);
}
}
else {
IIcon renderIcon = transmitter.getIconForSide(side, true);
EnumColor color = transmitter.getRenderColor(true);
Colour c = null;
if(color != null)
{
c = new ColourRGBA(color.getColor(0), color.getColor(1), color.getColor(2), 1);
}
renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z(), c);
}
renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z(), c);
}
public void renderSide(ForgeDirection side, TransmitterType type)
public void renderSide(ForgeDirection side, TransmitterType type, boolean opaque)
{
boolean out = side == ForgeDirection.UP || side == ForgeDirection.DOWN;
IIcon renderIcon = out ? type.getSideIcon() : type.getCenterIcon();
IIcon renderIcon = out ? type.getSideIcon(opaque) : type.getCenterIcon(opaque);
renderPart(renderIcon, getItemModel(side, type), 0, 0, 0, null);
}

View file

@ -35,7 +35,7 @@ public class PartDiversionTransporter extends PartLogisticalTransporter
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return transporterIcons.getCenterIcon(2);
}

View file

@ -157,19 +157,19 @@ public class PartHeatTransmitter extends PartTransmitter<HeatNetwork> implements
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return heatIcons.getCenterIcon(0);
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return heatIcons.getSideIcon(0);
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return heatIcons.getSideIcon(1);
}

View file

@ -45,7 +45,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork> implements ILogisticalTransporter
{
public static TransmitterIcons transporterIcons = new TransmitterIcons(3, 4);
public static TransmitterIcons transporterIcons = new TransmitterIcons(5, 8);
public static final int SPEED = 5;
@ -77,8 +77,9 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
public static void registerIcons(IIconRegister register)
{
transporterIcons.registerCenterIcons(register, new String[] {"LogisticalTransporter", "RestrictiveTransporter", "DiversionTransporter"});
transporterIcons.registerSideIcons(register, new String[] {"LogisticalTransporterVertical", "LogisticalTransporterHorizontal", "RestrictiveTransporterVertical", "RestrictiveTransporterHorizontal"});
transporterIcons.registerCenterIcons(register, new String[] {"LogisticalTransporter", "RestrictiveTransporter", "DiversionTransporter", "LogisticalTransporterGlass", "LogisticalTransporterGlassColored"});
transporterIcons.registerSideIcons(register, new String[] {"LogisticalTransporterVertical", "LogisticalTransporterHorizontal", "RestrictiveTransporterVertical", "RestrictiveTransporterHorizontal",
"LogisticalTransporterVerticalGlass", "LogisticalTransporterVerticalGlassColored", "LogisticalTransporterHorizontalGlass", "LogisticalTransporterHorizontalGlassColored"});
}
@Override
@ -116,21 +117,21 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return transporterIcons.getCenterIcon(0);
return transporterIcons.getCenterIcon(opaque ? 0 : (color != null ? 4 : 3));
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return transporterIcons.getSideIcon(0);
return transporterIcons.getSideIcon(opaque ? 0 : (color != null ? 5 : 4));
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return transporterIcons.getSideIcon(1);
return transporterIcons.getSideIcon(opaque ? 1 : (color != null ? 7 : 6));
}
@Override
@ -675,9 +676,15 @@ public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork>
}
@Override
public EnumColor getRenderColor()
public EnumColor getRenderColor(boolean post)
{
return color;
return post ? null : color;
}
@Override
public boolean transparencyRender()
{
return true;
}
@Override

View file

@ -206,19 +206,19 @@ public class PartMechanicalPipe extends PartTransmitter<FluidNetwork> implements
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return pipeIcons.getCenterIcon(tier.ordinal());
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return pipeIcons.getSideIcon(0);
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return pipeIcons.getSideIcon(1);
}

View file

@ -204,19 +204,19 @@ public class PartPressurizedTube extends PartTransmitter<GasNetwork> implements
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return tubeIcons.getCenterIcon(0);
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return tubeIcons.getSideIcon(0);
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return tubeIcons.getSideIcon(1);
}

View file

@ -1,5 +1,6 @@
package mekanism.common.multipart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.IIcon;
public class PartRestrictiveTransporter extends PartLogisticalTransporter
@ -17,19 +18,19 @@ public class PartRestrictiveTransporter extends PartLogisticalTransporter
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return transporterIcons.getCenterIcon(1);
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return transporterIcons.getSideIcon(2);
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return transporterIcons.getSideIcon(3);
}
@ -39,4 +40,16 @@ public class PartRestrictiveTransporter extends PartLogisticalTransporter
{
return 1000;
}
@Override
public boolean transparencyRender()
{
return false;
}
@Override
protected boolean onConfigure(EntityPlayer player, int part, int side)
{
return false;
}
}

View file

@ -130,11 +130,11 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
return (connections & tester) > 0;
}
public abstract IIcon getCenterIcon();
public abstract IIcon getCenterIcon(boolean opaque);
public abstract IIcon getSideIcon();
public abstract IIcon getSideIcon(boolean opaque);
public abstract IIcon getSideIconRotated();
public abstract IIcon getSideIconRotated(boolean opaque);
@Override
public void update()
@ -168,8 +168,13 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
return false;
}
public boolean transparencyRender()
{
return false;
}
public IIcon getIconForSide(ForgeDirection side)
public IIcon getIconForSide(ForgeDirection side, boolean opaque)
{
ConnectionType type = getConnectionType(side);
@ -177,29 +182,29 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
if(client.oldTransmitterRender || renderCenter())
{
return getCenterIcon();
return getCenterIcon(opaque);
}
else if(getAllCurrentConnections() == 3 && side != ForgeDirection.DOWN && side != ForgeDirection.UP)
{
return getSideIcon();
return getSideIcon(opaque);
}
else if(getAllCurrentConnections() == 12 && (side == ForgeDirection.DOWN || side == ForgeDirection.UP))
{
return getSideIcon();
return getSideIcon(opaque);
}
else if(getAllCurrentConnections() == 12 && (side == ForgeDirection.EAST || side == ForgeDirection.WEST))
{
return getSideIconRotated();
return getSideIconRotated(opaque);
}
else if(getAllCurrentConnections() == 48 && side != ForgeDirection.EAST && side != ForgeDirection.WEST)
{
return getSideIconRotated();
return getSideIconRotated(opaque);
}
return getCenterIcon();
return getCenterIcon(opaque);
}
else {
return getSideIcon();
return getSideIcon(opaque);
}
}
@ -319,13 +324,13 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
@Override
public IIcon getBreakingIcon(Object subPart, int side)
{
return getCenterIcon();
return getCenterIcon(true);
}
@Override
public IIcon getBrokenIcon(int side)
{
return getCenterIcon();
return getCenterIcon(true);
}
@Override
@ -353,7 +358,12 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
{
if(pass == 0)
{
RenderPartTransmitter.getInstance().renderStatic(this);
RenderPartTransmitter.getInstance().renderStatic(this, pass);
return true;
}
else if(pass == 1 && transparencyRender())
{
RenderPartTransmitter.getInstance().renderStatic(this, pass);
return true;
}
@ -685,7 +695,7 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
return false;
}
public EnumColor getRenderColor()
public EnumColor getRenderColor(boolean opaque)
{
return null;
}

View file

@ -193,19 +193,19 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
}
@Override
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return cableIcons.getCenterIcon(tier.ordinal());
}
@Override
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return cableIcons.getSideIcon(0);
}
@Override
public IIcon getSideIconRotated()
public IIcon getSideIconRotated(boolean opaque)
{
return cableIcons.getSideIcon(1);
}

View file

@ -6,35 +6,35 @@ import net.minecraft.util.IIcon;
public enum TransmitterType
{
UNIVERSAL_CABLE_BASIC("BasicUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, 0, 0),
UNIVERSAL_CABLE_ADVANCED("AdvancedUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, 1, 0),
UNIVERSAL_CABLE_ELITE("EliteUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, 2, 0),
UNIVERSAL_CABLE_ULTIMATE("UltimateUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, 3, 0),
MECHANICAL_PIPE_BASIC("BasicMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, 0, 0),
MECHANICAL_PIPE_ADVANCED("AdvancedMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, 0, 0),
MECHANICAL_PIPE_ELITE("EliteMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, 0, 0),
MECHANICAL_PIPE_ULTIMATE("UltimateMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, 0, 0),
PRESSURIZED_TUBE("PressurizedTube", Size.SMALL, TransmissionType.GAS, PartPressurizedTube.tubeIcons, 0, 0),
LOGISTICAL_TRANSPORTER("LogisticalTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, 0, 0),
RESTRICTIVE_TRANSPORTER("RestrictiveTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, 1, 2),
DIVERSION_TRANSPORTER("DiversionTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, 2, 0),
HEAT_TRANSMITTER("HeatTransmitter", Size.SMALL, TransmissionType.HEAT, PartHeatTransmitter.heatIcons, 0, 0);
UNIVERSAL_CABLE_BASIC("BasicUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, false, 0, 0),
UNIVERSAL_CABLE_ADVANCED("AdvancedUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, false, 1, 0),
UNIVERSAL_CABLE_ELITE("EliteUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, false, 2, 0),
UNIVERSAL_CABLE_ULTIMATE("UltimateUniversalCable", Size.SMALL, TransmissionType.ENERGY, PartUniversalCable.cableIcons, false, 3, 0),
MECHANICAL_PIPE_BASIC("BasicMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 0, 0),
MECHANICAL_PIPE_ADVANCED("AdvancedMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 0, 0),
MECHANICAL_PIPE_ELITE("EliteMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 0, 0),
MECHANICAL_PIPE_ULTIMATE("UltimateMechanicalPipe", Size.LARGE, TransmissionType.FLUID, PartMechanicalPipe.pipeIcons, false, 0, 0),
PRESSURIZED_TUBE("PressurizedTube", Size.SMALL, TransmissionType.GAS, PartPressurizedTube.tubeIcons, false, 0, 0),
LOGISTICAL_TRANSPORTER("LogisticalTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 0, 0, 3, 4),
RESTRICTIVE_TRANSPORTER("RestrictiveTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, false, 1, 2),
DIVERSION_TRANSPORTER("DiversionTransporter", Size.LARGE, TransmissionType.ITEM, PartLogisticalTransporter.transporterIcons, true, 2, 0, 3, 4),
HEAT_TRANSMITTER("HeatTransmitter", Size.SMALL, TransmissionType.HEAT, PartHeatTransmitter.heatIcons, false, 0, 0);
private String unlocalizedName;
private Size size;
private TransmissionType transmissionType;
private TransmitterIcons transmitterIcons;
private int centerIndex;
private int sideIndex;
private boolean transparencyRender;
private int[] indexes;
private TransmitterType(String name, Size s, TransmissionType type, TransmitterIcons icons, int center, int side)
private TransmitterType(String name, Size s, TransmissionType type, TransmitterIcons icons, boolean transparency, int... is)
{
unlocalizedName = name;
size = s;
transmissionType = type;
transmitterIcons = icons;
centerIndex = center;
sideIndex = side;
transparencyRender = transparency;
indexes = is;
}
public String getName()
@ -46,20 +46,37 @@ public enum TransmitterType
{
return size;
}
public boolean hasTransparency()
{
return transparencyRender;
}
public TransmissionType getTransmission()
{
return transmissionType;
}
public IIcon getCenterIcon()
public IIcon getCenterIcon(boolean opaque)
{
return transmitterIcons.getCenterIcon(centerIndex);
if(!transparencyRender)
{
return transmitterIcons.getCenterIcon(indexes[0]);
}
else {
return transmitterIcons.getCenterIcon(opaque ? indexes[0] : indexes[2]);
}
}
public IIcon getSideIcon()
public IIcon getSideIcon(boolean opaque)
{
return transmitterIcons.getSideIcon(sideIndex);
if(!transparencyRender)
{
return transmitterIcons.getSideIcon(indexes[1]);
}
else {
return transmitterIcons.getSideIcon(opaque ? indexes[1] : indexes[3]);
}
}
public static enum Size

Binary file not shown.

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB