use of pneumaticCraft.common.tileentity.TileEntityPneumaticDoorBase in project PneumaticCraft by MineMaarten.
the class BlockPneumaticDoor method onBlockActivated.
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
TileEntityPneumaticDoorBase doorBase = getDoorBase(world, x, y, z);
if (!world.isRemote && doorBase != null && doorBase.redstoneMode == 2 && doorBase.getPressure(ForgeDirection.UNKNOWN) >= PneumaticValues.MIN_PRESSURE_PNEUMATIC_DOOR) {
doorBase.setOpening(!doorBase.isOpening());
doorBase.setNeighborOpening(doorBase.isOpening());
return true;
}
return false;
}
use of pneumaticCraft.common.tileentity.TileEntityPneumaticDoorBase in project PneumaticCraft by MineMaarten.
the class BlockPneumaticDoor method onNeighborBlockChange.
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z);
if (!powered) {
int meta = world.getBlockMetadata(x, y, z);
if (meta < 6) {
powered = world.isBlockIndirectlyGettingPowered(x, y + 1, z);
} else {
powered = world.isBlockIndirectlyGettingPowered(x, y - 1, z);
}
}
TileEntityPneumaticDoorBase doorBase = getDoorBase(world, x, y, z);
if (!world.isRemote && doorBase != null && doorBase.getPressure(ForgeDirection.UNKNOWN) >= PneumaticValues.MIN_PRESSURE_PNEUMATIC_DOOR) {
if (powered != doorBase.wasPowered) {
doorBase.wasPowered = powered;
doorBase.setOpening(powered);
}
}
}
use of pneumaticCraft.common.tileentity.TileEntityPneumaticDoorBase in project PneumaticCraft by MineMaarten.
the class BlockPneumaticDoorBase method shouldSideBeRendered.
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
ForgeDirection d = ForgeDirection.getOrientation(side);
TileEntityPneumaticDoorBase te = (TileEntityPneumaticDoorBase) world.getTileEntity(x - d.offsetX, y - d.offsetY, z - d.offsetZ);
ItemStack camoStack = te.getStackInSlot(TileEntityPneumaticDoorBase.CAMO_SLOT);
if (camoStack != null && camoStack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock) camoStack.getItem()).field_150939_a;
if (PneumaticCraftUtils.isRenderIDCamo(block.getRenderType())) {
return true;
}
}
return false;
}
use of pneumaticCraft.common.tileentity.TileEntityPneumaticDoorBase in project PneumaticCraft by MineMaarten.
the class ModelPneumaticDoorBase method renderDynamic.
@Override
public void renderDynamic(float size, TileEntity tile, float partialTicks) {
if (tile instanceof TileEntityPneumaticDoorBase) {
TileEntityPneumaticDoorBase door = (TileEntityPneumaticDoorBase) tile;
ItemStack camoStack = door.getStackInSlot(TileEntityPneumaticDoorBase.CAMO_SLOT);
boolean renderBase = true;
if (camoStack != null && camoStack.getItem() instanceof ItemBlock) {
Block block = Block.getBlockFromItem(camoStack.getItem());
renderBase = !PneumaticCraftUtils.isRenderIDCamo(block.getRenderType());
}
PneumaticCraftUtils.rotateMatrixByMetadata(door.orientation.ordinal());
renderModel(size, door.oldProgress + (door.progress - door.oldProgress) * partialTicks, renderBase, ((TileEntityPneumaticDoorBase) tile).rightGoing);
} else {
renderModel(size, 1, true, false);
}
}
use of pneumaticCraft.common.tileentity.TileEntityPneumaticDoorBase in project PneumaticCraft by MineMaarten.
the class BlockPneumaticDoorBase method getIcon.
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
TileEntityPneumaticDoorBase te = (TileEntityPneumaticDoorBase) world.getTileEntity(x, y, z);
ItemStack camoStack = te.getStackInSlot(TileEntityPneumaticDoorBase.CAMO_SLOT);
if (camoStack != null && camoStack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock) camoStack.getItem()).field_150939_a;
if (PneumaticCraftUtils.isRenderIDCamo(block.getRenderType())) {
return block.getIcon(side, camoStack.getItemDamage());
}
}
return this.getIcon(side, world.getBlockMetadata(x, y, z));
}
Aggregations