use of pneumaticCraft.common.tileentity.TileEntityPneumaticDoorBase in project PneumaticCraft by MineMaarten.
the class BlockPneumaticDoorBase method onBlockPlacedBy.
/**
* Called when the block is placed in the world.
*/
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
TileEntityPneumaticDoorBase doorBase = (TileEntityPneumaticDoorBase) world.getTileEntity(x, y, z);
doorBase.orientation = PneumaticCraftUtils.getDirectionFacing(par5EntityLiving, false);
updateDoorSide(doorBase);
}
use of pneumaticCraft.common.tileentity.TileEntityPneumaticDoorBase in project PneumaticCraft by MineMaarten.
the class BlockPneumaticDoorBase method onNeighborBlockChange.
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof TileEntityPneumaticDoorBase) {
updateDoorSide((TileEntityPneumaticDoorBase) te);
ForgeDirection dir = ((TileEntityPneumaticDoorBase) te).orientation;
if (world.getBlock(x + dir.offsetX, y, z + dir.offsetZ) == Blockss.pneumaticDoor) {
Blockss.pneumaticDoor.onNeighborBlockChange(world, x + dir.offsetX, y, z + dir.offsetZ, block);
}
}
}
use of pneumaticCraft.common.tileentity.TileEntityPneumaticDoorBase in project PneumaticCraft by MineMaarten.
the class BlockPneumaticDoorBase method rotateBlock.
@Override
public boolean rotateBlock(World world, EntityPlayer player, int x, int y, int z, ForgeDirection side) {
if (player.isSneaking()) {
return super.rotateBlock(world, player, x, y, z, side);
} else {
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof TileEntityPneumaticDoorBase) {
TileEntityPneumaticDoorBase teDb = (TileEntityPneumaticDoorBase) te;
teDb.orientation = teDb.orientation.getRotation(ForgeDirection.UP);
return true;
}
return false;
}
}
use of pneumaticCraft.common.tileentity.TileEntityPneumaticDoorBase in project PneumaticCraft by MineMaarten.
the class BlockPneumaticDoor method getDoorBase.
private TileEntityPneumaticDoorBase getDoorBase(World world, int x, int y, int z) {
if (world.getBlock(x, y, z) != this)
return null;
int meta = world.getBlockMetadata(x, y, z);
if (meta < 6) {
return getDoorBase(world, x, y + 1, z);
} else {
ForgeDirection dir = ForgeDirection.getOrientation(meta % 6);
TileEntity te1 = world.getTileEntity(x + dir.getRotation(ForgeDirection.UP).offsetX, y, z + dir.getRotation(ForgeDirection.UP).offsetZ);
if (te1 instanceof TileEntityPneumaticDoorBase) {
TileEntityPneumaticDoorBase door = (TileEntityPneumaticDoorBase) te1;
if (door.orientation == dir.getRotation(ForgeDirection.DOWN)) {
return door;
}
}
TileEntity te2 = world.getTileEntity(x + dir.getRotation(ForgeDirection.DOWN).offsetX, y, z + dir.getRotation(ForgeDirection.DOWN).offsetZ);
if (te2 instanceof TileEntityPneumaticDoorBase) {
TileEntityPneumaticDoorBase door = (TileEntityPneumaticDoorBase) te2;
if (door.orientation == dir.getRotation(ForgeDirection.UP)) {
return door;
}
}
return null;
}
}
Aggregations