Merge branch 'master' into SandGrainOne-FilteredBuffer
This commit is contained in:
commit
9489bbb508
4 changed files with 322 additions and 302 deletions
|
@ -1,12 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* Copyright (c) SpaceToad, 2011 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
|
||||
* 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -51,27 +49,26 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockGenericPipe extends BlockContainer {
|
||||
|
||||
static enum Part {
|
||||
|
||||
Pipe,
|
||||
Gate
|
||||
}
|
||||
|
||||
static class RaytraceResult {
|
||||
|
||||
RaytraceResult(Part hitPart, MovingObjectPosition movingObjectPosition) {
|
||||
this.hitPart = hitPart;
|
||||
this.movingObjectPosition = movingObjectPosition;
|
||||
}
|
||||
|
||||
public Part hitPart;
|
||||
public MovingObjectPosition movingObjectPosition;
|
||||
}
|
||||
|
||||
private static Random rand = new Random();
|
||||
|
||||
private boolean skippedFirstIconRegister;
|
||||
|
||||
/* Defined subprograms ************************************************* */
|
||||
|
||||
public BlockGenericPipe(int i) {
|
||||
super(i, Material.glass);
|
||||
|
||||
|
@ -198,31 +195,31 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
TileEntity tile1 = world.getBlockTileEntity(i, j, k);
|
||||
TileGenericPipe tileG = (TileGenericPipe) tile1;
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i - 1, j, k) || (tileG != null && tileG.hasFacade(ForgeDirection.WEST))) {
|
||||
xMin = 0.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i + 1, j, k) || (tileG != null && tileG.hasFacade(ForgeDirection.EAST))) {
|
||||
xMax = 1.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i, j - 1, k) || (tileG != null && tileG.hasFacade(ForgeDirection.DOWN))) {
|
||||
yMin = 0.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i, j + 1, k) || (tileG != null && tileG.hasFacade(ForgeDirection.UP))) {
|
||||
yMax = 1.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i, j, k - 1) || (tileG != null && tileG.hasFacade(ForgeDirection.NORTH))) {
|
||||
zMin = 0.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i, j, k + 1) || (tileG != null && tileG.hasFacade(ForgeDirection.SOUTH))) {
|
||||
zMax = 1.0F;
|
||||
}
|
||||
|
||||
if (tileG != null) {
|
||||
if (Utils.checkPipesConnections(world, tile1, i - 1, j, k) || tileG.hasFacade(ForgeDirection.WEST)) {
|
||||
xMin = 0.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i + 1, j, k) || tileG.hasFacade(ForgeDirection.EAST)) {
|
||||
xMax = 1.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i, j - 1, k) || tileG.hasFacade(ForgeDirection.DOWN)) {
|
||||
yMin = 0.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i, j + 1, k) || tileG.hasFacade(ForgeDirection.UP)) {
|
||||
yMax = 1.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i, j, k - 1) || tileG.hasFacade(ForgeDirection.NORTH)) {
|
||||
zMin = 0.0F;
|
||||
}
|
||||
|
||||
if (Utils.checkPipesConnections(world, tile1, i, j, k + 1) || tileG.hasFacade(ForgeDirection.SOUTH)) {
|
||||
zMax = 1.0F;
|
||||
}
|
||||
|
||||
if (tileG.hasFacade(ForgeDirection.EAST) || tileG.hasFacade(ForgeDirection.WEST)) {
|
||||
yMin = 0.0F;
|
||||
yMax = 1.0F;
|
||||
|
@ -263,15 +260,15 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
double pitch = Math.toRadians(entityPlayer.rotationPitch);
|
||||
double yaw = Math.toRadians(entityPlayer.rotationYaw);
|
||||
|
||||
double dirX = -Math.sin(yaw) * Math.cos(pitch);
|
||||
double dirY = -Math.sin(pitch);
|
||||
double dirZ = Math.cos(yaw) * Math.cos(pitch);
|
||||
double dirX = -Math.sin(yaw) * Math.cos(pitch);
|
||||
double dirY = -Math.sin(pitch);
|
||||
double dirZ = Math.cos(yaw) * Math.cos(pitch);
|
||||
|
||||
double reachDistance = 5;
|
||||
double reachDistance = 5;
|
||||
|
||||
if (entityPlayer instanceof EntityPlayerMP) {
|
||||
reachDistance = ((EntityPlayerMP) entityPlayer).theItemInWorldManager.getBlockReachDistance();
|
||||
}
|
||||
if (entityPlayer instanceof EntityPlayerMP) {
|
||||
reachDistance = ((EntityPlayerMP) entityPlayer).theItemInWorldManager.getBlockReachDistance();
|
||||
}
|
||||
|
||||
Vec3 origin = Vec3.fakePool.getVecFromPool(entityPlayer.posX, entityPlayer.posY + 1.62 - entityPlayer.yOffset, entityPlayer.posZ);
|
||||
Vec3 direction = origin.addVector(dirX * reachDistance, dirY * reachDistance, dirZ * reachDistance);
|
||||
|
@ -290,9 +287,10 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
* pipe hits along x, y, and z axis, gate (all 6 sides) [and wires+facades]
|
||||
* pipe hits along x, y, and z axis, gate (all 6 sides) [and
|
||||
* wires+facades]
|
||||
*/
|
||||
MovingObjectPosition[] hits = new MovingObjectPosition[] { null, null, null, null, null, null, null, null, null };
|
||||
MovingObjectPosition[] hits = new MovingObjectPosition[]{null, null, null, null, null, null, null, null, null};
|
||||
|
||||
boolean needAxisCheck = false;
|
||||
boolean needCenterCheck = true;
|
||||
|
@ -390,7 +388,8 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
|
||||
for (int i = 0; i < hits.length; i++) {
|
||||
MovingObjectPosition hit = hits[i];
|
||||
if (hit == null) continue;
|
||||
if (hit == null)
|
||||
continue;
|
||||
|
||||
double lengthSquared = hit.hitVec.squareDistanceTo(origin);
|
||||
|
||||
|
@ -424,24 +423,24 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
float max = Utils.pipeMaxPos - 0.05F;
|
||||
|
||||
switch (dir) {
|
||||
case DOWN:
|
||||
setBlockBounds(min, Utils.pipeMinPos - 0.10F, min, max, Utils.pipeMinPos, max);
|
||||
break;
|
||||
case UP:
|
||||
setBlockBounds(min, Utils.pipeMaxPos, min, max, Utils.pipeMaxPos + 0.10F, max);
|
||||
break;
|
||||
case NORTH:
|
||||
setBlockBounds(min, min, Utils.pipeMinPos - 0.10F, max, max, Utils.pipeMinPos);
|
||||
break;
|
||||
case SOUTH:
|
||||
setBlockBounds(min, min, Utils.pipeMaxPos, max, max, Utils.pipeMaxPos + 0.10F);
|
||||
break;
|
||||
case WEST:
|
||||
setBlockBounds(Utils.pipeMinPos - 0.10F, min, min, Utils.pipeMinPos, max, max);
|
||||
break;
|
||||
case EAST:
|
||||
setBlockBounds(Utils.pipeMaxPos, min, min, Utils.pipeMaxPos + 0.10F, max, max);
|
||||
break;
|
||||
case DOWN:
|
||||
setBlockBounds(min, Utils.pipeMinPos - 0.10F, min, max, Utils.pipeMinPos, max);
|
||||
break;
|
||||
case UP:
|
||||
setBlockBounds(min, Utils.pipeMaxPos, min, max, Utils.pipeMaxPos + 0.10F, max);
|
||||
break;
|
||||
case NORTH:
|
||||
setBlockBounds(min, min, Utils.pipeMinPos - 0.10F, max, max, Utils.pipeMinPos);
|
||||
break;
|
||||
case SOUTH:
|
||||
setBlockBounds(min, min, Utils.pipeMaxPos, max, max, Utils.pipeMaxPos + 0.10F);
|
||||
break;
|
||||
case WEST:
|
||||
setBlockBounds(Utils.pipeMinPos - 0.10F, min, min, Utils.pipeMinPos, max, max);
|
||||
break;
|
||||
case EAST:
|
||||
setBlockBounds(Utils.pipeMaxPos, min, min, Utils.pipeMaxPos + 0.10F, max, max);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,6 +502,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World var1) {
|
||||
return new TileGenericPipe();
|
||||
}
|
||||
|
@ -554,7 +554,6 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
}
|
||||
|
||||
/* Wrappers ************************************************************ */
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int l) {
|
||||
super.onNeighborBlockChange(world, x, y, z, l);
|
||||
|
@ -607,7 +606,6 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
return stripEquipment(pipe);
|
||||
|
||||
} else if (entityplayer.getCurrentEquippedItem() == null) {
|
||||
|
||||
// Fall through the end of the test
|
||||
} else if (entityplayer.getCurrentEquippedItem().itemID == Item.sign.itemID)
|
||||
// Sign will be placed anyway, so lets show the sign gui
|
||||
|
@ -694,7 +692,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
private boolean stripEquipment(Pipe pipe) {
|
||||
|
||||
// Try to strip wires first, starting with yellow.
|
||||
for (IPipe.WireColor color : IPipe.WireColor.values())
|
||||
for (IPipe.WireColor color : IPipe.WireColor.values()) {
|
||||
if (pipe.wireSet[color.reverse().ordinal()]) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(pipe.worldObj)) {
|
||||
dropWire(color.reverse(), pipe.worldObj, pipe.xCoord, pipe.yCoord, pipe.zCoord);
|
||||
|
@ -704,6 +702,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
pipe.container.scheduleRenderUpdate();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to strip gate next
|
||||
if (pipe.hasGate()) {
|
||||
|
@ -726,23 +725,23 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
|
||||
Item wireItem;
|
||||
switch (color) {
|
||||
case Red:
|
||||
wireItem = BuildCraftTransport.redPipeWire;
|
||||
break;
|
||||
case Blue:
|
||||
wireItem = BuildCraftTransport.bluePipeWire;
|
||||
break;
|
||||
case Green:
|
||||
wireItem = BuildCraftTransport.greenPipeWire;
|
||||
break;
|
||||
default:
|
||||
wireItem = BuildCraftTransport.yellowPipeWire;
|
||||
case Red:
|
||||
wireItem = BuildCraftTransport.redPipeWire;
|
||||
break;
|
||||
case Blue:
|
||||
wireItem = BuildCraftTransport.bluePipeWire;
|
||||
break;
|
||||
case Green:
|
||||
wireItem = BuildCraftTransport.greenPipeWire;
|
||||
break;
|
||||
default:
|
||||
wireItem = BuildCraftTransport.yellowPipeWire;
|
||||
}
|
||||
Utils.dropItems(world, new ItemStack(wireItem), i, j, k);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "all" })
|
||||
@SuppressWarnings({"all"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
|
||||
|
@ -811,7 +810,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
return 0;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "all" })
|
||||
@SuppressWarnings({"all"})
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int i, int j, int k, Random random) {
|
||||
Pipe pipe = getPipe(world, i, j, k);
|
||||
|
@ -822,9 +821,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
}
|
||||
|
||||
/* Registration ******************************************************** */
|
||||
|
||||
public static Map<Integer, Class<? extends Pipe>> pipes = new HashMap<Integer, Class<? extends Pipe>>();
|
||||
|
||||
static long lastRemovedDate = -1;
|
||||
public static Map<BlockIndex, Pipe> pipeRemoved = new HashMap<BlockIndex, Pipe>();
|
||||
|
||||
|
@ -899,17 +896,16 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
if (!skippedFirstIconRegister){
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
if (!skippedFirstIconRegister) {
|
||||
skippedFirstIconRegister = true;
|
||||
return;
|
||||
}
|
||||
BuildCraftTransport.instance.gateIconProvider.registerIcons(iconRegister);
|
||||
BuildCraftTransport.instance.wireIconProvider.registerIcons(iconRegister);
|
||||
for (int i : pipes.keySet()){
|
||||
for (int i : pipes.keySet()) {
|
||||
Pipe dummyPipe = createPipe(i);
|
||||
if (dummyPipe != null){
|
||||
if (dummyPipe != null) {
|
||||
dummyPipe.getIconProvider().registerIcons(iconRegister);
|
||||
}
|
||||
}
|
||||
|
@ -922,102 +918,113 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
* Spawn a digging particle effect in the world, this is a wrapper around
|
||||
* EffectRenderer.addBlockHitEffects to allow the block more control over
|
||||
* the particles. Useful when you have entirely different texture sheets for
|
||||
* different sides/locations in the world.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param target The target the player is looking at {x/y/z/side/sub}
|
||||
* @param effectRenderer A reference to the current effect renderer.
|
||||
* @return True to prevent vanilla digging particles form spawning.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addBlockHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
|
||||
int x = target.blockX;
|
||||
int y = target.blockY;
|
||||
int z = target.blockZ;
|
||||
* Spawn a digging particle effect in the world, this is a wrapper around
|
||||
* EffectRenderer.addBlockHitEffects to allow the block more control over
|
||||
* the particles. Useful when you have entirely different texture sheets for
|
||||
* different sides/locations in the world.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param target The target the player is looking at {x/y/z/side/sub}
|
||||
* @param effectRenderer A reference to the current effect renderer.
|
||||
* @return True to prevent vanilla digging particles form spawning.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addBlockHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
|
||||
int x = target.blockX;
|
||||
int y = target.blockY;
|
||||
int z = target.blockZ;
|
||||
|
||||
Pipe pipe = getPipe(worldObj, x, y, z);
|
||||
if (pipe == null) return false;
|
||||
Pipe pipe = getPipe(worldObj, x, y, z);
|
||||
if (pipe == null)
|
||||
return false;
|
||||
|
||||
Icon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
||||
Icon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
||||
|
||||
int sideHit = target.sideHit;
|
||||
int sideHit = target.sideHit;
|
||||
|
||||
Block block = BuildCraftTransport.genericPipeBlock;
|
||||
float b = 0.1F;
|
||||
double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (b * 2.0F)) + b + block.getBlockBoundsMinX();
|
||||
double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (b * 2.0F)) + b + block.getBlockBoundsMinY();
|
||||
double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (b * 2.0F)) + b + block.getBlockBoundsMinZ();
|
||||
Block block = BuildCraftTransport.genericPipeBlock;
|
||||
float b = 0.1F;
|
||||
double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (b * 2.0F)) + b + block.getBlockBoundsMinX();
|
||||
double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (b * 2.0F)) + b + block.getBlockBoundsMinY();
|
||||
double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (b * 2.0F)) + b + block.getBlockBoundsMinZ();
|
||||
|
||||
if (sideHit == 0) {
|
||||
py = (double) y + block.getBlockBoundsMinY() - (double) b;
|
||||
}
|
||||
if (sideHit == 0) {
|
||||
py = (double) y + block.getBlockBoundsMinY() - (double) b;
|
||||
}
|
||||
|
||||
if (sideHit == 1) {
|
||||
py = (double) y + block.getBlockBoundsMaxY() + (double) b;
|
||||
}
|
||||
if (sideHit == 1) {
|
||||
py = (double) y + block.getBlockBoundsMaxY() + (double) b;
|
||||
}
|
||||
|
||||
if (sideHit == 2) {
|
||||
pz = (double) z + block.getBlockBoundsMinZ() - (double) b;
|
||||
}
|
||||
if (sideHit == 2) {
|
||||
pz = (double) z + block.getBlockBoundsMinZ() - (double) b;
|
||||
}
|
||||
|
||||
if (sideHit == 3) {
|
||||
pz = (double) z + block.getBlockBoundsMaxZ() + (double) b;
|
||||
}
|
||||
if (sideHit == 3) {
|
||||
pz = (double) z + block.getBlockBoundsMaxZ() + (double) b;
|
||||
}
|
||||
|
||||
if (sideHit == 4) {
|
||||
px = (double) x + block.getBlockBoundsMinX() - (double) b;
|
||||
}
|
||||
if (sideHit == 4) {
|
||||
px = (double) x + block.getBlockBoundsMinX() - (double) b;
|
||||
}
|
||||
|
||||
if (sideHit == 5) {
|
||||
px = (double) x + block.getBlockBoundsMaxX() + (double) b;
|
||||
}
|
||||
if (sideHit == 5) {
|
||||
px = (double) x + block.getBlockBoundsMaxX() + (double) b;
|
||||
}
|
||||
|
||||
EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, 0.0D, 0.0D, 0.0D, block, sideHit, worldObj.getBlockMetadata(x, y, z), Minecraft.getMinecraft().renderEngine);
|
||||
EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, 0.0D, 0.0D, 0.0D, block, sideHit, worldObj.getBlockMetadata(x, y, z), Minecraft.getMinecraft().renderEngine);
|
||||
fx.setParticleIcon(Minecraft.getMinecraft().renderEngine, icon);
|
||||
effectRenderer.addEffect(fx.func_70596_a(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
|
||||
return true;
|
||||
}
|
||||
effectRenderer.addEffect(fx.func_70596_a(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn particles for when the block is destroyed. Due to the nature of how
|
||||
* this is invoked, the x/y/z locations are not always guaranteed to host
|
||||
* your block. So be sure to do proper sanity checks before assuming that
|
||||
* the location is this block.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param x X position to spawn the particle
|
||||
* @param y Y position to spawn the particle
|
||||
* @param z Z position to spawn the particle
|
||||
* @param meta The metadata for the block before it was destroyed.
|
||||
* @param effectRenderer A reference to the current effect renderer.
|
||||
* @return True to prevent vanilla break particles from spawning.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addBlockDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
||||
Pipe pipe = getPipe(worldObj, x, y, z);
|
||||
if (pipe == null) return false;
|
||||
/**
|
||||
* Spawn particles for when the block is destroyed. Due to the nature of how
|
||||
* this is invoked, the x/y/z locations are not always guaranteed to host
|
||||
* your block. So be sure to do proper sanity checks before assuming that
|
||||
* the location is this block.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param x X position to spawn the particle
|
||||
* @param y Y position to spawn the particle
|
||||
* @param z Z position to spawn the particle
|
||||
* @param meta The metadata for the block before it was destroyed.
|
||||
* @param effectRenderer A reference to the current effect renderer.
|
||||
* @return True to prevent vanilla break particles from spawning.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addBlockDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
|
||||
Pipe pipe = getPipe(worldObj, x, y, z);
|
||||
if (pipe == null)
|
||||
return false;
|
||||
|
||||
Icon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
||||
Icon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
|
||||
|
||||
byte its = 4;
|
||||
for (int i = 0; i < its; ++i) {
|
||||
for (int j = 0; j < its; ++j) {
|
||||
for (int k = 0; k < its; ++k) {
|
||||
double px = x + (i + 0.5D) / (double) its;
|
||||
double py = y + (j + 0.5D) / (double) its;
|
||||
double pz = z + (k + 0.5D) / (double) its;
|
||||
int random = rand.nextInt(6);
|
||||
EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, px - x - 0.5D, py - y - 0.5D, pz - z - 0.5D, BuildCraftTransport.genericPipeBlock, random, meta, Minecraft.getMinecraft().renderEngine);
|
||||
byte its = 4;
|
||||
for (int i = 0; i < its; ++i) {
|
||||
for (int j = 0; j < its; ++j) {
|
||||
for (int k = 0; k < its; ++k) {
|
||||
double px = x + (i + 0.5D) / (double) its;
|
||||
double py = y + (j + 0.5D) / (double) its;
|
||||
double pz = z + (k + 0.5D) / (double) its;
|
||||
int random = rand.nextInt(6);
|
||||
EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, px - x - 0.5D, py - y - 0.5D, pz - z - 0.5D, BuildCraftTransport.genericPipeBlock, random, meta, Minecraft.getMinecraft().renderEngine);
|
||||
fx.setParticleIcon(Minecraft.getMinecraft().renderEngine, icon);
|
||||
effectRenderer.addEffect(fx.func_70596_a(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
effectRenderer.addEffect(fx.func_70596_a(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static int facadeRenderColor = -1;
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
if (facadeRenderColor != -1) {
|
||||
return facadeRenderColor;
|
||||
}
|
||||
return super.colorMultiplier(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* Copyright (c) SpaceToad, 2011 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
|
||||
* 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;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
|
@ -73,29 +71,22 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
pipeId = data.readInt();
|
||||
gateKind = data.readInt();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private PipeRenderState renderState = new PipeRenderState();
|
||||
private CoreState coreState = new CoreState();
|
||||
private boolean deletePipe = false;
|
||||
|
||||
public TileBuffer[] tileBuffer;
|
||||
public boolean[] pipeConnectionsBuffer = new boolean[6];
|
||||
|
||||
public SafeTimeTracker networkSyncTracker = new SafeTimeTracker();
|
||||
|
||||
public Pipe pipe;
|
||||
private boolean blockNeighborChange = false;
|
||||
private boolean refreshRenderState = false;
|
||||
private boolean pipeBound = false;
|
||||
|
||||
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() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,13 +147,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
pipe.validate();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean initialized = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(deletePipe){
|
||||
|
||||
if (deletePipe) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
|
@ -224,23 +214,23 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
renderState.wireMatrix.setWireConnected(color, direction, pipe.isWireConnectedTo(this.getTile(direction), color));
|
||||
}
|
||||
boolean lit = pipe.signalStrength[color.ordinal()] > 0;
|
||||
|
||||
switch(color){
|
||||
case Red:
|
||||
renderState.wireMatrix.setWireIndex(color, lit? WireIconProvider.Texture_Red_Lit : WireIconProvider.Texture_Red_Dark);
|
||||
break;
|
||||
case Blue:
|
||||
renderState.wireMatrix.setWireIndex(color, lit? WireIconProvider.Texture_Blue_Lit : WireIconProvider.Texture_Blue_Dark);
|
||||
break;
|
||||
case Green:
|
||||
renderState.wireMatrix.setWireIndex(color, lit? WireIconProvider.Texture_Green_Lit : WireIconProvider.Texture_Green_Dark);
|
||||
break;
|
||||
case Yellow:
|
||||
renderState.wireMatrix.setWireIndex(color, lit? WireIconProvider.Texture_Yellow_Lit : WireIconProvider.Texture_Yellow_Dark);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
|
||||
switch (color) {
|
||||
case Red:
|
||||
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Red_Lit : WireIconProvider.Texture_Red_Dark);
|
||||
break;
|
||||
case Blue:
|
||||
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Blue_Lit : WireIconProvider.Texture_Blue_Dark);
|
||||
break;
|
||||
case Green:
|
||||
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Green_Lit : WireIconProvider.Texture_Green_Dark);
|
||||
break;
|
||||
case Yellow:
|
||||
renderState.wireMatrix.setWireIndex(color, lit ? WireIconProvider.Texture_Yellow_Lit : WireIconProvider.Texture_Yellow_Dark);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,10 +245,10 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
}
|
||||
|
||||
//Plugs
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS){
|
||||
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();
|
||||
|
@ -268,8 +258,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
public void initialize(Pipe pipe) {
|
||||
|
||||
this.blockType = getBlockType();
|
||||
|
||||
if(pipe == null){
|
||||
|
||||
if (pipe == null) {
|
||||
BuildCraftCore.bcLog.log(Level.WARNING, "Pipe failed to initialize at {0},{1},{2}, deleting", new Object[]{xCoord, yCoord, zCoord});
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
return;
|
||||
|
@ -444,7 +434,6 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
@Override
|
||||
public void blockRemoved(ForgeDirection from) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -472,21 +461,23 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
|
||||
/**
|
||||
* Checks if this tile is connected to another tile
|
||||
*
|
||||
* @param with - The other Tile
|
||||
* @param side - The orientation to get to the other tile ('with')
|
||||
* @return true if pipes are considered connected
|
||||
*/
|
||||
|
||||
protected boolean arePipesConnected(TileEntity with, ForgeDirection side) {
|
||||
Pipe pipe1 = pipe;
|
||||
|
||||
if (hasPlug(side)) return false;
|
||||
|
||||
if (hasPlug(side))
|
||||
return false;
|
||||
|
||||
if (!BlockGenericPipe.isValid(pipe1))
|
||||
return false;
|
||||
|
||||
if (with instanceof TileGenericPipe) {
|
||||
if (((TileGenericPipe)with).hasPlug(side.getOpposite())) return false;
|
||||
if (((TileGenericPipe) with).hasPlug(side.getOpposite()))
|
||||
return false;
|
||||
Pipe pipe2 = ((TileGenericPipe) with).pipe;
|
||||
|
||||
if (!BlockGenericPipe.isValid(pipe2))
|
||||
|
@ -503,12 +494,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
if (tileBuffer != null) {
|
||||
pipeConnectionsBuffer = new boolean[6];
|
||||
|
||||
for (int i = 0; i < tileBuffer.length; ++i) {
|
||||
TileBuffer t = tileBuffer[i];
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileBuffer t = tileBuffer[side.ordinal()];
|
||||
t.refresh();
|
||||
|
||||
if (t.getTile() != null) {
|
||||
pipeConnectionsBuffer[i] = arePipesConnected(t.getTile(), ForgeDirection.VALID_DIRECTIONS[i]);
|
||||
pipeConnectionsBuffer[side.ordinal()] = arePipesConnected(t.getTile(), side);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -534,11 +525,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
}
|
||||
}
|
||||
|
||||
/** ITankContainer implementation **/
|
||||
|
||||
/**
|
||||
* ITankContainer implementation *
|
||||
*/
|
||||
@Override
|
||||
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill) {
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof ITankContainer)
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof ITankContainer && !hasPlug(from))
|
||||
return ((ITankContainer) pipe.transport).fill(from, resource, doFill);
|
||||
else
|
||||
return 0;
|
||||
|
@ -554,7 +546,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
|
||||
@Override
|
||||
public LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof ITankContainer)
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof ITankContainer && !hasPlug(from))
|
||||
return ((ITankContainer) pipe.transport).drain(from, maxDrain, doDrain);
|
||||
else
|
||||
return null;
|
||||
|
@ -602,8 +594,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
return renderState.facadeMatrix.getFacadeBlockId(direction) != 0;
|
||||
return (this.facadeBlocks[direction.ordinal()] != 0);
|
||||
}
|
||||
|
||||
private void dropFacadeItem(ForgeDirection direction){
|
||||
|
||||
private void dropFacadeItem(ForgeDirection direction) {
|
||||
Utils.dropItems(worldObj, ItemFacade.getStack(this.facadeBlocks[direction.ordinal()], this.facadeMeta[direction.ordinal()]), this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
|
@ -619,29 +611,31 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
scheduleRenderUpdate();
|
||||
}
|
||||
|
||||
/** IPipeRenderState implementation **/
|
||||
|
||||
/**
|
||||
* IPipeRenderState implementation *
|
||||
*/
|
||||
@Override
|
||||
public PipeRenderState getRenderState() {
|
||||
return renderState;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIconProvider getPipeIcons() {
|
||||
if (pipe == null) return null;
|
||||
if (pipe == null)
|
||||
return null;
|
||||
return pipe.getIconProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClientState getStateInstance(byte stateId) {
|
||||
switch (stateId) {
|
||||
case 0:
|
||||
return coreState;
|
||||
case 1:
|
||||
return renderState;
|
||||
case 2:
|
||||
return (IClientState) pipe;
|
||||
case 0:
|
||||
return coreState;
|
||||
case 1:
|
||||
return renderState;
|
||||
case 2:
|
||||
return (IClientState) pipe;
|
||||
}
|
||||
throw new RuntimeException("Unknown state requested: " + stateId + " this is a bug!");
|
||||
}
|
||||
|
@ -652,17 +646,17 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
return;
|
||||
|
||||
switch (stateId) {
|
||||
case 0:
|
||||
if (pipe == null && coreState.pipeId != 0) {
|
||||
initialize(BlockGenericPipe.createPipe(coreState.pipeId));
|
||||
}
|
||||
if (pipe != null && coreState.gateKind != GateKind.None.ordinal()) {
|
||||
if (pipe.gate == null) {
|
||||
pipe.gate = new GateVanilla(pipe);
|
||||
case 0:
|
||||
if (pipe == null && coreState.pipeId != 0) {
|
||||
initialize(BlockGenericPipe.createPipe(coreState.pipeId));
|
||||
}
|
||||
pipe.gate.kind = GateKind.values()[coreState.gateKind];
|
||||
}
|
||||
break;
|
||||
if (pipe != null && coreState.gateKind != GateKind.None.ordinal()) {
|
||||
if (pipe.gate == null) {
|
||||
pipe.gate = new GateVanilla(pipe);
|
||||
}
|
||||
pipe.gate.kind = GateKind.values()[coreState.gateKind];
|
||||
}
|
||||
break;
|
||||
}
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
@ -699,12 +693,15 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
}
|
||||
|
||||
public boolean hasPlug(ForgeDirection forgeDirection) {
|
||||
if (this.worldObj.isRemote)
|
||||
return renderState.plugMatrix.isConnected(forgeDirection);
|
||||
return plugs[forgeDirection.ordinal()];
|
||||
}
|
||||
|
||||
public void removeAndDropPlug(ForgeDirection forgeDirection) {
|
||||
if (!hasPlug(forgeDirection)) return;
|
||||
|
||||
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, getBlockId());
|
||||
|
@ -713,8 +710,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
}
|
||||
|
||||
public boolean addPlug(ForgeDirection forgeDirection) {
|
||||
if (hasPlug(forgeDirection)) return false;
|
||||
|
||||
if (hasPlug(forgeDirection))
|
||||
return false;
|
||||
|
||||
plugs[forgeDirection.ordinal()] = true;
|
||||
worldObj.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, getBlockId());
|
||||
scheduleNeighborChange(); //To force recalculation of connections
|
||||
|
|
|
@ -13,14 +13,24 @@ import buildcraft.BuildCraftTransport;
|
|||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class FacadeItemRenderer implements IItemRenderer {
|
||||
|
||||
private void renderFacadeItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) {
|
||||
|
||||
|
||||
int decodedMeta = ItemFacade.getMetaData(item);
|
||||
int decodedBlockId = ItemFacade.getBlockId(item);
|
||||
|
||||
try {
|
||||
int color = Item.itemsList[decodedBlockId].getColorFromItemStack(new ItemStack(decodedBlockId, 1, decodedMeta), 0);
|
||||
float r = (float) (color >> 16 & 0xff) / 255F;
|
||||
float g = (float) (color >> 8 & 0xff) / 255F;
|
||||
float b = (float) (color & 0xff) / 255F;
|
||||
GL11.glColor4f(r, g, b, 1.0F);
|
||||
} catch (Throwable error) {
|
||||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
Block block = Block.blocksList[decodedBlockId];
|
||||
|
@ -100,14 +110,14 @@ public class FacadeItemRenderer implements IItemRenderer {
|
|||
@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;
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,19 +130,18 @@ public class FacadeItemRenderer implements IItemRenderer {
|
|||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.50F, 0.50F, 0.50F);
|
||||
renderFacadeItem((RenderBlocks) data[0], item, -0.6F, 0f, -0.6F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderFacadeItem((RenderBlocks) data[0], item, 0F, 0F, 0f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1.1F, 1.1F, 1.1F);
|
||||
renderFacadeItem((RenderBlocks) data[0], item, -0.3f, -0.35f, -0.7f);
|
||||
break;
|
||||
default:
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.50F, 0.50F, 0.50F);
|
||||
renderFacadeItem((RenderBlocks) data[0], item, -0.6F, 0f, -0.6F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderFacadeItem((RenderBlocks) data[0], item, 0F, 0F, 0f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1.1F, 1.1F, 1.1F);
|
||||
renderFacadeItem((RenderBlocks) data[0], item, -0.3f, -0.35f, -0.7f);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,11 +10,14 @@ import buildcraft.api.core.IIconProvider;
|
|||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.IPipe.WireColor;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.IPipeRenderState;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.PipeRenderState;
|
||||
import buildcraft.transport.TransportProxy;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
|
@ -32,11 +35,11 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* Shifts the coordinates around effectivly rotating something. Zero state is DOWN then -> NORTH -> WEST Note - To obtain Pos, do a mirrorY() before
|
||||
* Shifts the coordinates around effectivly rotating something. Zero state
|
||||
* is DOWN then -> NORTH -> WEST Note - To obtain Pos, do a mirrorY() before
|
||||
* rotating
|
||||
*
|
||||
* @param targetArray
|
||||
* the array that should be rotated
|
||||
* @param targetArray the array that should be rotated
|
||||
*/
|
||||
private void rotate(float[][] targetArray) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
@ -48,8 +51,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param targetArray
|
||||
* the array that should be transformed
|
||||
* @param targetArray the array that should be transformed
|
||||
* @param direction
|
||||
*/
|
||||
private void transform(float[][] targetArray, ForgeDirection direction) {
|
||||
|
@ -65,8 +67,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
/**
|
||||
* Clones both dimensions of a float[][]
|
||||
*
|
||||
* @param source
|
||||
* the float[][] to deepClone
|
||||
* @param source the float[][] to deepClone
|
||||
* @return
|
||||
*/
|
||||
private float[][] deepClone(float[][] source) {
|
||||
|
@ -84,7 +85,8 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
|
||||
PipeRenderState state = renderState.getRenderState();
|
||||
IIconProvider icons = renderState.getPipeIcons();
|
||||
if (icons == null) return;
|
||||
if (icons == null)
|
||||
return;
|
||||
|
||||
|
||||
state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UNKNOWN));
|
||||
|
@ -182,25 +184,28 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
zeroState[2][1] = 1.0F;
|
||||
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (state.facadeMatrix.getFacadeBlockId(direction) != 0) {
|
||||
Block renderBlock = Block.blocksList[state.facadeMatrix.getFacadeBlockId(direction)];
|
||||
int renderMeta = state.facadeMatrix.getFacadeMetaId(direction);
|
||||
state.currentTexture = renderBlock.getIcon(direction.ordinal(), renderMeta);
|
||||
int facadeId = state.facadeMatrix.getFacadeBlockId(direction);
|
||||
if (facadeId != 0) {
|
||||
Block renderBlock = Block.blocksList[facadeId];
|
||||
int renderMeta = state.facadeMatrix.getFacadeMetaId(direction);
|
||||
state.currentTexture = renderBlock.getIcon(direction.ordinal(), renderMeta);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
try {
|
||||
BlockGenericPipe.facadeRenderColor = Item.itemsList[state.facadeMatrix.getFacadeBlockId(direction)].getColorFromItemStack(new ItemStack(facadeId, 1, renderMeta), 0);
|
||||
} catch (Throwable error) {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// Hollow facade
|
||||
if (state.pipeConnectionMatrix.isConnected(direction)) {
|
||||
|
@ -246,15 +251,17 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
renderblocks.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (renderBlock.getRenderType() == 31) {
|
||||
renderblocks.uvRotateSouth = 0;
|
||||
renderblocks.uvRotateEast = 0;
|
||||
renderblocks.uvRotateWest = 0;
|
||||
renderblocks.uvRotateNorth = 0;
|
||||
renderblocks.uvRotateTop = 0;
|
||||
renderblocks.uvRotateBottom = 0;
|
||||
}
|
||||
if (renderBlock.getRenderType() == 31) {
|
||||
renderblocks.uvRotateSouth = 0;
|
||||
renderblocks.uvRotateEast = 0;
|
||||
renderblocks.uvRotateWest = 0;
|
||||
renderblocks.uvRotateNorth = 0;
|
||||
renderblocks.uvRotateTop = 0;
|
||||
renderblocks.uvRotateBottom = 0;
|
||||
}
|
||||
}
|
||||
|
||||
BlockGenericPipe.facadeRenderColor = -1;
|
||||
}
|
||||
|
||||
// X START - END
|
||||
|
@ -310,14 +317,14 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
}
|
||||
|
||||
// X START - END
|
||||
zeroState[0][0] = 0.25F + 0.125F/2 + zFightOffset;
|
||||
zeroState[0][1] = 0.75F - 0.125F/2 + zFightOffset;
|
||||
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;
|
||||
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
|
||||
|
||||
|
@ -503,14 +510,13 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean shouldRenderNormalPipeSide(PipeRenderState state, ForgeDirection direction){
|
||||
private boolean shouldRenderNormalPipeSide(PipeRenderState state, ForgeDirection direction) {
|
||||
return !state.pipeConnectionMatrix.isConnected(direction) && state.facadeMatrix.getFacadeBlockId(direction) == 0 && !state.plugMatrix.isConnected(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue