Search in sources :

Example 21 with Owner

use of net.geforcemods.securitycraft.api.Owner in project SecurityCraft by Geforce132.

the class BlockClaymore method activateMine.

@Override
public void activateMine(World world, int par2, int par3, int par4) {
    if (!world.isRemote) {
        Owner owner = ((IOwnable) world.getTileEntity(par2, par3, par4)).getOwner();
        world.setBlock(par2, par3, par4, SCContent.claymoreActive);
        ((IOwnable) world.getTileEntity(par2, par3, par4)).setOwner(owner.getUUID(), owner.getName());
    }
}
Also used : Owner(net.geforcemods.securitycraft.api.Owner) IOwnable(net.geforcemods.securitycraft.api.IOwnable)

Example 22 with Owner

use of net.geforcemods.securitycraft.api.Owner in project SecurityCraft by Geforce132.

the class ItemBlockReinforcedSlabs method func_150946_a.

private boolean func_150946_a(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) {
    if (par7 == 0)
        --par5;
    if (par7 == 1)
        ++par5;
    if (par7 == 2)
        --par6;
    if (par7 == 3)
        ++par6;
    if (par7 == 4)
        --par4;
    if (par7 == 5)
        ++par4;
    Block block = par3World.getBlock(par4, par5, par6);
    int i1 = par3World.getBlockMetadata(par4, par5, par6);
    int j1 = i1 & 7;
    Owner owner = null;
    if (par3World.getTileEntity(par4, par5, par6) instanceof IOwnable)
        owner = ((IOwnable) par3World.getTileEntity(par4, par5, par6)).getOwner();
    if (block == singleSlab && j1 == par1ItemStack.getMetadata()) {
        if (par3World.checkNoEntityCollision(this.getBlockVariant(i1).getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlock(par4, par5, par6, this.getBlockVariant(i1), j1, 3)) {
            par3World.playSoundEffect(par4 + 0.5F, par5 + 0.5F, par6 + 0.5F, this.getBlockVariant(i1).stepSound.getPlaceSound(), (this.getBlockVariant(i1).stepSound.getVolume() + 1.0F) / 2.0F, this.getBlockVariant(i1).stepSound.getFrequency() * 0.8F);
            --par1ItemStack.stackSize;
            if (owner != null)
                ((IOwnable) par3World.getTileEntity(par4, par5, par6)).getOwner().set(owner.getUUID(), owner.getName());
        }
        return true;
    } else
        return false;
}
Also used : Owner(net.geforcemods.securitycraft.api.Owner) Block(net.minecraft.block.Block) ItemBlock(net.minecraft.item.ItemBlock) IOwnable(net.geforcemods.securitycraft.api.IOwnable)

Example 23 with Owner

use of net.geforcemods.securitycraft.api.Owner in project SecurityCraft by Geforce132.

the class ItemBlockReinforcedSlabs method tryPlace.

private boolean tryPlace(ItemStack stack, World worldIn, EntityPlayer player, BlockPos pos, Object variantInStack) {
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Owner owner = null;
    if (worldIn.getTileEntity(pos) instanceof IOwnable)
        owner = ((IOwnable) worldIn.getTileEntity(pos)).getOwner();
    if (iblockstate.getBlock() == singleSlab) {
        Comparable<?> comparable = iblockstate.getValue(singleSlab.getVariantProperty());
        if (comparable == variantInStack) {
            IBlockState iblockstate1 = this.makeState(singleSlab.getVariantProperty(), comparable);
            if (worldIn.checkNoEntityCollision(iblockstate1.getCollisionBoundingBox(worldIn, pos)) && worldIn.setBlockState(pos, iblockstate1, 3)) {
                worldIn.playSound(player, pos, doubleSlab.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, (doubleSlab.getSoundType().getVolume() + 1.0F) / 2.0F, doubleSlab.getSoundType().getPitch() * 0.8F);
                stack.shrink(1);
                if (owner != null)
                    ((IOwnable) worldIn.getTileEntity(pos)).getOwner().set(owner.getUUID(), owner.getName());
            }
            return true;
        }
    }
    return false;
}
Also used : Owner(net.geforcemods.securitycraft.api.Owner) IBlockState(net.minecraft.block.state.IBlockState) IOwnable(net.geforcemods.securitycraft.api.IOwnable)

Example 24 with Owner

use of net.geforcemods.securitycraft.api.Owner in project SecurityCraft by Geforce132.

the class ItemBlockReinforcedSlabs2 method tryPlace.

private boolean tryPlace(ItemStack stack, World worldIn, BlockPos pos, Object variantInStack) {
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Owner owner = null;
    if (worldIn.getTileEntity(pos) instanceof IOwnable)
        owner = ((IOwnable) worldIn.getTileEntity(pos)).getOwner();
    if (iblockstate.getBlock() == singleSlab) {
        Comparable<?> comparable = iblockstate.getValue(singleSlab.getVariantProperty());
        if (comparable == variantInStack) {
            IBlockState iblockstate1 = doubleSlab.getDefaultState().withProperty(singleSlab.getVariantProperty(), comparable);
            if (worldIn.checkNoEntityCollision(doubleSlab.getCollisionBoundingBox(worldIn, pos, iblockstate1)) && worldIn.setBlockState(pos, iblockstate1, 3)) {
                worldIn.playSoundEffect(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, doubleSlab.stepSound.getPlaceSound(), (doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, doubleSlab.stepSound.getFrequency() * 0.8F);
                --stack.stackSize;
                if (owner != null)
                    ((IOwnable) worldIn.getTileEntity(pos)).getOwner().set(owner.getUUID(), owner.getName());
            }
            return true;
        }
    }
    return false;
}
Also used : Owner(net.geforcemods.securitycraft.api.Owner) IBlockState(net.minecraft.block.state.IBlockState) IOwnable(net.geforcemods.securitycraft.api.IOwnable)

Example 25 with Owner

use of net.geforcemods.securitycraft.api.Owner in project SecurityCraft by Geforce132.

the class ItemBlockReinforcedWoodSlabs method tryPlace.

private boolean tryPlace(ItemStack stack, World worldIn, BlockPos pos, Object variantInStack) {
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Owner owner = null;
    if (worldIn.getTileEntity(pos) instanceof IOwnable)
        owner = ((IOwnable) worldIn.getTileEntity(pos)).getOwner();
    if (iblockstate.getBlock() == singleSlab) {
        Comparable<?> comparable = iblockstate.getValue(singleSlab.getVariantProperty());
        if (comparable == variantInStack) {
            IBlockState iblockstate1 = doubleSlab.getDefaultState().withProperty(singleSlab.getVariantProperty(), comparable);
            if (worldIn.checkNoEntityCollision(doubleSlab.getCollisionBoundingBox(worldIn, pos, iblockstate1)) && worldIn.setBlockState(pos, iblockstate1, 3)) {
                worldIn.playSoundEffect(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, doubleSlab.stepSound.getPlaceSound(), (doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, doubleSlab.stepSound.getFrequency() * 0.8F);
                --stack.stackSize;
                if (owner != null)
                    ((IOwnable) worldIn.getTileEntity(pos)).getOwner().set(owner.getUUID(), owner.getName());
            }
            return true;
        }
    }
    return false;
}
Also used : Owner(net.geforcemods.securitycraft.api.Owner) IBlockState(net.minecraft.block.state.IBlockState) IOwnable(net.geforcemods.securitycraft.api.IOwnable)

Aggregations

Owner (net.geforcemods.securitycraft.api.Owner)25 IOwnable (net.geforcemods.securitycraft.api.IOwnable)22 IBlockState (net.minecraft.block.state.IBlockState)10 Block (net.minecraft.block.Block)4 ItemBlock (net.minecraft.item.ItemBlock)4 EnumFacing (net.minecraft.util.EnumFacing)3 TileEntityAlarm (net.geforcemods.securitycraft.tileentity.TileEntityAlarm)2 CustomizableSCTE (net.geforcemods.securitycraft.api.CustomizableSCTE)1 TileEntityKeypad (net.geforcemods.securitycraft.tileentity.TileEntityKeypad)1 TileEntityKeypadChest (net.geforcemods.securitycraft.tileentity.TileEntityKeypadChest)1 TileEntityKeypadFurnace (net.geforcemods.securitycraft.tileentity.TileEntityKeypadFurnace)1 TileEntityOwnable (net.geforcemods.securitycraft.tileentity.TileEntityOwnable)1 TileEntityPortableRadar (net.geforcemods.securitycraft.tileentity.TileEntityPortableRadar)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1