use of pneumaticCraft.common.tileentity.TileEntityElevatorBase in project PneumaticCraft by MineMaarten.
the class RenderElevatorFrame method renderWorldBlock.
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
boolean frameXPos = world.getBlock(x + 1, y, z) == Blockss.elevatorFrame;
boolean frameXNeg = world.getBlock(x - 1, y, z) == Blockss.elevatorFrame;
boolean frameZPos = world.getBlock(x, y, z + 1) == Blockss.elevatorFrame;
boolean frameZNeg = world.getBlock(x, y, z - 1) == Blockss.elevatorFrame;
TileEntityElevatorBase base = BlockElevatorFrame.getElevatorTE(world, x, y, z);
renderer.renderAllFaces = true;
if (base != null && base.frameCamo != null && PneumaticCraftUtils.isRenderIDCamo(base.frameCamo.getRenderType())) {
renderer.setOverrideBlockTexture(base.frameCamo.getIcon(0, base.getStackInSlot(5).getItemDamage()));
}
if (!frameXPos && !frameZPos) {
renderer.setRenderBounds(14 / 16D, 0, 14 / 16D, 15 / 16D, 1, 15 / 16D);
renderer.renderStandardBlock(block, x, y, z);
}
if (!frameXNeg && !frameZPos) {
renderer.setRenderBounds(1 / 16D, 0, 14 / 16D, 2 / 16D, 1, 15 / 16D);
renderer.renderStandardBlock(block, x, y, z);
}
if (!frameXPos && !frameZNeg) {
renderer.setRenderBounds(14 / 16D, 0, 1 / 16D, 15 / 16D, 1, 2 / 16D);
renderer.renderStandardBlock(block, x, y, z);
}
if (!frameXNeg && !frameZNeg) {
renderer.setRenderBounds(1 / 16D, 0, 1 / 16D, 2 / 16D, 1, 2 / 16D);
renderer.renderStandardBlock(block, x, y, z);
}
renderer.setOverrideBlockTexture(null);
renderer.renderAllFaces = false;
return true;
}
use of pneumaticCraft.common.tileentity.TileEntityElevatorBase in project PneumaticCraft by MineMaarten.
the class ModelElevatorBase method renderDynamic.
@Override
public void renderDynamic(float size, TileEntity te, float partialTicks) {
if (te instanceof TileEntityElevatorBase) {
TileEntityElevatorBase tile = (TileEntityElevatorBase) te;
renderModel(1 / 16F, tile.oldExtension + (tile.extension - tile.oldExtension) * partialTicks, tile.sidesConnected, tile);
} else {
renderModel(1 / 16F, 0, new boolean[] { false, false, false, false, false, false }, null);
}
}
use of pneumaticCraft.common.tileentity.TileEntityElevatorBase in project PneumaticCraft by MineMaarten.
the class BlockElevatorFrame method breakBlock.
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileEntityElevatorBase elevatorBase = getElevatorTE(world, x, y, z);
if (elevatorBase != null) {
elevatorBase.updateMaxElevatorHeight();
}
super.breakBlock(world, x, y, z, block, meta);
}
use of pneumaticCraft.common.tileentity.TileEntityElevatorBase in project PneumaticCraft by MineMaarten.
the class BlockElevatorFrame method onBlockAdded.
@Override
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
TileEntityElevatorBase elevatorBase = getElevatorTE(world, x, y, z);
if (elevatorBase != null) {
elevatorBase.updateMaxElevatorHeight();
}
}
use of pneumaticCraft.common.tileentity.TileEntityElevatorBase in project PneumaticCraft by MineMaarten.
the class BlockElevatorFrame method onEntityCollidedWithBlock.
/**
* Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
*/
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
// float blockHeight = getElevatorBlockHeight(world, x, y, z);
// if(blockHeight > 0) {
// if(entity.posY < y + blockHeight) {
// entity.setPosition(entity.posX, y + blockHeight + 2, entity.posZ);
TileEntityElevatorBase te = getElevatorTE(world, x, y, z);
if (te != null && te.oldExtension != te.extension) {
entity.setPosition(entity.posX, te.yCoord + te.extension + (double) entity.yOffset + entity.ySize + 1, entity.posZ);
}
entity.fallDistance = 0;
//}
// }
}
Aggregations