re-add hollow facades, fix things
This commit is contained in:
parent
d4a060223d
commit
a1e355d32a
8 changed files with 142 additions and 157 deletions
|
@ -514,20 +514,9 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
case Pluggable: {
|
||||
Pipe<?> pipe = getPipe(world, x, y, z);
|
||||
PipePluggable pluggable = pipe.container.getPipePluggable(rayTraceResult.sideHit);
|
||||
if (pluggable instanceof FacadePluggable) {
|
||||
ForgeDirection dir = ForgeDirection
|
||||
.getOrientation(target.sideHit);
|
||||
FacadeMatrix matrix = getPipe(world, x, y, z).container.renderState.facadeMatrix;
|
||||
Block block = matrix.getFacadeBlock(dir);
|
||||
if (block != null) {
|
||||
return BuildCraftTransport.facadeItem.getFacadeForBlock(block,
|
||||
matrix.getFacadeMetaId(dir));
|
||||
}
|
||||
} else {
|
||||
ItemStack[] drops = pluggable.getDropItems(pipe.container);
|
||||
if (drops != null && drops.length > 0) {
|
||||
return drops[0];
|
||||
}
|
||||
ItemStack[] drops = pluggable.getDropItems(pipe.container);
|
||||
if (drops != null && drops.length > 0) {
|
||||
return drops[0];
|
||||
}
|
||||
}
|
||||
case Pipe:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package buildcraft.transport;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
@ -13,9 +14,16 @@ import buildcraft.core.utils.MatrixTranformations;
|
|||
|
||||
public class FacadePluggable extends PipePluggable {
|
||||
public ItemFacade.FacadeState[] states;
|
||||
private ItemFacade.FacadeState activeState;
|
||||
|
||||
// Client sync
|
||||
private Block block;
|
||||
private int meta;
|
||||
private boolean transparent, renderAsHollow;
|
||||
|
||||
public FacadePluggable(ItemFacade.FacadeState[] states) {
|
||||
this.states = states;
|
||||
activeState = states.length > 0 ? states[0] : null;
|
||||
}
|
||||
|
||||
public FacadePluggable() {
|
||||
|
@ -37,14 +45,26 @@ public class FacadePluggable extends PipePluggable {
|
|||
|
||||
@Override
|
||||
public ItemStack[] getDropItems(IPipeContainer pipe) {
|
||||
return states == null ? null : new ItemStack[] { ItemFacade.getFacade(states) };
|
||||
if (states != null) {
|
||||
return new ItemStack[] { ItemFacade.getFacade(states) };
|
||||
} else {
|
||||
return new ItemStack[] { ItemFacade.getFacade(new ItemFacade.FacadeState(getRenderingBlock(), getRenderingMeta(), null, isHollow())) };
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlocking(IPipeContainer pipe, ForgeDirection direction) {
|
||||
return false;
|
||||
return isHollow();
|
||||
}
|
||||
|
||||
public boolean isHollow() {
|
||||
return states == null ? renderAsHollow : !states[0].hollow;
|
||||
}
|
||||
|
||||
public Block getRenderingBlock() { return block; }
|
||||
public int getRenderingMeta() { return meta; }
|
||||
public boolean getRenderingTransparent() { return transparent; }
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(ForgeDirection side) {
|
||||
float[][] bounds = new float[3][2];
|
||||
|
@ -62,6 +82,11 @@ public class FacadePluggable extends PipePluggable {
|
|||
return AxisAlignedBB.getBoundingBox(bounds[0][0], bounds[1][0], bounds[2][0], bounds[0][1], bounds[1][1], bounds[2][1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolidOnSide(IPipeContainer pipe, ForgeDirection direction) {
|
||||
return !isHollow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPipePluggableRenderer getRenderer() {
|
||||
return null;
|
||||
|
@ -69,10 +94,40 @@ public class FacadePluggable extends PipePluggable {
|
|||
|
||||
@Override
|
||||
public void writeData(ByteBuf data) {
|
||||
if (activeState == null) {
|
||||
activeState = states.length > 0 ? states[0] : null;
|
||||
}
|
||||
|
||||
data.writeBoolean(activeState == null ? false : activeState.hollow);
|
||||
|
||||
if (activeState == null || activeState.block == null) {
|
||||
data.writeShort(0);
|
||||
} else {
|
||||
data.writeShort(Block.getIdFromBlock(activeState.block));
|
||||
}
|
||||
|
||||
data.writeByte(activeState == null ? 0 : activeState.metadata);
|
||||
data.writeBoolean(activeState == null ? false : activeState.transparent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(ByteBuf data) {
|
||||
renderAsHollow = data.readBoolean();
|
||||
|
||||
int blockId = data.readUnsignedShort();
|
||||
if (blockId > 0) {
|
||||
block = Block.getBlockById(blockId);
|
||||
} else {
|
||||
block = null;
|
||||
}
|
||||
|
||||
meta = data.readByte();
|
||||
transparent = data.readBoolean();
|
||||
}
|
||||
|
||||
protected void setActiveState(int id) {
|
||||
if (id >= 0 && id < states.length) {
|
||||
activeState = states[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem {
|
|||
public final Block block;
|
||||
public final int metadata;
|
||||
public final boolean transparent;
|
||||
public final boolean hollow;
|
||||
public final PipeWire wire;
|
||||
|
||||
public FacadeState(Block block, int metadata, PipeWire wire) {
|
||||
|
@ -57,6 +58,15 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem {
|
|||
this.metadata = metadata;
|
||||
this.wire = wire;
|
||||
this.transparent = false;
|
||||
this.hollow = false;
|
||||
}
|
||||
|
||||
public FacadeState(Block block, int metadata, PipeWire wire, boolean hollow) {
|
||||
this.block = block;
|
||||
this.metadata = metadata;
|
||||
this.wire = wire;
|
||||
this.transparent = false;
|
||||
this.hollow = hollow;
|
||||
}
|
||||
|
||||
public FacadeState(NBTTagCompound nbt) {
|
||||
|
@ -64,6 +74,7 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem {
|
|||
this.metadata = nbt.getByte("metadata");
|
||||
this.wire = nbt.hasKey("wire") ? PipeWire.fromOrdinal(nbt.getByte("wire")) : null;
|
||||
this.transparent = nbt.hasKey("transparent") && nbt.getBoolean("transparent");
|
||||
this.hollow = nbt.hasKey("hollow") && nbt.getBoolean("hollow");
|
||||
}
|
||||
|
||||
private FacadeState(PipeWire wire) {
|
||||
|
@ -71,6 +82,7 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem {
|
|||
this.metadata = 0;
|
||||
this.wire = wire;
|
||||
this.transparent = true;
|
||||
this.hollow = false;
|
||||
}
|
||||
|
||||
public static FacadeState create(Block block, int metadata) {
|
||||
|
@ -94,6 +106,7 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem {
|
|||
nbt.setByte("wire", (byte) wire.ordinal());
|
||||
}
|
||||
nbt.setBoolean("transparent", transparent);
|
||||
nbt.setBoolean("hollow", hollow);
|
||||
}
|
||||
|
||||
public static NBTTagList writeArray(FacadeState[] states) {
|
||||
|
@ -180,7 +193,11 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem {
|
|||
} else if (state.block.getRenderType() == 39 && meta > 2) {
|
||||
meta = 2;
|
||||
}
|
||||
return CoreProxy.proxy.getItemDisplayName(new ItemStack(state.block, 1, meta));
|
||||
String s = CoreProxy.proxy.getItemDisplayName(new ItemStack(state.block, 1, meta));
|
||||
if (state.hollow) {
|
||||
s += " (" + StringUtils.localize("item.Facade.state_hollow") + ")";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
|
@ -427,15 +444,28 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem {
|
|||
+ itemStack.getItemDamage() + "}";
|
||||
|
||||
ItemStack facade = getFacadeForBlock(block, itemStack.getItemDamage());
|
||||
|
||||
if (!allFacades.contains(facade)) {
|
||||
allFacades.add(facade);
|
||||
|
||||
ItemStack facade6 = facade.copy();
|
||||
facade6.stackSize = 6;
|
||||
|
||||
FacadeState state = getFacadeStates(facade6)[0];
|
||||
ItemStack facadeHollow = getFacade(new FacadeState(state.block, state.metadata, state.wire, true));
|
||||
|
||||
ItemStack facade6Hollow = facadeHollow.copy();
|
||||
facade6Hollow.stackSize = 6;
|
||||
|
||||
// 3 Structurepipes + this block makes 6 facades
|
||||
BuildcraftRecipeRegistry.assemblyTable.addRecipe(recipeId, 8000, facade6, new ItemStack(
|
||||
BuildCraftTransport.pipeStructureCobblestone, 3), itemStack);
|
||||
|
||||
BuildcraftRecipeRegistry.assemblyTable.addRecipe(recipeId + ":hollow", 8000, facade6Hollow, new ItemStack(
|
||||
BuildCraftTransport.pipeStructureCobblestone, 3), itemStack);
|
||||
|
||||
BuildcraftRecipeRegistry.assemblyTable.addRecipe(recipeId + ":toHollow", 160, facadeHollow, facade);
|
||||
BuildcraftRecipeRegistry.assemblyTable.addRecipe(recipeId + ":fromHollow", 160, facade, facadeHollow);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import io.netty.buffer.ByteBuf;
|
|||
|
||||
import buildcraft.api.core.ISerializable;
|
||||
import buildcraft.transport.utils.ConnectionMatrix;
|
||||
import buildcraft.transport.utils.FacadeMatrix;
|
||||
import buildcraft.transport.utils.GateMatrix;
|
||||
import buildcraft.transport.utils.TextureMatrix;
|
||||
import buildcraft.transport.utils.WireMatrix;
|
||||
|
@ -22,7 +21,6 @@ public class PipeRenderState implements ISerializable {
|
|||
public final ConnectionMatrix pipeConnectionMatrix = new ConnectionMatrix();
|
||||
public final TextureMatrix textureMatrix = new TextureMatrix();
|
||||
public final WireMatrix wireMatrix = new WireMatrix();
|
||||
public final FacadeMatrix facadeMatrix = new FacadeMatrix();
|
||||
public final GateMatrix gateMatrix = new GateMatrix();
|
||||
public byte glassColor = -1;
|
||||
|
||||
|
@ -32,7 +30,6 @@ public class PipeRenderState implements ISerializable {
|
|||
dirty = false;
|
||||
pipeConnectionMatrix.clean();
|
||||
textureMatrix.clean();
|
||||
facadeMatrix.clean();
|
||||
wireMatrix.clean();
|
||||
gateMatrix.clean();
|
||||
}
|
||||
|
@ -40,13 +37,12 @@ public class PipeRenderState implements ISerializable {
|
|||
public boolean isDirty() {
|
||||
return dirty || pipeConnectionMatrix.isDirty()
|
||||
|| textureMatrix.isDirty() || wireMatrix.isDirty()
|
||||
|| facadeMatrix.isDirty() || gateMatrix.isDirty();
|
||||
|| gateMatrix.isDirty();
|
||||
}
|
||||
|
||||
public boolean needsRenderUpdate() {
|
||||
return pipeConnectionMatrix.isDirty() || textureMatrix.isDirty()
|
||||
|| wireMatrix.isDirty() || facadeMatrix.isDirty()
|
||||
|| gateMatrix.isDirty();
|
||||
|| wireMatrix.isDirty() || gateMatrix.isDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,7 +51,6 @@ public class PipeRenderState implements ISerializable {
|
|||
pipeConnectionMatrix.writeData(data);
|
||||
textureMatrix.writeData(data);
|
||||
wireMatrix.writeData(data);
|
||||
facadeMatrix.writeData(data);
|
||||
gateMatrix.writeData(data);
|
||||
}
|
||||
|
||||
|
@ -65,7 +60,6 @@ public class PipeRenderState implements ISerializable {
|
|||
pipeConnectionMatrix.readData(data);
|
||||
textureMatrix.readData(data);
|
||||
wireMatrix.readData(data);
|
||||
facadeMatrix.readData(data);
|
||||
gateMatrix.readData(data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,10 +215,12 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
PipePluggable pluggable = pluggables[direction.ordinal()];
|
||||
if (pluggable != null) {
|
||||
pluggable.onDetachedPipe(pipe, direction);
|
||||
ItemStack[] stacks = pluggable.getDropItems(pipe);
|
||||
if (stacks != null) {
|
||||
for (ItemStack stack : stacks) {
|
||||
InvUtils.dropItems(pipe.worldObj, stack, pipe.xCoord, pipe.yCoord, pipe.zCoord);
|
||||
if (!pipe.getWorld().isRemote) {
|
||||
ItemStack[] stacks = pluggable.getDropItems(pipe);
|
||||
if (stacks != null) {
|
||||
for (ItemStack stack : stacks) {
|
||||
InvUtils.dropItems(pipe.worldObj, stack, pipe.xCoord, pipe.yCoord, pipe.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
|
@ -503,33 +505,28 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
PipePluggable pluggable = sideProperties.pluggables[direction.ordinal()];
|
||||
if (!(pluggable instanceof FacadePluggable)) {
|
||||
renderState.facadeMatrix.setFacade(direction, null, 0, true);
|
||||
continue;
|
||||
}
|
||||
|
||||
FacadeState[] states = ((FacadePluggable) pluggable).states;
|
||||
if (states == null) {
|
||||
renderState.facadeMatrix.setFacade(direction, null, 0, true);
|
||||
continue;
|
||||
}
|
||||
// Iterate over all states and activate first proper
|
||||
FacadeState defaultState = null, activeState = null;
|
||||
for (FacadeState state : states) {
|
||||
int defaultState = -1;
|
||||
int activeState = -1;
|
||||
for (int i = 0; i < states.length; i++) {
|
||||
FacadeState state = states[i];
|
||||
if (state.wire == null) {
|
||||
defaultState = state;
|
||||
defaultState = i;
|
||||
continue;
|
||||
}
|
||||
if (pipe != null && pipe.isWireActive(state.wire)) {
|
||||
activeState = state;
|
||||
activeState = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activeState == null) {
|
||||
if (activeState < 0) {
|
||||
activeState = defaultState;
|
||||
}
|
||||
Block block = activeState != null ? activeState.block : null;
|
||||
int metadata = activeState != null ? activeState.metadata : 0;
|
||||
boolean transparent = activeState == null || block == null;
|
||||
renderState.facadeMatrix.setFacade(direction, block, metadata, transparent);
|
||||
((FacadePluggable) pluggable).setActiveState(activeState);
|
||||
}
|
||||
|
||||
pluggableState.setPluggables(sideProperties.pluggables);
|
||||
|
@ -892,8 +889,6 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
public boolean hasFacade(ForgeDirection direction) {
|
||||
if (direction == null || direction == ForgeDirection.UNKNOWN) {
|
||||
return false;
|
||||
} else if (this.getWorldObj().isRemote) {
|
||||
return renderState.facadeMatrix.getFacadeBlock(direction) != null;
|
||||
} else {
|
||||
return sideProperties.pluggables[direction.ordinal()] instanceof FacadePluggable;
|
||||
}
|
||||
|
@ -930,7 +925,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
}
|
||||
|
||||
public boolean hasEnabledFacade(ForgeDirection direction) {
|
||||
return hasFacade(direction) && !renderState.facadeMatrix.getFacadeTransparent(direction);
|
||||
return hasFacade(direction) && !((FacadePluggable) getPipePluggable(direction)).getRenderingTransparent();
|
||||
}
|
||||
|
||||
public ItemStack getFacade(ForgeDirection direction) {
|
||||
|
@ -1065,7 +1060,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
|
||||
@Override
|
||||
public boolean isSolidOnSide(ForgeDirection side) {
|
||||
if (hasFacade(side)) {
|
||||
if (hasPipePluggable(side) && getPipePluggable(side).isSolidOnSide(this, side)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,10 @@ import buildcraft.api.core.render.ITextureStates;
|
|||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.utils.MatrixTranformations;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.FacadePluggable;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.PipeRenderState;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
import buildcraft.transport.TransportConstants;
|
||||
|
||||
public final class FacadeRenderHelper {
|
||||
|
@ -93,31 +95,43 @@ public final class FacadeRenderHelper {
|
|||
rotated[2][1] - zOffsets[side.ordinal()]);
|
||||
}
|
||||
|
||||
public static void pipeFacadeRenderer(RenderBlocks renderblocks, ITextureStates blockStateMachine, PipeRenderState state, int x, int y, int z) {
|
||||
public static void pipeFacadeRenderer(RenderBlocks renderblocks, ITextureStates blockStateMachine, TileGenericPipe tile, PipeRenderState state, int x, int y, int z) {
|
||||
ITextureStates textureManager = blockStateMachine;
|
||||
IIcon[] textures = textureManager.getTextureState().popArray();
|
||||
|
||||
//block_statemachine.setRenderAllSides();
|
||||
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
Block renderBlock = state.facadeMatrix.getFacadeBlock(direction);
|
||||
if (!(tile.getPipePluggable(direction) instanceof FacadePluggable)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FacadePluggable pluggable = (FacadePluggable) tile.getPipePluggable(direction);
|
||||
Block renderBlock = pluggable.getRenderingBlock();
|
||||
|
||||
if (renderBlock != null) {
|
||||
|
||||
// If the facade is meant to render in the current pass
|
||||
if (renderBlock.canRenderInPass(PipeRendererWorld.renderPass)) {
|
||||
int renderMeta = state.facadeMatrix.getFacadeMetaId(direction);
|
||||
int renderMeta = pluggable.getRenderingMeta();
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
textures[side.ordinal()] = renderBlock.getIcon(side.ordinal(), renderMeta);
|
||||
if (side == direction || side == direction.getOpposite()) {
|
||||
blockStateMachine.setRenderSide(side, true);
|
||||
} else {
|
||||
blockStateMachine.setRenderSide(side, state.facadeMatrix.getFacadeBlock(side) == null);
|
||||
if (!(tile.getPipePluggable(side) instanceof FacadePluggable)) {
|
||||
blockStateMachine.setRenderSide(side, true);
|
||||
} else {
|
||||
FacadePluggable pluggable2 = (FacadePluggable) tile.getPipePluggable(side);
|
||||
blockStateMachine.setRenderSide(side, pluggable2.getRenderingBlock() == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
BlockGenericPipe.facadeRenderColor = Item.getItemFromBlock(state.facadeMatrix.getFacadeBlock(direction)).getColorFromItemStack(new ItemStack(renderBlock, 1, renderMeta), 0);
|
||||
BlockGenericPipe.facadeRenderColor = Item.getItemFromBlock(pluggable.getRenderingBlock()).getColorFromItemStack(new ItemStack(renderBlock, 1, renderMeta), 0);
|
||||
} catch (Throwable error) {
|
||||
}
|
||||
|
||||
|
@ -134,7 +148,7 @@ public final class FacadeRenderHelper {
|
|||
}
|
||||
|
||||
// Hollow facade
|
||||
if (state.pipeConnectionMatrix.isConnected(direction)) {
|
||||
if (pluggable.isHollow()) {
|
||||
float[][] rotated = MatrixTranformations.deepClone(zeroStateFacade);
|
||||
rotated[0][0] = CoreConstants.PIPE_MIN_POS - zFightOffset * 4;
|
||||
rotated[0][1] = CoreConstants.PIPE_MAX_POS + zFightOffset * 4;
|
||||
|
@ -194,12 +208,16 @@ public final class FacadeRenderHelper {
|
|||
// Always render connectors in pass 0
|
||||
if (PipeRendererWorld.renderPass == 0) {
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (state.facadeMatrix.getFacadeBlock(direction) != null && !state.pipeConnectionMatrix.isConnected(direction)) {
|
||||
float[][] rotated = MatrixTranformations.deepClone(zeroStateSupport);
|
||||
MatrixTranformations.transform(rotated, direction);
|
||||
if (tile.getPipePluggable(direction) instanceof FacadePluggable) {
|
||||
FacadePluggable pluggable = (FacadePluggable) tile.getPipePluggable(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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ 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, state, x, y, z);
|
||||
pipeFacadeRenderer(renderblocks, fakeBlock, tile, state, x, y, z);
|
||||
//block.setRenderAllSides();//Start fresh
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
@ -157,8 +157,8 @@ public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
|
|||
renderblocks.renderStandardBlock(stateHost, x, y, z);
|
||||
}
|
||||
|
||||
private void pipeFacadeRenderer(RenderBlocks renderblocks, ITextureStates blockStateMachine, PipeRenderState state, int x, int y, int z) {
|
||||
FacadeRenderHelper.pipeFacadeRenderer(renderblocks, blockStateMachine, state, 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
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.transport.utils;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class FacadeMatrix {
|
||||
|
||||
private final Block[] blocks = new Block[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
private final int[] blockMetas = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
private final boolean[] transparent = new boolean[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
private boolean dirty = false;
|
||||
|
||||
public FacadeMatrix() {
|
||||
}
|
||||
|
||||
public void setFacade(ForgeDirection direction, Block block, int blockMeta, boolean trans) {
|
||||
if (blocks[direction.ordinal()] != block || blockMetas[direction.ordinal()] != blockMeta || transparent[direction.ordinal()] != trans) {
|
||||
blocks[direction.ordinal()] = block;
|
||||
blockMetas[direction.ordinal()] = blockMeta;
|
||||
transparent[direction.ordinal()] = trans;
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Block getFacadeBlock(ForgeDirection direction) {
|
||||
return blocks[direction.ordinal()];
|
||||
}
|
||||
|
||||
public int getFacadeMetaId(ForgeDirection direction) {
|
||||
return blockMetas[direction.ordinal()];
|
||||
}
|
||||
|
||||
public boolean getFacadeTransparent(ForgeDirection direction) {
|
||||
return transparent[direction.ordinal()];
|
||||
}
|
||||
|
||||
public boolean isDirty() {
|
||||
return dirty;
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
dirty = false;
|
||||
}
|
||||
|
||||
public void writeData(ByteBuf data) {
|
||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
if (blocks [i] == null) {
|
||||
data.writeShort(0);
|
||||
} else {
|
||||
data.writeShort(Block.blockRegistry.getIDForObject(blocks[i]));
|
||||
}
|
||||
data.writeBoolean(transparent[i]);
|
||||
data.writeByte(blockMetas[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void readData(ByteBuf data) {
|
||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
short id = data.readShort();
|
||||
|
||||
Block block;
|
||||
|
||||
if (id == 0) {
|
||||
block = null;
|
||||
} else {
|
||||
block = (Block) Block.blockRegistry.getObjectById(id);
|
||||
}
|
||||
|
||||
if (blocks[i] != block) {
|
||||
blocks[i] = block;
|
||||
dirty = true;
|
||||
}
|
||||
boolean trans = data.readBoolean();
|
||||
if (transparent[i] != trans) {
|
||||
transparent[i] = trans;
|
||||
dirty = true;
|
||||
}
|
||||
byte meta = data.readByte();
|
||||
if (blockMetas[i] != meta) {
|
||||
blockMetas[i] = meta;
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue