Search in sources :

Example 1 with TileEntityElevatorBase

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;
}
Also used : TileEntityElevatorBase(pneumaticCraft.common.tileentity.TileEntityElevatorBase)

Example 2 with TileEntityElevatorBase

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);
    }
}
Also used : TileEntityElevatorBase(pneumaticCraft.common.tileentity.TileEntityElevatorBase)

Example 3 with TileEntityElevatorBase

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);
}
Also used : TileEntityElevatorBase(pneumaticCraft.common.tileentity.TileEntityElevatorBase)

Example 4 with TileEntityElevatorBase

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();
    }
}
Also used : TileEntityElevatorBase(pneumaticCraft.common.tileentity.TileEntityElevatorBase)

Example 5 with TileEntityElevatorBase

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;
//}
//   }
}
Also used : TileEntityElevatorBase(pneumaticCraft.common.tileentity.TileEntityElevatorBase)

Aggregations

TileEntityElevatorBase (pneumaticCraft.common.tileentity.TileEntityElevatorBase)11 TileEntity (net.minecraft.tileentity.TileEntity)4 EntityItem (net.minecraft.entity.item.EntityItem)2 ItemStack (net.minecraft.item.ItemStack)2 Random (java.util.Random)1 Block (net.minecraft.block.Block)1 ItemBlock (net.minecraft.item.ItemBlock)1