thaumcraft.common.items.wands.ItemWandCasting Java Examples

The following examples show how to use thaumcraft.common.items.wands.ItemWandCasting. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockNodeManipulator.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
    TileNodeManipulator tile = (TileNodeManipulator) world.getTileEntity(x, y, z);
    ItemStack heldItem = player.getHeldItem();
    if(tile.isInMultiblock()) {
        super.onBlockActivated(world, x, y, z, player, side, par7, par8, par9);
    } else if(!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting) {
        tile.checkMultiblock();
        if (tile.isMultiblockStructurePresent()) {
            String research = tile.getMultiblockType().getResearchNeeded();
            if(!ResearchManager.isResearchComplete(player.getCommandSenderName(), research)) return false;
            if (ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, tile.getMultiblockType().getMultiblockCosts(), true)) {
                tile.formMultiblock();
                return true;
            }
        }
    }
    return false;
}
 
Example #2
Source File: InfernalWandUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
    if(player.ticksExisted % 100 == 0){
        if(player.worldObj.provider.dimensionId == -1){
            for(int x = 0;x < primals.length;x++){
                if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 10) {
                    ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                }
            }
        }
        
        if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, Aspect.FIRE) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 5) {
            ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, Aspect.FIRE, 1, true);
        }
    }
    
    if(player.isBurning())
        player.extinguish();
        
    if(player.isPotionActive(Potion.wither.id)) {
        if(player.worldObj.isRemote)
            player.removePotionEffectClient(Potion.wither.id);
        else
            player.removePotionEffect(Potion.wither.id);
    }
}
 
Example #3
Source File: EventHandlerWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOWEST)
public void on(PlayerInteractEvent e) {
    if (!e.world.isRemote && e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK
            && isStickyJar(e.entityPlayer.getHeldItem())) {
        if (interacts == null) {
            interacts = new HashMap<EntityPlayer, Integer>();
        }
        interacts.put(e.entityPlayer, e.face);
    }

    if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
        ItemStack i = e.entityPlayer.getHeldItem();
        if (i != null && (i.getItem() instanceof ItemWandCasting)) {
            WandHandler.handleWandInteract(e.world, e.x, e.y, e.z, e.entityPlayer, i);
        }
    }
}
 
Example #4
Source File: TileEntityIndustrialWandRecharge.java    From Electro-Magic-Tools with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void updateEntity() {
    ic2EnergySink.updateEntity();
    if (!this.worldObj.isRemote) {
        if (getStackInSlot(0) != null) {

            ItemStack wand = getStackInSlot(0);
            if (wand != null && wand.getItem() instanceof ItemWandCasting) {
                ItemWandCasting wandItem = (ItemWandCasting) wand.getItem();
                if (ic2EnergySink.useEnergy(ConfigHandler.wandChargerConsumption) && wandItem.getAspectsWithRoom(wand) != null) {
                    wandItem.addVis(wand, Aspect.ORDER, 1, true);
                    wandItem.addVis(wand, Aspect.FIRE, 1, true);
                    wandItem.addVis(wand, Aspect.ENTROPY, 1, true);
                    wandItem.addVis(wand, Aspect.WATER, 1, true);
                    wandItem.addVis(wand, Aspect.EARTH, 1, true);
                    wandItem.addVis(wand, Aspect.AIR, 1, true);
                }
            }
            worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
        }
    }
}
 
Example #5
Source File: ItemWandChargingFocus.java    From Electro-Magic-Tools with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int integer) {

    if (!player.worldObj.isRemote) {
        ItemWandCasting wandItem = (ItemWandCasting) itemstack.getItem();

        ItemStack armor = player.inventory.armorInventory[1];
        if (armor != null) {
            if ((ElectricItem.manager.use(armor, ConfigHandler.wandChargeFocusCost / 4, player) && (ElectricItem.manager.use(armor, ConfigHandler.wandChargeFocusCost / 4, player)) && (ElectricItem.manager.use(armor, ConfigHandler.wandChargeFocusCost / 4, player)) && (ElectricItem.manager.use(armor, ConfigHandler.wandChargeFocusCost / 4, player)))) {
                wandItem.addVis(itemstack, Aspect.ORDER, 1, true);
                wandItem.addVis(itemstack, Aspect.FIRE, 1, true);
                wandItem.addVis(itemstack, Aspect.ENTROPY, 1, true);
                wandItem.addVis(itemstack, Aspect.WATER, 1, true);
                wandItem.addVis(itemstack, Aspect.EARTH, 1, true);
                wandItem.addVis(itemstack, Aspect.AIR, 1, true);
            }
        }
    }
}
 
Example #6
Source File: ManaWandUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
    if(Compat.am2 && Config.crossWand)
    {
        if(player.ticksExisted % 100 == 0){
        
            try
            {
                IExtendedProperties prop = ArsMagicaApi.instance.getExtendedProperties(player);
            
                float cost;
                if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("vinteum"))
                    cost = 0.8F;
                else
                    cost = 1.4F;
                
                if(prop == null || prop.getCurrentMana() <= 0)
                    return;
            
            
                for(int x = 0;x < primals.length;x++){
                    int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
                    if(deficit > 0) {
                        deficit = Math.min(deficit, 100);
                        if(prop.getCurrentMana() > cost * deficit)
                        {                        
                            prop.setCurrentMana(prop.getCurrentMana() - cost * deficit);
                            ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                        }
                    }
                }
            }
            catch(Throwable e){}
        }
    
    }
    
}
 
Example #7
Source File: YandereWandUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player)
{
    if(Compat.botan && Config.crossWand && player.ticksExisted % 40 == 0 && checkHotbar(itemstack, player))
    {
        try
        {
            int cost;
            if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("manasteel")
                    ||((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("elementium"))
                cost = Config.manavis - 2;
            else
                cost = Config.manavis;

            cost = Math.max(0, cost);
            
            for(int x = 0;x < primals.length;x++)
            {
                int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
                if(deficit > 0)
                {
                    deficit = Math.min(deficit, 100);
                    if(ManaItemHandler.requestManaExact(itemstack, player, cost * deficit, true))
                        ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                }
            }
        
        }
        catch(Throwable e)
        {
            return;
        }
    }

}
 
Example #8
Source File: TaintedWandUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
    if(player.ticksExisted % 100 == 0 && player.worldObj.getBiomeGenForCoords((int)player.posX, (int)player.posZ).biomeID == thaumcraft.common.config.Config.biomeTaintID){
        for(int x = 0;x < primals.length;x++){
            if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 10) {
                ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
            }
        }
    }
    
}
 
Example #9
Source File: ManaStaffUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
    if(Compat.am2 && Config.crossWand)
    {
        if(player.ticksExisted % 40 == 0){
        
            try
            { 
                IExtendedProperties prop = ArsMagicaApi.instance.getExtendedProperties(player);
            
                float cost;
                if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("vinteum"))
                    cost = 0.5F;
                else
                    cost = 1.0F;
                
                if(prop == null || prop.getCurrentMana() <= 0)
                    return;
            
            
                for(int x = 0;x < primals.length;x++){
                    int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
                    if(deficit > 0) {
                        deficit = Math.min(deficit, 100);
                        if(prop.getCurrentMana() > cost * deficit)
                        {
                            prop.setCurrentMana(prop.getCurrentMana() - cost * deficit);
                            ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                        }
                    }
                }
            } 
            catch(Throwable e){}
        }
    
    }
    
}
 
Example #10
Source File: ProfaneWandUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player) {

        if(player.ticksExisted % 20 == 0){

            NBTTagCompound tag = itemstack.getTagCompound();
            if(!tag.hasKey("contract")){
                Thaumcraft.proxy.getResearchManager().completeResearch(player, "ROD_profane");
                tag.setInteger("contract", 25000);
            }
            else if(tag.getInteger("contract") <= 0)
                return;

            for(int x = 0;x < primals.length && tag.getInteger("contract") > 0;x++){
                int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
                if(deficit > 0) {
                    int restore = Math.min(tag.getInteger("contract"), deficit);
                    ((ItemWandCasting)itemstack.getItem()).addRealVis(itemstack, primals[x], restore, true);
                    tag.setInteger("contract", tag.getInteger("contract") - restore);
                    if(player.worldObj.rand.nextInt(2501) < restore)
                        Thaumcraft.addStickyWarpToPlayer(player, 1);
                }
            }

            if(tag.getInteger("contract") <= 0) {
                ((ItemWandCasting)itemstack.getItem()).setRod(itemstack, WandRod.rods.get("profaned"));
                Thaumcraft.addStickyWarpToPlayer(player, 1);
                player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + (double)(player.height / 2.0F), player.posZ, 0.0D, 0.0D, 0.0D);
            }
            itemstack.setTagCompound(tag);
        }

    }
 
Example #11
Source File: CreativeWandUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
    for (int x = 0; x < primals.length; x++) {
        if (((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack)) {
            ((ItemWandCasting) itemstack.getItem()).addVis(itemstack, primals[x], ((ItemWandCasting) itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting) itemstack.getItem()).getVis(itemstack, primals[x]), true);
        }
    }
}
 
Example #12
Source File: FMEventHandler.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
@SubscribeEvent
public void onTooltip(ItemTooltipEvent event) {
    if (event.itemStack.getItem() instanceof ItemWandCasting) {
        if (((ItemWandCasting) event.itemStack.getItem()).getRod(event.itemStack).getTag().startsWith("blood") && !event.itemStack.stackTagCompound.getString("ownerName").equals("")) {
            event.toolTip.add(StatCollector.translateToLocal("tooltip.currentowner") + " " + event.itemStack.stackTagCompound.getString("ownerName"));
        } else if (((ItemWandCasting) event.itemStack.getItem()).getRod(event.itemStack).getTag().startsWith("neutronium")) {
            event.toolTip.add(StatCollector.translateToLocal("tooltip.creativeonly"));
        } else if (((ItemWandCasting) event.itemStack.getItem()).getRod(event.itemStack).getTag().startsWith("profane")) {
            event.toolTip.add("Contract: " + event.itemStack.getTagCompound().getInteger("contract"));
        }
    }
}
 
Example #13
Source File: FMEventHandler.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
@SubscribeEvent
public void onGetHurt(LivingHurtEvent event) {
    if (event.entityLiving instanceof EntityPlayer && ((EntityPlayer) event.entityLiving).getCurrentEquippedItem() != null && ((EntityPlayer) event.entityLiving).getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {

        ItemStack wand = ((EntityPlayer) event.entityLiving).getCurrentEquippedItem();
        if (event.source.getDamageType().equals("taint") && ((ItemWandCasting) wand.getItem()).getRod(wand).getTag().equals("tainted")) {

            for (int x = 0; x < 3; x++) {
                ((ItemWandCasting) wand.getItem()).addVis(wand, primals[randy.nextInt(6)], 1, true);
            }

        }

        if ((event.source.getDamageType().equals("wither") || event.source.isFireDamage()) && ((ItemWandCasting) wand.getItem()).getRod(wand).getTag().equals("infernal")) {

            event.setCanceled(true);
        }
    }

    if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) {
        ItemStack equip = ((EntityPlayer) event.source.getEntity()).getCurrentEquippedItem();
        if (equip != null && equip.getItem() instanceof ItemWandCasting) {
            if (((ItemWandCasting) equip.getItem()).getCap(equip).getTag().equals("alchemical") && ((ItemWandCasting) equip.getItem()).getRod(equip).getTag().startsWith("blood")) {
                event.entityLiving.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2));
            }
        }
    }
}
 
Example #14
Source File: VillagerHereticManager.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
    if(villager.getProfession() == Config.hereticID) {
        /*recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemResource, 20 + random.nextInt(3), 18), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemResource, 1, 9)));
        recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemResource, 4 + random.nextInt(3), 3), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemResource, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemResource, 4 + random.nextInt(3), 6), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemResource, 1, 1)));
        recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemNuggetChicken, 24 + random.nextInt(8), 0), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.book, 4 + random.nextInt(3), 0), new ItemStack(ConfigItems.itemResource, 1, 9)));
        recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemNuggetBeef, 24 + random.nextInt(8), 0), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemShard, 2 + random.nextInt(2), random.nextInt(6))));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemManaBean, 1 + random.nextInt(2), 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemBathSalts, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemRingRunic, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemAmuletVis, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemBaubleBlanks, 1, 3 + random.nextInt(6))));
        */
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1 + random.nextInt(2)), new ItemStack(ForbiddenItems.deadlyShards, 3 + random.nextInt(2), 6)));
        if(!Config.noLust)
            recipeList.add(new MerchantRecipe(new ItemStack(ForbiddenItems.deadlyShards, 2 + random.nextInt(4), 4), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(ForbiddenItems.deadlyShards, 4 + random.nextInt(6), 0), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(ForbiddenItems.gluttonyShard, 4 + random.nextInt(6), 0), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1 + random.nextInt(3)), new ItemStack(Items.skull, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 4 + random.nextInt(4)), new ItemStack(Items.ghast_tear, 1)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), new ItemStack(Items.glowstone_dust, 8 + random.nextInt(9))));

        ItemStack wand = new ItemStack(ConfigItems.itemWandCasting, 1, 36);
        ((ItemWandCasting) wand.getItem()).setCap(wand, (WandCap) WandCap.caps.get("iron"));
        ((ItemWandCasting) wand.getItem()).setRod(wand, (WandRod) WandRod.rods.get("profane"));
        ((ItemWandCasting) wand.getItem()).storeAllVis(wand, new AspectList().add(Aspect.FIRE, 5000).add(Aspect.WATER, 5000).add(Aspect.EARTH, 5000).add(Aspect.AIR, 5000).add(Aspect.ORDER, 5000).add(Aspect.ENTROPY, 5000));
        MerchantRecipe profane = new MerchantRecipe(new ItemStack(Items.emerald, 8 + random.nextInt(5)), new ItemStack(Items.stick), wand);
        profane.func_82783_a(-6);
        recipeList.add(profane);
        MerchantRecipe fire = new MerchantRecipe(new ItemStack(Items.emerald, 4 + random.nextInt(5)), new ItemStack(Items.diamond, 1), new ItemStack(ConfigItems.itemFocusFire, 1));
        fire.func_82783_a(-6);
        recipeList.add(fire);
    }

}
 
Example #15
Source File: WandOverlord.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public boolean hellfire(World world, ItemStack wand, EntityPlayer player, int x, int y, int z, int side) {
    if (world.isRemote || wand == null || !(wand.getItem() instanceof ItemWandCasting) || ((ItemWandCasting) wand.getItem()).getFocusItem(wand) != null || !ResearchManager.isResearchComplete(player.getCommandSenderName(), "HELLFIRE") || !player.canPlayerEdit(x, y, z, side, new ItemStack(Items.fire_charge)))
        return false;

    if (world.isAirBlock(x, y + 1, z) && ((ItemWandCasting) wand.getItem()).consumeVis(wand, player, Aspect.FIRE, 2, false)) {
        world.playSoundEffect((double) x + 0.5D, (double) y + 1.5D, (double) z + 0.5D, "fire.ignite", 1.0F, world.rand.nextFloat() * 0.4F + 0.8F);
        world.setBlock(x, y + 1, z, Blocks.fire);
        player.swingItem();
        return true;
    } else
        return false;
}
 
Example #16
Source File: ItemExplosionFocus.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition) {
    ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
    if (wand.consumeAllVis(itemstack, player, getVisCost(), true, true)) {
        if (!world.isRemote) {
            EntityLaser laser;
            laser = new EntityLaser(world, player, 2);
            world.spawnEntityInWorld(laser);
        }
    }
    return itemstack;
}
 
Example #17
Source File: ItemShieldFocus.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int time) {
    player.motionX = 0.0D;
    player.motionY = 0.0D;
    player.motionZ = 0.0D;

    ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
    if (wand.consumeAllVis(itemstack, player, getVisCost(), true, true)) {
        int x = MathHelper.floor_double(player.posX);
        int y = MathHelper.floor_double(player.posY);
        int z = MathHelper.floor_double(player.posZ);

        // Player Level
        if (player.worldObj.isAirBlock(x + 1, y, z) && player.worldObj.isAirBlock(x - 1, y, z) && player.worldObj.isAirBlock(x, y, z + 1) && player.worldObj.isAirBlock(x, y, z - 1)) {
            player.worldObj.setBlock(x + 1, y, z, IC2BlockRegistry.shield);
            player.worldObj.setBlock(x - 1, y, z, IC2BlockRegistry.shield);
            player.worldObj.setBlock(x, y, z + 1, IC2BlockRegistry.shield);
            player.worldObj.setBlock(x, y, z - 1, IC2BlockRegistry.shield);
        }

        // Above the player
        if (player.worldObj.isAirBlock(x + 1, y + 1, z) && player.worldObj.isAirBlock(x - 1, y + 1, z) && player.worldObj.isAirBlock(x, y + 1, z + 1) && player.worldObj.isAirBlock(x, y + 1, z - 1)) {
            player.worldObj.setBlock(x + 1, y + 1, z, IC2BlockRegistry.shield);
            player.worldObj.setBlock(x - 1, y + 1, z, IC2BlockRegistry.shield);
            player.worldObj.setBlock(x, y + 1, z + 1, IC2BlockRegistry.shield);
            player.worldObj.setBlock(x, y + 1, z - 1, IC2BlockRegistry.shield);
        }
    }
}
 
Example #18
Source File: AuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
    EntityPlayer player = (EntityPlayer) e;

    if(player.getHeldItem() != null && player.getHeldItem().getItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting) {
        ItemStack wand = player.getHeldItem();
        ItemWandCasting wandCasting = (ItemWandCasting) wand.getItem();
        AspectList al = wandCasting.getAspectsWithRoom(wand);
        for(Aspect a : al.getAspects()) {
            if(a != null) wandCasting.addRealVis(wand, a, 4, true);
        }
    }
}
 
Example #19
Source File: RegisteredRecipes.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static List[] createAuraCoreRecipes() {
    List[] recipes = new List[7];
    for(int i = 0; i < 7; i++) {
        AspectList cost = new AspectList();
        switch (i) {
            case 0: cost.add(Aspect.AIR, 84); break;
            case 1: cost.add(Aspect.FIRE, 84); break;
            case 2: cost.add(Aspect.WATER, 84); break;
            case 3: cost.add(Aspect.EARTH, 84); break;
            case 4: cost.add(Aspect.ORDER, 84); break;
            case 5: cost.add(Aspect.ENTROPY, 84); break;
            case 6: cost.add(Aspect.AIR, 14).add(Aspect.FIRE, 14).add(Aspect.WATER, 14)
                    .add(Aspect.EARTH, 14).add(Aspect.ORDER, 14).add(Aspect.ENTROPY, 14);
        }

        ItemWandCasting item = (ItemWandCasting) ConfigItems.itemWandCasting;
        ItemStack wand = new ItemStack(item);
        item.setRod(wand, ConfigItems.WAND_ROD_GREATWOOD);
        item.setCap(wand, ConfigItems.WAND_CAP_GOLD);

        recipes[i] = Arrays.asList(cost, 3, 2, 3,
                Arrays.asList(
                        null, null, null, null, wand, null, null, null, null,
                        null, null, null, null, new ItemStack(ConfigBlocks.blockCrystal, 1, i),
                        new ItemStack(RegisteredItems.itemAuraCore), null, null, null
                ));
    }
    return recipes;
}
 
Example #20
Source File: TileNodeManipulator.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean canDrainFromWand(int cap) {
    ItemStack stack = getStackInSlot(0);
    if(stack == null || !(stack.getItem() instanceof ItemWandCasting)) return false;
    AspectList aspects = ((ItemWandCasting) stack.getItem()).getAllVis(stack);
    for(Aspect a : Aspect.getPrimalAspects()) {
        if(aspects.getAmount(a) < 100) continue;
        if(workAspectList.getAmount(a) < cap) return true;
    }
    return false;
}
 
Example #21
Source File: TileNodeManipulator.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private Aspect drainAspectFromWand(int cap) {
    ItemStack stack = getStackInSlot(0);
    if(stack == null || !(stack.getItem() instanceof ItemWandCasting)) return null; //Should never happen..
    AspectList aspects = ((ItemWandCasting) stack.getItem()).getAllVis(stack);
    for(Aspect a : getRandomlyOrderedPrimalAspectList()) {
        if(aspects.getAmount(a) >= 100 && workAspectList.getAmount(a) < cap) {
            int amt = aspects.getAmount(a);
            ((ItemWandCasting) stack.getItem()).storeVis(stack, a, amt - 100);
            workAspectList.add(a, 1);
            return a;
        }
    }
    return null;
}
 
Example #22
Source File: BlockAuraPylon.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
    if(world.getBlockMetadata(x, y, z) != 1) {
        Block up = world.getBlock(x, y + 1, z);
        return up != null && up instanceof BlockAuraPylon && up.onBlockActivated(world, x, y + 1, z, player, side, par7, par8, par9);
    }
    ItemStack heldItem = player.getHeldItem();
    if(!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting &&
            ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_PYLON")) {
        TileAuraPylon tileAuraPylon = (TileAuraPylon) world.getTileEntity(x, y - 1, z);
        if(MultiblockHelper.isMultiblockPresent(world, x, y, z, RegisteredMultiblocks.auraPylonPattern) &&
                !tileAuraPylon.isPartOfMultiblock() &&
                ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsAuraPylonMultiblock, true)) {
            PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y, z);
            NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32);
            PacketHandler.INSTANCE.sendToAllAround(pkt, point);
            TileAuraPylon ta = (TileAuraPylon) world.getTileEntity(x, y - 1, z);
            ta.setTileInformation(true, false);
            ta = (TileAuraPylon) world.getTileEntity(x, y - 3, z);
            ta.setTileInformation(false, true);
            int count = 1;
            TileEntity iter = world.getTileEntity(x, y - count, z);
            while(iter != null && iter instanceof TileAuraPylon) {
                ((TileAuraPylon) iter).setPartOfMultiblock(true);
                world.markBlockForUpdate(x, y - count, z);
                iter.markDirty();
                pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y - count, z);
                PacketHandler.INSTANCE.sendToAllAround(pkt, point);
                count++;
                iter = world.getTileEntity(x, y - count, z);
            }
        }
    }
    return false;
}
 
Example #23
Source File: BlockEssentiaCompressor.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int these, float are, float some, float variables) { //LUL side, hitx, hity, hitz
    if(world.isRemote) return false;
    TileEntity te = world.getTileEntity(x, y, z);
    if(te == null || !(te instanceof TileEssentiaCompressor)) return false;
    if(((TileEssentiaCompressor) te).isMultiblockFormed()) {
        if(!((TileEssentiaCompressor) te).isMasterTile()) {
            int yOffset = ((TileEssentiaCompressor) te).getMultiblockYIndex();
            return RegisteredBlocks.blockEssentiaCompressor.onBlockActivated(world, x, y - yOffset, z, player, these, are, some, variables);
        }
    } else {
        ItemStack heldItem = player.getHeldItem();
        if(heldItem != null && heldItem.getItem() instanceof ItemWandCasting &&
                ResearchManager.isResearchComplete(player.getCommandSenderName(), SimpleResearchItem.getFullName("ESSENTIA_COMPRESSOR"))) {
            ChunkCoordinates lowest = findLowestCompressorBlock(world, x, y, z);
            boolean canForm = lowest != null && isMuliblockPossible(world, lowest);
            if(canForm && ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsCompressorMultiblock, true)) {
                int multiblockID = TileEssentiaCompressor.getAndIncrementNewMultiblockId();
                TileEssentiaCompressor compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY, lowest.posZ);
                compressor.setInMultiblock(true, 0, multiblockID);
                PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY, lowest.posZ);
                NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY, lowest.posZ, 32);
                PacketHandler.INSTANCE.sendToAllAround(pkt, point);
                compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 1, lowest.posZ);
                compressor.setInMultiblock(false, 1, multiblockID);
                pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 1, lowest.posZ);
                point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 1, lowest.posZ, 32);
                PacketHandler.INSTANCE.sendToAllAround(pkt, point);
                compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 2, lowest.posZ);
                compressor.setInMultiblock(false, 2, multiblockID);
                pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 2, lowest.posZ);
                point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 2, lowest.posZ, 32);
                PacketHandler.INSTANCE.sendToAllAround(pkt, point);
            }
        }
    }
    return false;
}
 
Example #24
Source File: RenderTileInfusionClaw.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void renderWand(ItemStack wandStack, float ticks) {
    GL11.glRotatef(((ticks/3) / 20.0F) * (180F / (float)Math.PI), 0, 1f, 0);

    renderTopPart();

    if (wandStack != null && wandStack.stackSize > 0) {
        GL11.glPushMatrix();

        ItemWandCasting item = (ItemWandCasting) ConfigItems.itemWandCasting;
        ItemStack wandFocusStack = wandStack.copy();
        item.setFocus(wandFocusStack, new ItemStack(ConfigItems.itemFocusPrimal));

        GL11.glRotatef(180, 1, 0, 0);
        GL11.glScalef(0.5f, 0.5f, 0.5f);
        GL11.glTranslatef(0, MathHelper.sin((ticks / 3) / 10.0F) * 0.08F + 0.08F, 0);

        GL11.glTranslatef(0, -1.4924f, 0);
        if(item.isStaff(wandFocusStack)) {
            GL11.glTranslatef(0, -0.5f, 0);

            STAFF_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        } else {
            WAND_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        }
        GL11.glPopMatrix();
    }
}
 
Example #25
Source File: BloodStaffUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 4 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player)
{
    if(Compat.bm && Config.crossWand && player.ticksExisted % 25 == 0)
    {
        try
        {
            if(!checkHotbar(itemstack, player))
                return;
            
            SoulNetworkHandler.checkAndSetItemOwner(itemstack, player);
            
            int cost;
            if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical"))
                cost = Config.bloodvis - 1;
            else
                cost = Config.bloodvis;

            cost = Math.max(0, cost);

            for(int x = 0;x < primals.length;x++)
            {
                int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
                if(deficit > 0)
                {
                    deficit = Math.min(deficit, 100);
                    if(player.capabilities.isCreativeMode)
                        ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                    else if(SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0)
                        ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                    else if(syphonHealth(player))
                    {
                        ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                        return;
                    }
                    else
                        return;
                }
            }
        
        }
        catch(Exception e)
        {
            return;
        }
    }
    
}
 
Example #26
Source File: BloodWandUpdate.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 4 votes vote down vote up
public void onUpdate(ItemStack itemstack, EntityPlayer player)
{
    if(Compat.bm && Config.crossWand && player.ticksExisted % 100 == 0)
    {
        try
        {
            SoulNetworkHandler.checkAndSetItemOwner(itemstack, player);

            int cost;
            if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical"))
                cost = Config.bloodvis - 1;
            else
                cost = Config.bloodvis;

            cost = Math.max(0, cost);
            
            for(int x = 0;x < primals.length;x++)
            {
                int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
                if(deficit > 0)
                {
                    deficit = Math.min(deficit, 100);
                    if(player.capabilities.isCreativeMode)
                        ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                    else if(SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0)
                        ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                    else if(syphonHealth(player))
                    {
                        ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                        return;
                    }
                    else
                        return;
                }
            }
        
        }
        catch(Throwable e)
        {
            return;
        }
    }
    
}
 
Example #27
Source File: RenderTileInfusionClaw.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void renderCircle(TileInfusionClaw tile, float elapsed) {
    GL11.glPushMatrix();

    float speed = (float) Math.pow(1.1, Math.abs(tile.animationStates[9]));
    if (speed > 50) {
        speed = 50;
    }

    if (tile.animationStates[9] > 0) {
        tile.animationStates[9] += 0.5 * elapsed;

        if (tile.animationStates[9] > 20 * 5f) {
            tile.animationStates[9] = -tile.animationStates[9];

            ItemStack wandStack = tile.getStackInSlot(0);
            if(wandStack != null) {
                tile.animationStates[11] = ((ItemWandCasting)wandStack.getItem()).isStaff(wandStack) ? 0.5f : 0.1f;
            }
        }
    } else if (tile.animationStates[9] < 0) {
        tile.animationStates[9] += elapsed * 0.5;

        if (tile.animationStates[9] > 0) {
            tile.animationStates[9] = 0;
        }
    }


    for (int i = 0; i < 4; i++) {
        GL11.glPushMatrix();

        tile.animationStates[10] += speed * (elapsed * 0.001 * Math.PI);

        float angle = (float) (tile.animationStates[10] + (i * 0.5 * Math.PI));
        float x = (float) Math.sin(angle);
        float y = (float) Math.cos(angle);
        float radius = 0.25f;

        GL11.glTranslated(0, (1f / 16f) * Math.sin(angle / 1.4) + (1f / 16f), 0);
        GL11.glTranslated(radius * x, -0.27, radius * y);
        GL11.glRotated(45, Math.cos(angle), 0, -Math.sin(angle));
        GL11.glScalef(0.75f, 0.75f, 0.75f);

        renderPart(i);

        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}