Search in sources :

Example 1 with ItemModule

use of org.freeforums.geforce.securitycraft.items.ItemModule in project SecurityCraft by Geforce132.

the class CommandModule method processCommand.

public void processCommand(ICommandSender par1ICommandSender, String[] par2String) {
    if (par2String.length == 1) {
        if (par2String[0].matches("copy")) {
            EntityPlayer player = HelpfulMethods.getPlayerFromName(par1ICommandSender.getCommandSenderName());
            if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemModule && ((ItemModule) player.getCurrentEquippedItem().getItem()).canBeModified()) {
                mod_SecurityCraft.instance.setSavedModule(player.getCurrentEquippedItem().stackTagCompound);
                HelpfulMethods.sendMessageToPlayer(player, "Module data saved.", EnumChatFormatting.GREEN);
            } else {
                HelpfulMethods.sendMessageToPlayer(player, "You must be holding the module you wish to save data from.", EnumChatFormatting.RED);
            }
            return;
        } else if (par2String[0].matches("paste")) {
            EntityPlayer player = HelpfulMethods.getPlayerFromName(par1ICommandSender.getCommandSenderName());
            if (mod_SecurityCraft.instance.getSavedModule() == null) {
                HelpfulMethods.sendMessageToPlayer(player, "There is no module data saved.", EnumChatFormatting.RED);
                return;
            }
            if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemModule && ((ItemModule) player.getCurrentEquippedItem().getItem()).canBeModified()) {
                player.getCurrentEquippedItem().stackTagCompound = mod_SecurityCraft.instance.getSavedModule();
                mod_SecurityCraft.instance.setSavedModule(null);
                HelpfulMethods.sendMessageToPlayer(player, "Saved data to module.", EnumChatFormatting.GREEN);
            }
            return;
        }
    } else if (par2String.length == 2) {
        if (par2String[0].matches("add")) {
            EntityPlayer player = HelpfulMethods.getPlayerFromName(par1ICommandSender.getCommandSenderName());
            if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemModule && ((ItemModule) player.getCurrentEquippedItem().getItem()).canBeModified()) {
                if (player.getCurrentEquippedItem().stackTagCompound == null) {
                    player.getCurrentEquippedItem().stackTagCompound = new NBTTagCompound();
                }
                player.getCurrentEquippedItem().stackTagCompound.setString("Player" + getNextSlot(player.getCurrentEquippedItem().stackTagCompound), par2String[1]);
                return;
            } else {
                HelpfulMethods.sendMessageToPlayer(player, "You must be holding the module you wish to modify!", EnumChatFormatting.RED);
                return;
            }
        }
    }
    throw new WrongUsageException(usage);
}
Also used : WrongUsageException(net.minecraft.command.WrongUsageException) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemModule(org.freeforums.geforce.securitycraft.items.ItemModule)

Example 2 with ItemModule

use of org.freeforums.geforce.securitycraft.items.ItemModule in project SecurityCraft by Geforce132.

the class ConfigurationHandler method setupItems.

public void setupItems() {
    mod_SecurityCraft.Codebreaker = new ItemCodebreaker().setCreativeTab(mod_SecurityCraft.tabSCTechnical).setUnlocalizedName("codebreaker").setTextureName("securitycraft:CodeBreaker1");
    mod_SecurityCraft.keycards = new ItemKeycardBase();
    mod_SecurityCraft.doorIndestructableIronItem = new ItemReinforcedDoor(Material.iron).setUnlocalizedName("doorIndestructibleIronItem").setCreativeTab(mod_SecurityCraft.tabSCTechnical).setTextureName("securitycraft:doorReinforcedIron");
    mod_SecurityCraft.universalBlockRemover = new ItemUniversalBlockRemover().setMaxStackSize(1).setMaxDamage(476).setCreativeTab(mod_SecurityCraft.tabSCTechnical).setUnlocalizedName("universalBlockRemover").setTextureName("securitycraft:universalBlockRemover");
    mod_SecurityCraft.remoteAccessMine = new ItemRemoteAccess(1).setCreativeTab(mod_SecurityCraft.tabSCTechnical).setUnlocalizedName("remoteAccessMine").setTextureName("securitycraft:remoteAccessDoor").setMaxStackSize(1);
    mod_SecurityCraft.fWaterBucket = new ItemModifiedBucket(mod_SecurityCraft.bogusWater).setCreativeTab(mod_SecurityCraft.tabSCTechnical).setUnlocalizedName("bucketFWater").setTextureName("securitycraft:bucketFWater");
    mod_SecurityCraft.fLavaBucket = new ItemModifiedBucket(mod_SecurityCraft.bogusLava).setCreativeTab(mod_SecurityCraft.tabSCTechnical).setUnlocalizedName("bucketFLava").setTextureName("securitycraft:bucketFLava");
    mod_SecurityCraft.universalBlockModifier = new ItemUniversalBlockModifier().setMaxStackSize(1).setCreativeTab(mod_SecurityCraft.tabSCTechnical).setUnlocalizedName("universalBlockModifier").setTextureName("securitycraft:universalBlockModifier");
    mod_SecurityCraft.redstoneModule = (ItemModule) new ItemModule(EnumCustomModules.REDSTONE, false).setUnlocalizedName("redstoneModule").setTextureName("securitycraft:redstoneModule");
    mod_SecurityCraft.whitelistModule = (ItemModule) new ItemModule(EnumCustomModules.WHITELIST, true).setUnlocalizedName("whitelistModule").setTextureName("securitycraft:whitelistModule");
    mod_SecurityCraft.blacklistModule = (ItemModule) new ItemModule(EnumCustomModules.BLACKLIST, true).setUnlocalizedName("blacklistModule").setTextureName("securitycraft:blacklistModule");
    mod_SecurityCraft.harmingModule = (ItemModule) new ItemModule(EnumCustomModules.HARMING, false).setUnlocalizedName("harmingModule").setTextureName("securitycraft:harmingModule");
    mod_SecurityCraft.smartModule = (ItemModule) new ItemModule(EnumCustomModules.SMART, false).setUnlocalizedName("smartModule").setTextureName("securitycraft:smartModule");
    mod_SecurityCraft.wireCutters = new Item().setMaxStackSize(1).setMaxDamage(476).setCreativeTab(mod_SecurityCraft.tabSCTechnical).setUnlocalizedName("wireCutters").setTextureName("securitycraft:wireCutter");
}
Also used : Item(net.minecraft.item.Item) ItemTestItem(org.freeforums.geforce.securitycraft.items.ItemTestItem) ItemUniversalBlockModifier(org.freeforums.geforce.securitycraft.items.ItemUniversalBlockModifier) ItemReinforcedDoor(org.freeforums.geforce.securitycraft.items.ItemReinforcedDoor) ItemUniversalBlockRemover(org.freeforums.geforce.securitycraft.items.ItemUniversalBlockRemover) ItemRemoteAccess(org.freeforums.geforce.securitycraft.items.ItemRemoteAccess) ItemModifiedBucket(org.freeforums.geforce.securitycraft.items.ItemModifiedBucket) ItemModule(org.freeforums.geforce.securitycraft.items.ItemModule) ItemCodebreaker(org.freeforums.geforce.securitycraft.items.ItemCodebreaker) ItemKeycardBase(org.freeforums.geforce.securitycraft.items.ItemKeycardBase)

Aggregations

ItemModule (org.freeforums.geforce.securitycraft.items.ItemModule)2 WrongUsageException (net.minecraft.command.WrongUsageException)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Item (net.minecraft.item.Item)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 ItemCodebreaker (org.freeforums.geforce.securitycraft.items.ItemCodebreaker)1 ItemKeycardBase (org.freeforums.geforce.securitycraft.items.ItemKeycardBase)1 ItemModifiedBucket (org.freeforums.geforce.securitycraft.items.ItemModifiedBucket)1 ItemReinforcedDoor (org.freeforums.geforce.securitycraft.items.ItemReinforcedDoor)1 ItemRemoteAccess (org.freeforums.geforce.securitycraft.items.ItemRemoteAccess)1 ItemTestItem (org.freeforums.geforce.securitycraft.items.ItemTestItem)1 ItemUniversalBlockModifier (org.freeforums.geforce.securitycraft.items.ItemUniversalBlockModifier)1 ItemUniversalBlockRemover (org.freeforums.geforce.securitycraft.items.ItemUniversalBlockRemover)1