make facades and gates use IPipePluggable rendering APIs
This commit is contained in:
parent
64879212fe
commit
580886a8cc
|
@ -0,0 +1,9 @@
|
|||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface IPipePluggableDynamicRenderer {
|
||||
void renderPluggable(IPipe pipe, ForgeDirection side, PipePluggable pipePluggable, double x, double y, double z);
|
||||
}
|
|
@ -56,6 +56,11 @@ public abstract class PipePluggable implements INBTStoreable, ISerializable {
|
|||
@SideOnly(Side.CLIENT)
|
||||
public abstract IPipePluggableRenderer getRenderer();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IPipePluggableDynamicRenderer getDynamicRenderer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean requiresRenderUpdate(PipePluggable old) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3,19 +3,38 @@ package buildcraft.transport;
|
|||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.render.ITextureStates;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.pluggable.IFacadePluggable;
|
||||
import buildcraft.api.transport.pluggable.IPipePluggableRenderer;
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
import buildcraft.core.lib.utils.MatrixTranformations;
|
||||
import buildcraft.transport.render.FacadeRenderHelper;
|
||||
|
||||
public class FacadePluggable extends PipePluggable implements IFacadePluggable {
|
||||
public static class FacadePluggableRenderer implements IPipePluggableRenderer {
|
||||
public static final IPipePluggableRenderer INSTANCE = new FacadePluggableRenderer();
|
||||
private static final float zFightOffset = 1 / 4096.0F;
|
||||
|
||||
private FacadePluggableRenderer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderPluggable(RenderBlocks renderblocks, IPipe pipe, ForgeDirection side, PipePluggable pipePluggable, ITextureStates blockStateMachine, int renderPass, int x, int y, int z) {
|
||||
FacadeRenderHelper.pipeFacadeRenderer(renderblocks, blockStateMachine, pipe.getTile(), x, y, z, side, (IFacadePluggable) pipePluggable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ItemFacade.FacadeState[] states;
|
||||
private ItemFacade.FacadeState activeState;
|
||||
|
||||
|
@ -113,7 +132,7 @@ public class FacadePluggable extends PipePluggable implements IFacadePluggable {
|
|||
|
||||
@Override
|
||||
public IPipePluggableRenderer getRenderer() {
|
||||
return null;
|
||||
return FacadePluggableRenderer.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -799,7 +799,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
return pluggable.isBlocking(this, side);
|
||||
}
|
||||
|
||||
private void computeConnections() {
|
||||
protected void computeConnections() {
|
||||
TileBuffer[] cache = getTileCache();
|
||||
if (cache == null) {
|
||||
return;
|
||||
|
@ -941,7 +941,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
return true;
|
||||
}
|
||||
|
||||
private void updateCoreState() {
|
||||
protected void updateCoreState() {
|
||||
}
|
||||
|
||||
public boolean hasEnabledFacade(ForgeDirection direction) {
|
||||
|
|
|
@ -14,15 +14,30 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
import buildcraft.api.gates.GateExpansions;
|
||||
import buildcraft.api.gates.IGateExpansion;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.pluggable.IPipePluggableDynamicRenderer;
|
||||
import buildcraft.api.transport.pluggable.IPipePluggableRenderer;
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.lib.utils.MatrixTranformations;
|
||||
import buildcraft.transport.Gate;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
import buildcraft.transport.render.PipeRendererTESR;
|
||||
|
||||
public class GatePluggable extends PipePluggable {
|
||||
private static class GatePluggableRenderer implements IPipePluggableDynamicRenderer {
|
||||
public static final IPipePluggableDynamicRenderer INSTANCE = new GatePluggableRenderer();
|
||||
|
||||
private GatePluggableRenderer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderPluggable(IPipe pipe, ForgeDirection side, PipePluggable pipePluggable, double x, double y, double z) {
|
||||
PipeRendererTESR.renderGate(x, y, z, (GatePluggable) pipePluggable, side);
|
||||
}
|
||||
}
|
||||
public GateDefinition.GateMaterial material;
|
||||
public GateDefinition.GateLogic logic;
|
||||
public IGateExpansion[] expansions;
|
||||
|
@ -211,12 +226,16 @@ public class GatePluggable extends PipePluggable {
|
|||
return AxisAlignedBB.getBoundingBox(bounds[0][0], bounds[1][0], bounds[2][0], bounds[0][1], bounds[1][1], bounds[2][1]);
|
||||
}
|
||||
|
||||
// TODO: Port Gates to the Pluggable render system
|
||||
@Override
|
||||
public IPipePluggableRenderer getRenderer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPipePluggableDynamicRenderer getDynamicRenderer() {
|
||||
return GatePluggableRenderer.INSTANCE;
|
||||
}
|
||||
|
||||
public float getPulseStage() {
|
||||
return pulseStage;
|
||||
}
|
||||
|
|
|
@ -28,9 +28,14 @@ public class LensPluggable extends PipePluggable {
|
|||
protected IPipeTile container;
|
||||
private ForgeDirection side;
|
||||
|
||||
public class LensPluggableRenderer implements IPipePluggableRenderer {
|
||||
private static class LensPluggableRenderer implements IPipePluggableRenderer {
|
||||
public static final IPipePluggableRenderer INSTANCE = new LensPluggableRenderer();
|
||||
private static final float zFightOffset = 1 / 4096.0F;
|
||||
|
||||
private LensPluggableRenderer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderPluggable(RenderBlocks renderblocks, IPipe pipe, ForgeDirection side, PipePluggable pipePluggable, ITextureStates blockStateMachine, int renderPass, int x, int y, int z) {
|
||||
float[][] zeroState = new float[3][2];
|
||||
|
@ -53,7 +58,7 @@ public class LensPluggable extends PipePluggable {
|
|||
blockStateMachine.getTextureState().set(BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeLensOverlay.ordinal()));
|
||||
((FakeBlock) blockStateMachine).setColor(ColorUtils.getRGBColor(15 - ((LensPluggable) pipePluggable).color));
|
||||
} else {
|
||||
if (isFilter) {
|
||||
if (((LensPluggable) pipe).isFilter) {
|
||||
blockStateMachine.getTextureState().set(BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeFilter.ordinal()));
|
||||
} else {
|
||||
blockStateMachine.getTextureState().set(BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeLens.ordinal()));
|
||||
|
@ -120,7 +125,7 @@ public class LensPluggable extends PipePluggable {
|
|||
|
||||
@Override
|
||||
public IPipePluggableRenderer getRenderer() {
|
||||
return new LensPluggableRenderer();
|
||||
return LensPluggableRenderer.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,8 @@ import buildcraft.core.lib.utils.MatrixTranformations;
|
|||
import buildcraft.transport.PipeIconProvider;
|
||||
|
||||
public class PlugPluggable extends PipePluggable {
|
||||
public class PlugPluggableRenderer implements IPipePluggableRenderer {
|
||||
private static final class PlugPluggableRenderer implements IPipePluggableRenderer {
|
||||
public static final IPipePluggableRenderer INSTANCE = new PlugPluggableRenderer();
|
||||
private float zFightOffset = 1 / 4096.0F;
|
||||
|
||||
@Override
|
||||
|
@ -109,7 +110,7 @@ public class PlugPluggable extends PipePluggable {
|
|||
|
||||
@Override
|
||||
public IPipePluggableRenderer getRenderer() {
|
||||
return new PlugPluggableRenderer();
|
||||
return PlugPluggableRenderer.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,15 +16,13 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.render.ITextureStates;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.pluggable.IFacadePluggable;
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.lib.render.FakeBlock;
|
||||
import buildcraft.core.lib.render.TextureStateManager;
|
||||
import buildcraft.core.lib.utils.MatrixTranformations;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.PipeRenderState;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
import buildcraft.transport.TransportConstants;
|
||||
|
||||
public final class FacadeRenderHelper {
|
||||
|
@ -96,145 +94,118 @@ public final class FacadeRenderHelper {
|
|||
rotated[2][1] - zOffsets[side.ordinal()]);
|
||||
}
|
||||
|
||||
public static void pipeFacadeRenderer(RenderBlocks renderblocks, ITextureStates blockStateMachine, TileGenericPipe tile, PipeRenderState state, int x, int y, int z) {
|
||||
public static void pipeFacadeRenderer(RenderBlocks renderblocks, ITextureStates blockStateMachine, IPipeTile tile, int x, int y, int z, ForgeDirection direction, IFacadePluggable pluggable) {
|
||||
ITextureStates textureManager = blockStateMachine;
|
||||
IIcon[] textures = ((TextureStateManager) textureManager.getTextureState()).popArray();
|
||||
|
||||
//block_statemachine.setRenderAllSides();
|
||||
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (!(tile.getPipePluggable(direction) instanceof IFacadePluggable)) {
|
||||
continue;
|
||||
}
|
||||
Block renderBlock = pluggable.getCurrentBlock();
|
||||
|
||||
IFacadePluggable pluggable = (IFacadePluggable) tile.getPipePluggable(direction);
|
||||
if (((PipePluggable) pluggable).getRenderer() != null) {
|
||||
// This IFacadePluggable provides its own renderer.
|
||||
continue;
|
||||
}
|
||||
if (renderBlock != null) {
|
||||
IBlockAccess facadeBlockAccess = new FacadeBlockAccess(tile.getWorld(), direction);
|
||||
|
||||
Block renderBlock = pluggable.getCurrentBlock();
|
||||
// If the facade is meant to render in the current pass
|
||||
if (renderBlock.canRenderInPass(PipeRendererWorld.renderPass)) {
|
||||
int renderMeta = pluggable.getCurrentMetadata();
|
||||
|
||||
if (renderBlock != null) {
|
||||
IBlockAccess facadeBlockAccess = new FacadeBlockAccess(tile.getWorldObj(), direction);
|
||||
|
||||
// If the facade is meant to render in the current pass
|
||||
if (renderBlock.canRenderInPass(PipeRendererWorld.renderPass)) {
|
||||
int renderMeta = pluggable.getCurrentMetadata();
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
textures[side.ordinal()] = renderBlock.getIcon(
|
||||
facadeBlockAccess, tile.x(), tile.y(), tile.z(), side.ordinal()
|
||||
);
|
||||
if (textures[side.ordinal()] == null) {
|
||||
textures[side.ordinal()] = renderBlock.getIcon(side.ordinal(), renderMeta);
|
||||
}
|
||||
if (side == direction || side == direction.getOpposite()) {
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
textures[side.ordinal()] = renderBlock.getIcon(
|
||||
facadeBlockAccess, tile.x(), tile.y(), tile.z(), side.ordinal()
|
||||
);
|
||||
if (textures[side.ordinal()] == null) {
|
||||
textures[side.ordinal()] = renderBlock.getIcon(side.ordinal(), renderMeta);
|
||||
}
|
||||
if (side == direction || side == direction.getOpposite()) {
|
||||
blockStateMachine.setRenderSide(side, true);
|
||||
} else {
|
||||
if (!(tile.getPipePluggable(side) instanceof IFacadePluggable)) {
|
||||
blockStateMachine.setRenderSide(side, true);
|
||||
} else {
|
||||
if (!(tile.getPipePluggable(side) instanceof IFacadePluggable)) {
|
||||
blockStateMachine.setRenderSide(side, true);
|
||||
} else {
|
||||
IFacadePluggable pluggable2 = (IFacadePluggable) tile.getPipePluggable(side);
|
||||
blockStateMachine.setRenderSide(side, pluggable2.getCurrentBlock() == null);
|
||||
}
|
||||
IFacadePluggable pluggable2 = (IFacadePluggable) tile.getPipePluggable(side);
|
||||
blockStateMachine.setRenderSide(side, pluggable2.getCurrentBlock() == null);
|
||||
}
|
||||
}
|
||||
|
||||
if (renderBlock.getRenderType() == 31) {
|
||||
if ((renderMeta & 12) == 4) {
|
||||
renderblocks.uvRotateEast = 1;
|
||||
renderblocks.uvRotateWest = 1;
|
||||
renderblocks.uvRotateTop = 1;
|
||||
renderblocks.uvRotateBottom = 1;
|
||||
} else if ((renderMeta & 12) == 8) {
|
||||
renderblocks.uvRotateSouth = 1;
|
||||
renderblocks.uvRotateNorth = 1;
|
||||
}
|
||||
}
|
||||
|
||||
((FakeBlock) blockStateMachine.getBlock()).setColor(renderBlock.getRenderColor(renderMeta));
|
||||
// Hollow facade
|
||||
if (pluggable.isHollow()) {
|
||||
renderblocks.field_152631_f = true;
|
||||
float[][] rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
rotated[0][0] = CoreConstants.PIPE_MIN_POS - zFightOffset * 4;
|
||||
rotated[0][1] = CoreConstants.PIPE_MAX_POS + zFightOffset * 4;
|
||||
rotated[2][0] = 0.0F;
|
||||
rotated[2][1] = CoreConstants.PIPE_MIN_POS - zFightOffset * 2;
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
|
||||
rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
rotated[0][0] = CoreConstants.PIPE_MIN_POS - zFightOffset * 4;
|
||||
rotated[0][1] = CoreConstants.PIPE_MAX_POS + zFightOffset * 4;
|
||||
rotated[2][0] = CoreConstants.PIPE_MAX_POS + zFightOffset * 2;
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
|
||||
rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
rotated[0][0] = 0.0F;
|
||||
rotated[0][1] = CoreConstants.PIPE_MIN_POS - zFightOffset * 2;
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
|
||||
rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
rotated[0][0] = CoreConstants.PIPE_MAX_POS + zFightOffset * 2;
|
||||
rotated[0][1] = 1F;
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
renderblocks.field_152631_f = false;
|
||||
} else { // Solid facade
|
||||
float[][] rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
}
|
||||
((FakeBlock) blockStateMachine.getBlock()).setColor(0xFFFFFF);
|
||||
|
||||
if (renderBlock.getRenderType() == 31) {
|
||||
renderblocks.uvRotateSouth = 0;
|
||||
renderblocks.uvRotateEast = 0;
|
||||
renderblocks.uvRotateWest = 0;
|
||||
renderblocks.uvRotateNorth = 0;
|
||||
renderblocks.uvRotateTop = 0;
|
||||
renderblocks.uvRotateBottom = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
((FakeBlock) blockStateMachine.getBlock()).setColor(0xFFFFFF);
|
||||
if (renderBlock.getRenderType() == 31) {
|
||||
if ((renderMeta & 12) == 4) {
|
||||
renderblocks.uvRotateEast = 1;
|
||||
renderblocks.uvRotateWest = 1;
|
||||
renderblocks.uvRotateTop = 1;
|
||||
renderblocks.uvRotateBottom = 1;
|
||||
} else if ((renderMeta & 12) == 8) {
|
||||
renderblocks.uvRotateSouth = 1;
|
||||
renderblocks.uvRotateNorth = 1;
|
||||
}
|
||||
}
|
||||
|
||||
((FakeBlock) blockStateMachine.getBlock()).setColor(renderBlock.getRenderColor(renderMeta));
|
||||
// Hollow facade
|
||||
if (pluggable.isHollow()) {
|
||||
renderblocks.field_152631_f = true;
|
||||
float[][] rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
rotated[0][0] = CoreConstants.PIPE_MIN_POS - zFightOffset * 4;
|
||||
rotated[0][1] = CoreConstants.PIPE_MAX_POS + zFightOffset * 4;
|
||||
rotated[2][0] = 0.0F;
|
||||
rotated[2][1] = CoreConstants.PIPE_MIN_POS - zFightOffset * 2;
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
|
||||
rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
rotated[0][0] = CoreConstants.PIPE_MIN_POS - zFightOffset * 4;
|
||||
rotated[0][1] = CoreConstants.PIPE_MAX_POS + zFightOffset * 4;
|
||||
rotated[2][0] = CoreConstants.PIPE_MAX_POS + zFightOffset * 2;
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
|
||||
rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
rotated[0][0] = 0.0F;
|
||||
rotated[0][1] = CoreConstants.PIPE_MIN_POS - zFightOffset * 2;
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
|
||||
rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
rotated[0][0] = CoreConstants.PIPE_MAX_POS + zFightOffset * 2;
|
||||
rotated[0][1] = 1F;
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
renderblocks.field_152631_f = false;
|
||||
} else { // Solid facade
|
||||
float[][] rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
setRenderBounds(renderblocks, rotated, direction);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
}
|
||||
((FakeBlock) blockStateMachine.getBlock()).setColor(0xFFFFFF);
|
||||
|
||||
if (renderBlock.getRenderType() == 31) {
|
||||
renderblocks.uvRotateSouth = 0;
|
||||
renderblocks.uvRotateEast = 0;
|
||||
renderblocks.uvRotateWest = 0;
|
||||
renderblocks.uvRotateNorth = 0;
|
||||
renderblocks.uvRotateTop = 0;
|
||||
renderblocks.uvRotateBottom = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
((FakeBlock) blockStateMachine.getBlock()).setColor(0xFFFFFF);
|
||||
|
||||
((TextureStateManager) textureManager.getTextureState()).pushArray();
|
||||
blockStateMachine.setRenderAllSides();
|
||||
|
||||
textureManager.getTextureState().set(BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal())); // Structure Pipe
|
||||
|
||||
// Always render connectors in pass 0
|
||||
if (PipeRendererWorld.renderPass == 0) {
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (tile.getPipePluggable(direction) instanceof IFacadePluggable) {
|
||||
IFacadePluggable pluggable = (IFacadePluggable) tile.getPipePluggable(direction);
|
||||
if (PipeRendererWorld.renderPass == 0 && !pluggable.isHollow()) {
|
||||
float[][] rotated = MatrixTranformations.deepClone(zeroStateSupport);
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
|
||||
if (((PipePluggable) pluggable).getRenderer() != null) {
|
||||
// This IFacadePluggable provides its own renderer.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!pluggable.isHollow()) {
|
||||
float[][] rotated = MatrixTranformations.deepClone(zeroStateSupport);
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
|||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -36,6 +37,7 @@ import buildcraft.api.gates.IGateExpansion;
|
|||
import buildcraft.api.items.IItemCustomPipeRender;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.lib.render.RenderEntityBlock;
|
||||
import buildcraft.core.lib.render.RenderEntityBlock.RenderInfo;
|
||||
|
@ -275,7 +277,7 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
}
|
||||
|
||||
renderGatesWires(pipe, x, y, z);
|
||||
renderGates(pipe, x, y, z);
|
||||
renderPluggables(pipe, x, y, z);
|
||||
|
||||
IPipeTile.PipeType pipeType = pipe.getPipeType();
|
||||
|
||||
|
@ -456,21 +458,22 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderGates(TileGenericPipe pipe, double x, double y, double z) {
|
||||
private void renderPluggables(TileGenericPipe pipe, double x, double y, double z) {
|
||||
TileEntityRendererDispatcher.instance.field_147553_e.bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (pipe.getPipePluggable(direction) instanceof GatePluggable) {
|
||||
renderGate(pipe, x, y, z, (GatePluggable) pipe.getPipePluggable(direction), direction);
|
||||
PipePluggable pluggable = pipe.getPipePluggable(direction);
|
||||
if (pluggable != null && pluggable.getDynamicRenderer() != null) {
|
||||
pluggable.getDynamicRenderer().renderPluggable(pipe.getPipe(), direction, pluggable, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGate(TileGenericPipe pipe, double x, double y, double z, GatePluggable gate, ForgeDirection direction) {
|
||||
public static void renderGate(double x, double y, double z, GatePluggable gate, ForgeDirection direction) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
IIcon lightIcon;
|
||||
IIcon gateIcon = gate.getLogic().getGateIcon();
|
||||
if (gate.isLit) {
|
||||
|
@ -482,8 +485,8 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
float translateCenter = 0;
|
||||
|
||||
// Render base gate
|
||||
renderGate(pipe, gateIcon, 0, 0.1F, 0, 0, direction, false);
|
||||
renderGate(pipe, lightIcon, 0, 0.1F, 0, 0, direction, gate.isLit);
|
||||
renderGate(gateIcon, 0, 0.1F, 0, 0, direction, false);
|
||||
renderGate(lightIcon, 0, 0.1F, 0, 0, direction, gate.isLit);
|
||||
|
||||
float pulseStage = gate.getPulseStage() * 2F;
|
||||
|
||||
|
@ -498,23 +501,23 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
translateCenter = amplitude - ((pulseStage - 1F) * amplitude) + start;
|
||||
}
|
||||
|
||||
renderGate(pipe, gateIcon, 0, 0.13F, translateCenter, translateCenter, direction, false);
|
||||
renderGate(pipe, lightIcon, 0, 0.13F, translateCenter, translateCenter, direction, gate.isLit);
|
||||
renderGate(gateIcon, 0, 0.13F, translateCenter, translateCenter, direction, false);
|
||||
renderGate(lightIcon, 0, 0.13F, translateCenter, translateCenter, direction, gate.isLit);
|
||||
}
|
||||
|
||||
IIcon materialIcon = gate.getMaterial().getIconBlock();
|
||||
if (materialIcon != null) {
|
||||
renderGate(pipe, materialIcon, 1, 0.13F, translateCenter, translateCenter, direction, false);
|
||||
renderGate(materialIcon, 1, 0.13F, translateCenter, translateCenter, direction, false);
|
||||
}
|
||||
|
||||
for (IGateExpansion expansion : gate.getExpansions()) {
|
||||
renderGate(pipe, expansion.getOverlayBlock(), 2, 0.13F, translateCenter, translateCenter, direction, false);
|
||||
renderGate(expansion.getOverlayBlock(), 2, 0.13F, translateCenter, translateCenter, direction, false);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderGate(TileGenericPipe tile, IIcon icon, int layer, float trim, float translateCenter, float extraDepth, ForgeDirection direction, boolean isLit) {
|
||||
private static void renderGate(IIcon icon, int layer, float trim, float translateCenter, float extraDepth, ForgeDirection direction, boolean isLit) {
|
||||
RenderInfo renderBox = new RenderInfo();
|
||||
renderBox.texture = icon;
|
||||
|
||||
|
@ -551,7 +554,7 @@ public class PipeRendererTESR extends TileEntitySpecialRenderer {
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderLitBox(RenderInfo info, boolean isLit) {
|
||||
private static void renderLitBox(RenderInfo info, boolean isLit) {
|
||||
RenderEntityBlock.INSTANCE.renderBlock(info);
|
||||
|
||||
float lastX = OpenGlHelper.lastBrightnessX;
|
||||
|
|
|
@ -19,7 +19,6 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
import buildcraft.api.core.render.ITextureStates;
|
||||
import buildcraft.api.transport.pluggable.IPipePluggableRenderer;
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
import buildcraft.core.CoreConstants;
|
||||
|
@ -155,10 +154,6 @@ public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
|
|||
|
||||
renderblocks.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Facade renderer handles rendering in both passes
|
||||
pipeFacadeRenderer(renderblocks, fakeBlock, tile, state, x, y, z);
|
||||
//block.setRenderAllSides();//Start fresh
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (tile.hasPipePluggable(dir)) {
|
||||
PipePluggable p = tile.getPipePluggable(dir);
|
||||
|
@ -207,10 +202,6 @@ public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
|
|||
renderblocks.renderStandardBlock(stateHost, x, y, z);
|
||||
}
|
||||
|
||||
private void pipeFacadeRenderer(RenderBlocks renderblocks, ITextureStates blockStateMachine, TileGenericPipe tile, PipeRenderState state, int x, int y, int z) {
|
||||
FacadeRenderHelper.pipeFacadeRenderer(renderblocks, blockStateMachine, tile, state, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// Done with a special item renderer
|
||||
|
|
Loading…
Reference in a new issue