Search in sources :

Example 1 with Owner

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

the class BlockKeypad method convert.

@Override
public boolean convert(EntityPlayer player, World world, int x, int y, int z) {
    Owner owner = ((IOwnable) world.getTileEntity(x, y, z)).getOwner();
    world.setBlock(x, y, z, SCContent.keypad, world.getBlockMetadata(x, y, z), 3);
    ((IOwnable) world.getTileEntity(x, y, z)).getOwner().set(owner);
    return true;
}
Also used : Owner(net.geforcemods.securitycraft.api.Owner) IOwnable(net.geforcemods.securitycraft.api.IOwnable)

Example 2 with Owner

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

the class BlockClaymore method defuseMine.

@Override
public void defuseMine(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.claymoreDefused);
        ((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 3 with Owner

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

the class BlockMine 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.mine);
        ((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 4 with Owner

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

the class BlockMine method defuseMine.

@Override
public void defuseMine(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.mineCut);
        ((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 5 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, 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)

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