use of net.geforcemods.securitycraft.tileentity.TileEntityAlarm in project SecurityCraft by Geforce132.
the class BlockAlarm method playSoundAndUpdate.
private void playSoundAndUpdate(World par1World, int par2, int par3, int par4) {
if (!(par1World.getTileEntity(par2, par3, par4) instanceof TileEntityAlarm))
return;
if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) {
boolean isPowered = ((TileEntityAlarm) par1World.getTileEntity(par2, par3, par4)).isPowered();
if (!isPowered) {
Owner owner = ((TileEntityAlarm) par1World.getTileEntity(par2, par3, par4)).getOwner();
par1World.setBlock(par2, par3, par4, SCContent.alarmLit, par1World.getBlockMetadata(par2, par3, par4), 3);
((TileEntityAlarm) par1World.getTileEntity(par2, par3, par4)).getOwner().set(owner);
((TileEntityAlarm) par1World.getTileEntity(par2, par3, par4)).setPowered(true);
}
} else {
boolean isPowered = ((TileEntityAlarm) par1World.getTileEntity(par2, par3, par4)).isPowered();
if (isPowered) {
Owner owner = ((TileEntityAlarm) par1World.getTileEntity(par2, par3, par4)).getOwner();
par1World.setBlock(par2, par3, par4, SCContent.alarm, par1World.getBlockMetadata(par2, par3, par4), 3);
((TileEntityAlarm) par1World.getTileEntity(par2, par3, par4)).getOwner().set(owner);
((TileEntityAlarm) par1World.getTileEntity(par2, par3, par4)).setPowered(false);
}
}
}
use of net.geforcemods.securitycraft.tileentity.TileEntityAlarm in project SecurityCraft by Geforce132.
the class BlockAlarm method playSoundAndUpdate.
private void playSoundAndUpdate(World par1World, BlockPos pos) {
if (!(par1World.getTileEntity(pos) instanceof TileEntityAlarm))
return;
if (par1World.isBlockIndirectlyGettingPowered(pos) > 0) {
boolean isPowered = ((TileEntityAlarm) par1World.getTileEntity(pos)).isPowered();
if (!isPowered) {
Owner owner = ((TileEntityAlarm) par1World.getTileEntity(pos)).getOwner();
EnumFacing dir = BlockUtils.getBlockPropertyAsEnum(par1World, pos, FACING);
BlockUtils.setBlock(par1World, pos, SCContent.alarmLit);
BlockUtils.setBlockProperty(par1World, pos, FACING, dir);
((TileEntityAlarm) par1World.getTileEntity(pos)).getOwner().set(owner);
((TileEntityAlarm) par1World.getTileEntity(pos)).setPowered(true);
}
} else {
boolean isPowered = ((TileEntityAlarm) par1World.getTileEntity(pos)).isPowered();
if (isPowered) {
Owner owner = ((TileEntityAlarm) par1World.getTileEntity(pos)).getOwner();
EnumFacing dir = BlockUtils.getBlockPropertyAsEnum(par1World, pos, FACING);
BlockUtils.setBlock(par1World, pos, SCContent.alarm);
BlockUtils.setBlockProperty(par1World, pos, FACING, dir);
((TileEntityAlarm) par1World.getTileEntity(pos)).getOwner().set(owner);
((TileEntityAlarm) par1World.getTileEntity(pos)).setPowered(false);
}
}
}
Aggregations