Merge branch 'BCPlug'
This commit is contained in:
commit
a40e7c5365
10 changed files with 275 additions and 96 deletions
|
@ -72,6 +72,7 @@ item.PipeLiquidsVoid=Void Waterproof Pipe
|
|||
item.PipeItemsSandstone=Sandstone Transport Pipe
|
||||
item.PipeLiquidsSandstone=Sandstone Waterproof Pipe
|
||||
item.Facade=Facade
|
||||
item.PipePlug=Pipe Plug
|
||||
tile.miningWellBlock=Mining Well
|
||||
tile.plainPipeBlock=Mining Pipe
|
||||
tile.autoWorkbenchBlock=Autocrafting Table
|
||||
|
|
|
@ -37,6 +37,7 @@ import buildcraft.transport.GuiHandler;
|
|||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.ItemGate;
|
||||
import buildcraft.transport.ItemPipe;
|
||||
import buildcraft.transport.ItemPlug;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.PipeTriggerProvider;
|
||||
|
@ -139,6 +140,7 @@ public class BuildCraftTransport {
|
|||
public static Item pipePowerGold;
|
||||
|
||||
public static Item facadeItem;
|
||||
public static Item plugItem;
|
||||
|
||||
// public static Item pipeItemsStipes;
|
||||
public static Item pipeStructureCobblestone;
|
||||
|
@ -351,6 +353,11 @@ public class BuildCraftTransport {
|
|||
Property pipeFacadeId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeFacade.id", DefaultProps.PIPE_FACADE_ID);
|
||||
facadeItem = new ItemFacade(pipeFacadeId.getInt());
|
||||
facadeItem.setUnlocalizedName("pipeFacade");
|
||||
|
||||
Property pipePlugId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipePlug.id", DefaultProps.PIPE_PLUG_ID);
|
||||
plugItem = new ItemPlug(pipePlugId.getInt());
|
||||
plugItem.setUnlocalizedName("pipePlug");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] {new ItemStack(pipeStructureCobblestone)}, 1000, new ItemStack(plugItem, 8)));
|
||||
|
||||
} finally {
|
||||
BuildCraftCore.mainConfiguration.save();
|
||||
|
|
|
@ -54,6 +54,7 @@ public class DefaultProps {
|
|||
// Moving to safer id range
|
||||
public static int GATE_AUTARCHIC_ID = 19140;
|
||||
public static int PIPE_FACADE_ID = 19141;
|
||||
public static int PIPE_PLUG_ID = 19142;
|
||||
|
||||
public static int PIPE_ITEMS_WOOD_ID = 19160;
|
||||
public static int PIPE_ITEMS_COBBLESTONE_ID = 19161;
|
||||
|
|
70
common/buildcraft/transport/ItemPlug.java
Normal file
70
common/buildcraft/transport/ItemPlug.java
Normal file
|
@ -0,0 +1,70 @@
|
|||
package buildcraft.transport;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPlug extends ItemBuildCraft {
|
||||
|
||||
public ItemPlug(int i) {
|
||||
super(i);
|
||||
setCreativeTab(CreativeTabBuildCraft.tabBuildCraft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack) {
|
||||
return "item.PipePlug";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World worldObj, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
if (worldObj.isRemote)
|
||||
return false;
|
||||
TileEntity tile = worldObj.getBlockTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileGenericPipe))
|
||||
return false;
|
||||
TileGenericPipe pipeTile = (TileGenericPipe) tile;
|
||||
|
||||
if (player.isSneaking()) { // Strip plug
|
||||
if (!pipeTile.hasPlug(ForgeDirection.VALID_DIRECTIONS[side]))
|
||||
return false;
|
||||
pipeTile.removeAndDropPlug(ForgeDirection.VALID_DIRECTIONS[side]);
|
||||
return true;
|
||||
} else {
|
||||
if (((TileGenericPipe) tile).addPlug(ForgeDirection.VALID_DIRECTIONS[side])){
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldPassSneakingClickToBlock(World worldObj, int x, int y, int z ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -461,6 +461,9 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
if (container.hasFacade(direction)) {
|
||||
container.dropFacade(direction);
|
||||
}
|
||||
if (container.hasPlug(direction)){
|
||||
container.removeAndDropPlug(direction);
|
||||
}
|
||||
}
|
||||
|
||||
if (broadcastRedstone) {
|
||||
|
|
|
@ -21,6 +21,7 @@ public class PipeRenderState implements IClientState {
|
|||
public final ConnectionMatrix pipeConnectionMatrix = new ConnectionMatrix();
|
||||
public final TextureMatrix textureMatrix = new TextureMatrix();
|
||||
public final WireMatrix wireMatrix = new WireMatrix();
|
||||
public final ConnectionMatrix plugMatrix = new ConnectionMatrix();
|
||||
|
||||
public final FacadeMatrix facadeMatrix = new FacadeMatrix();
|
||||
|
||||
|
@ -63,7 +64,7 @@ public class PipeRenderState implements IClientState {
|
|||
}
|
||||
|
||||
public boolean isDirty() {
|
||||
return dirty || pipeConnectionMatrix.isDirty() || textureMatrix.isDirty() || wireMatrix.isDirty() || facadeMatrix.isDirty();
|
||||
return dirty || pipeConnectionMatrix.isDirty() || textureMatrix.isDirty() || wireMatrix.isDirty() || facadeMatrix.isDirty() || plugMatrix.isDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,6 +75,7 @@ public class PipeRenderState implements IClientState {
|
|||
textureMatrix.writeData(data);
|
||||
wireMatrix.writeData(data);
|
||||
facadeMatrix.writeData(data);
|
||||
plugMatrix.writeData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,5 +86,6 @@ public class PipeRenderState implements IClientState {
|
|||
textureMatrix.readData(data);
|
||||
wireMatrix.readData(data);
|
||||
facadeMatrix.readData(data);
|
||||
plugMatrix.readData(data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.io.DataInputStream;
|
|||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -51,7 +52,6 @@ import buildcraft.transport.Gate.GateKind;
|
|||
import buildcraft.transport.network.PipeRenderStatePacket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITankContainer, IPipeEntry, IPipeTile, IOverrideDefaultTriggers, ITileBufferHolder,
|
||||
IPipeConnection, IDropControlInventory, IPipeRenderState, ISyncedTile, ISolidSideTile {
|
||||
|
@ -91,6 +91,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
|
||||
private int[] facadeBlocks = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
private int[] facadeMeta = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
private boolean[] plugs = new boolean[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
|
||||
public TileGenericPipe() {
|
||||
|
||||
|
@ -110,6 +111,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
nbttagcompound.setInteger("facadeBlocks[" + i + "]", facadeBlocks[i]);
|
||||
nbttagcompound.setInteger("facadeMeta[" + i + "]", facadeMeta[i]);
|
||||
nbttagcompound.setBoolean("plug[" + i + "]", plugs[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -131,6 +133,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
facadeBlocks[i] = nbttagcompound.getInteger("facadeBlocks[" + i + "]");
|
||||
facadeMeta[i] = nbttagcompound.getInteger("facadeMeta[" + i + "]");
|
||||
plugs[i] = nbttagcompound.getBoolean("plug[" + i + "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -250,11 +253,15 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
renderState.facadeMatrix.setFacade(direction, blockId, this.facadeMeta[direction.ordinal()]);
|
||||
}
|
||||
|
||||
//Plugs
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS){
|
||||
renderState.plugMatrix.setConnected(direction, plugs[direction.ordinal()]);
|
||||
}
|
||||
|
||||
if (renderState.isDirty()) {
|
||||
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
renderState.clean();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void initialize(Pipe pipe) {
|
||||
|
@ -470,11 +477,14 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
|
||||
protected boolean arePipesConnected(TileEntity with, ForgeDirection side) {
|
||||
Pipe pipe1 = pipe;
|
||||
|
||||
if (hasPlug(side)) return false;
|
||||
|
||||
if (!BlockGenericPipe.isValid(pipe1))
|
||||
return false;
|
||||
|
||||
if (with instanceof TileGenericPipe) {
|
||||
if (((TileGenericPipe)with).hasPlug(side.getOpposite())) return false;
|
||||
Pipe pipe2 = ((TileGenericPipe) with).pipe;
|
||||
|
||||
if (!BlockGenericPipe.isValid(pipe2))
|
||||
|
@ -685,4 +695,28 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasPlug(ForgeDirection forgeDirection) {
|
||||
return plugs[forgeDirection.ordinal()];
|
||||
}
|
||||
|
||||
public void removeAndDropPlug(ForgeDirection forgeDirection) {
|
||||
if (!hasPlug(forgeDirection)) return;
|
||||
|
||||
plugs[forgeDirection.ordinal()] = false;
|
||||
Utils.dropItems(worldObj, new ItemStack(BuildCraftTransport.plugItem), this.xCoord, this.yCoord, this.zCoord);
|
||||
worldObj.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord));
|
||||
scheduleNeighborChange(); //To force recalculation of connections
|
||||
scheduleRenderUpdate();
|
||||
}
|
||||
|
||||
public boolean addPlug(ForgeDirection forgeDirection) {
|
||||
if (hasPlug(forgeDirection)) return false;
|
||||
|
||||
plugs[forgeDirection.ordinal()] = true;
|
||||
worldObj.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord));
|
||||
scheduleNeighborChange(); //To force recalculation of connections
|
||||
scheduleRenderUpdate();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import buildcraft.BuildCraftTransport;
|
|||
import buildcraft.transport.render.FacadeItemRenderer;
|
||||
import buildcraft.transport.render.PipeItemRenderer;
|
||||
import buildcraft.transport.render.PipeWorldRenderer;
|
||||
import buildcraft.transport.render.PlugItemRenderer;
|
||||
import buildcraft.transport.render.RenderPipe;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
@ -13,6 +14,7 @@ public class TransportProxyClient extends TransportProxy {
|
|||
public final static PipeItemRenderer pipeItemRenderer = new PipeItemRenderer();
|
||||
public final static PipeWorldRenderer pipeWorldRenderer = new PipeWorldRenderer();
|
||||
public final static FacadeItemRenderer facadeItemRenderer = new FacadeItemRenderer();
|
||||
public final static PlugItemRenderer plugItemRenderer = new PlugItemRenderer();
|
||||
|
||||
@Override
|
||||
public void registerTileEntities() {
|
||||
|
@ -53,6 +55,7 @@ public class TransportProxyClient extends TransportProxy {
|
|||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeLiquidsSandstone.itemID, pipeItemRenderer);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.facadeItem.itemID, facadeItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.plugItem.itemID, plugItemRenderer);
|
||||
TransportProxy.pipeModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
RenderingRegistry.registerBlockHandler(pipeWorldRenderer);
|
||||
|
|
|
@ -162,6 +162,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
}
|
||||
|
||||
pipeFacadeRenderer(renderblocks, block, state, x, y, z);
|
||||
pipePlugRenderer(renderblocks, block, state, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
|
@ -252,100 +253,59 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** WHOLE BUNCH OF OLD (WORKING) RENDER CODE, WILL CLEAN UP LATER **/
|
||||
private void pipePlugRenderer(RenderBlocks renderblocks, Block block, PipeRenderState state, int x, int y, int z) {
|
||||
|
||||
float zFightOffset = 1F / 4096F;
|
||||
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.WEST)){
|
||||
// MinecraftForgeClient.bindTexture(state.facadeMatrix.getTextureFile(ForgeDirection.WEST));
|
||||
// state.currentTextureIndex = state.facadeMatrix.getTextureIndex(ForgeDirection.WEST);
|
||||
// block.setBlockBounds(0.0F - zFightOffset, 0.0F, 0.0F, facadeThickness, 1.0F, 1F);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.EAST)){
|
||||
// MinecraftForgeClient.bindTexture(state.facadeMatrix.getTextureFile(ForgeDirection.EAST));
|
||||
// state.currentTextureIndex = state.facadeMatrix.getTextureIndex(ForgeDirection.EAST);
|
||||
// block.setBlockBounds(1F-facadeThickness, 0.0F, 0.0F, 1.0F + zFightOffset, 1.0F, 1F);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.DOWN)){
|
||||
// MinecraftForgeClient.bindTexture(state.facadeMatrix.getTextureFile(ForgeDirection.DOWN));
|
||||
// state.currentTextureIndex = state.facadeMatrix.getTextureIndex(ForgeDirection.DOWN);
|
||||
// block.setBlockBounds(0.0F, 0.0F - zFightOffset, 0.0F, 1.0F, facadeThickness, 1F);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.UP)){
|
||||
// MinecraftForgeClient.bindTexture(state.facadeMatrix.getTextureFile(ForgeDirection.UP));
|
||||
// state.currentTextureIndex = state.facadeMatrix.getTextureIndex(ForgeDirection.UP);
|
||||
//
|
||||
// if (state.pipeConnectionMatrix.isConnected(ForgeDirection.UP)){
|
||||
// block.setBlockBounds(0.0F, 1F-facadeThickness, 0.0F, 1.0F - Utils.pipeMaxPos, 1.0F + zFightOffset / 2 , 1F);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
//
|
||||
// block.setBlockBounds(0.0F, 1F-facadeThickness, 0.0F, 1.0F, 1.0F + zFightOffset , 1F - Utils.pipeMaxPos);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
//
|
||||
// block.setBlockBounds(0.0F + Utils.pipeMaxPos, 1F-facadeThickness, 0.0F, 1.0F, 1.0F + zFightOffset / 2 , 1F);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
//
|
||||
// block.setBlockBounds(0.0F, 1F-facadeThickness, 0.0F + Utils.pipeMaxPos, 1.0F, 1.0F + zFightOffset , 1F);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// } else {
|
||||
// block.setBlockBounds(0.0F, 1F-facadeThickness, 0.0F, 1.0F, 1.0F + zFightOffset , 1F);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.NORTH)){
|
||||
// MinecraftForgeClient.bindTexture(state.facadeMatrix.getTextureFile(ForgeDirection.NORTH));
|
||||
// state.currentTextureIndex = state.facadeMatrix.getTextureIndex(ForgeDirection.NORTH);
|
||||
// block.setBlockBounds(0.0F, 0.0F, 0.0F - zFightOffset, 1.0F, 1F, facadeThickness);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.SOUTH)){
|
||||
// MinecraftForgeClient.bindTexture(state.facadeMatrix.getTextureFile(ForgeDirection.SOUTH));
|
||||
// state.currentTextureIndex = state.facadeMatrix.getTextureIndex(ForgeDirection.SOUTH);
|
||||
// block.setBlockBounds(0.0F, 0.0F, 1F-facadeThickness, 1.0F, 1F, 1.0F + zFightOffset);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
// MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_BLOCKS);
|
||||
// state.currentTextureIndex = 7 * 16 + 13; // Structure Pipe
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.WEST) && !state.pipeConnectionMatrix.isConnected(ForgeDirection.WEST)){
|
||||
// block.setBlockBounds(0 + facadeThickness, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.EAST) && !state.pipeConnectionMatrix.isConnected(ForgeDirection.EAST)){
|
||||
// block.setBlockBounds(Utils.pipeMaxPos, Utils.pipeMinPos, Utils.pipeMinPos, 1F - facadeThickness, Utils.pipeMaxPos, Utils.pipeMaxPos);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.DOWN) && !state.pipeConnectionMatrix.isConnected(ForgeDirection.DOWN)){
|
||||
// block.setBlockBounds(Utils.pipeMinPos, 0 + facadeThickness, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMinPos, Utils.pipeMaxPos);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.UP) && !state.pipeConnectionMatrix.isConnected(ForgeDirection.UP)){
|
||||
// block.setBlockBounds(Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMinPos, Utils.pipeMaxPos, 1F - facadeThickness, Utils.pipeMaxPos);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.NORTH) && !state.pipeConnectionMatrix.isConnected(ForgeDirection.NORTH)){
|
||||
// block.setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, 0 + facadeThickness, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMinPos);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
//
|
||||
// if (state.facadeMatrix.isConnected(ForgeDirection.SOUTH) && !state.pipeConnectionMatrix.isConnected(ForgeDirection.SOUTH)){
|
||||
// block.setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos, 1F - facadeThickness);
|
||||
// renderblocks.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
float[][] zeroState = new float[3][2];
|
||||
// X START - END
|
||||
zeroState[0][0] = 0.25F + zFightOffset;
|
||||
zeroState[0][1] = 0.75F - zFightOffset;
|
||||
// Y START - END
|
||||
zeroState[1][0] = 0.125F;
|
||||
zeroState[1][1] = 0.25F;
|
||||
// Z START - END
|
||||
zeroState[2][0] = 0.25F + zFightOffset;
|
||||
zeroState[2][1] = 0.75F - zFightOffset;
|
||||
|
||||
state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure Pipe
|
||||
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (state.plugMatrix.isConnected(direction)) {
|
||||
float[][] rotated = deepClone(zeroState);
|
||||
transform(rotated, direction);
|
||||
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
// X START - END
|
||||
zeroState[0][0] = 0.25F + 0.125F/2 + zFightOffset;
|
||||
zeroState[0][1] = 0.75F - 0.125F/2 + zFightOffset;
|
||||
// Y START - END
|
||||
zeroState[1][0] = 0.25F;
|
||||
zeroState[1][1] = 0.25F + 0.125F;
|
||||
// Z START - END
|
||||
zeroState[2][0] = 0.25F + 0.125F/2;
|
||||
zeroState[2][1] = 0.75F - 0.125F/2;
|
||||
|
||||
state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure Pipe
|
||||
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (state.plugMatrix.isConnected(direction)) {
|
||||
float[][] rotated = deepClone(zeroState);
|
||||
transform(rotated, direction);
|
||||
|
||||
block.setBlockBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
|
||||
renderblocks.setRenderBoundsFromBlock(block);
|
||||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void pipeWireRender(RenderBlocks renderblocks, Block block, PipeRenderState state, float cx, float cy, float cz, IPipe.WireColor color, int x,
|
||||
|
@ -518,7 +478,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
}
|
||||
|
||||
private boolean shouldRenderNormalPipeSide(PipeRenderState state, ForgeDirection direction){
|
||||
return !state.pipeConnectionMatrix.isConnected(direction) && state.facadeMatrix.getFacadeBlockId(direction) == 0;
|
||||
return !state.pipeConnectionMatrix.isConnected(direction) && state.facadeMatrix.getFacadeBlockId(direction) == 0 && !state.plugMatrix.isConnected(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
97
common/buildcraft/transport/render/PlugItemRenderer.java
Normal file
97
common/buildcraft/transport/render/PlugItemRenderer.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
package buildcraft.transport.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
|
||||
public class PlugItemRenderer implements IItemRenderer{
|
||||
|
||||
private void renderPlugItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) {
|
||||
// Render StructurePipe
|
||||
Block block = BuildCraftTransport.genericPipeBlock;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
block = BuildCraftTransport.genericPipeBlock;
|
||||
Icon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure pipe
|
||||
|
||||
block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F);
|
||||
block.setBlockBoundsForItemRender();
|
||||
render.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(translateX, translateY, translateZ + 0.25F);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -0F, 0.0F);
|
||||
render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.50F, 0.50F, 0.50F);
|
||||
renderPlugItem((RenderBlocks) data[0], item, -0.6F, 0f, -0.6F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderPlugItem((RenderBlocks) data[0], item, 0F, 0F, 0f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1.1F, 1.1F, 1.1F);
|
||||
renderPlugItem((RenderBlocks) data[0], item, -0.3f, -0.35f, -0.7f);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue