Search in sources :

Example 1 with TileEntityInventoryScanner

use of org.freeforums.geforce.securitycraft.tileentity.TileEntityInventoryScanner in project SecurityCraft by Geforce132.

the class BlockInventoryScanner method breakBlock.

public void breakBlock(World par1World, int par2, int par3, int par4, Block par5Block, int par6) {
    for (int i = 0; i < ((TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4)).getContents().length; i++) {
        if (((TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4)).getContents()[i] != null) {
            EntityItem item = new EntityItem(par1World, par2, par3, par4, ((TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4)).getContents()[i]);
            par1World.spawnEntityInWorld(item);
        }
    }
    par1World.removeTileEntity(par2, par3, par4);
    super.breakBlock(par1World, par2, par3, par4, par5Block, par6);
}
Also used : TileEntityInventoryScanner(org.freeforums.geforce.securitycraft.tileentity.TileEntityInventoryScanner) EntityItem(net.minecraft.entity.item.EntityItem)

Example 2 with TileEntityInventoryScanner

use of org.freeforums.geforce.securitycraft.tileentity.TileEntityInventoryScanner in project SecurityCraft by Geforce132.

the class HelpfulMethods method checkForModule.

public static boolean checkForModule(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, EnumCustomModules module) {
    TileEntity te = par1World.getTileEntity(par2, par3, par4);
    if (te == null || !(te instanceof CustomizableSCTE)) {
        return false;
    }
    if (te instanceof TileEntityKeypad) {
        if (module == EnumCustomModules.WHITELIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.WHITELIST).contains(par5EntityPlayer.getCommandSenderName())) {
            HelpfulMethods.sendMessageToPlayer(par5EntityPlayer, "You have been whitelisted on this keypad.", EnumChatFormatting.GREEN);
            new ScheduleUpdate(par1World, 3, par2, par3, par4);
            return true;
        }
        if (module == EnumCustomModules.BLACKLIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.BLACKLIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.BLACKLIST).contains(par5EntityPlayer.getCommandSenderName())) {
            HelpfulMethods.sendMessageToPlayer(par5EntityPlayer, "You have been blacklisted on this keypad.", EnumChatFormatting.RED);
            return true;
        }
    } else if (te instanceof TileEntityKeycardReader) {
        if (module == EnumCustomModules.WHITELIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.WHITELIST).contains(par5EntityPlayer.getCommandSenderName())) {
            HelpfulMethods.sendMessageToPlayer(par5EntityPlayer, "You have been whitelisted on this reader.", EnumChatFormatting.GREEN);
            ((TileEntityKeycardReader) te).setIsProvidingPower(true);
            new ScheduleKeycardUpdate(3, par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4));
            par1World.notifyBlocksOfNeighborChange(par2, par3, par4, par1World.getBlock(par2, par3, par4));
            return true;
        }
        if (module == EnumCustomModules.BLACKLIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.BLACKLIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.BLACKLIST).contains(par5EntityPlayer.getCommandSenderName())) {
            HelpfulMethods.sendMessageToPlayer(par5EntityPlayer, "You have been blacklisted on this reader.", EnumChatFormatting.RED);
            return true;
        }
    } else if (te instanceof TileEntityRetinalScanner) {
        if (module == EnumCustomModules.WHITELIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.WHITELIST).contains(par5EntityPlayer.getCommandSenderName())) {
            return true;
        }
    } else if (te instanceof TileEntityInventoryScanner) {
        if (module == EnumCustomModules.WHITELIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.WHITELIST).contains(par5EntityPlayer.getCommandSenderName())) {
            return true;
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) CustomizableSCTE(org.freeforums.geforce.securitycraft.tileentity.CustomizableSCTE) TileEntityRetinalScanner(org.freeforums.geforce.securitycraft.tileentity.TileEntityRetinalScanner) ScheduleUpdate(org.freeforums.geforce.securitycraft.timers.ScheduleUpdate) TileEntityInventoryScanner(org.freeforums.geforce.securitycraft.tileentity.TileEntityInventoryScanner) ScheduleKeycardUpdate(org.freeforums.geforce.securitycraft.timers.ScheduleKeycardUpdate) TileEntityKeycardReader(org.freeforums.geforce.securitycraft.tileentity.TileEntityKeycardReader) TileEntityKeypad(org.freeforums.geforce.securitycraft.tileentity.TileEntityKeypad)

Aggregations

TileEntityInventoryScanner (org.freeforums.geforce.securitycraft.tileentity.TileEntityInventoryScanner)2 EntityItem (net.minecraft.entity.item.EntityItem)1 TileEntity (net.minecraft.tileentity.TileEntity)1 CustomizableSCTE (org.freeforums.geforce.securitycraft.tileentity.CustomizableSCTE)1 TileEntityKeycardReader (org.freeforums.geforce.securitycraft.tileentity.TileEntityKeycardReader)1 TileEntityKeypad (org.freeforums.geforce.securitycraft.tileentity.TileEntityKeypad)1 TileEntityRetinalScanner (org.freeforums.geforce.securitycraft.tileentity.TileEntityRetinalScanner)1 ScheduleKeycardUpdate (org.freeforums.geforce.securitycraft.timers.ScheduleKeycardUpdate)1 ScheduleUpdate (org.freeforums.geforce.securitycraft.timers.ScheduleUpdate)1