Search in sources :

Example 6 with AffinityData

use of am2.playerextensions.AffinityData in project ArsMagica2 by Mithion.

the class AffinityHelper method onEntityLivingBase.

@SubscribeEvent
public void onEntityLivingBase(LivingUpdateEvent event) {
    EntityLivingBase ent = event.entityLiving;
    if (ent instanceof EntityEnderman) {
        if (ent.getLastAttacker() != ent.getAITarget() && ent.getAITarget() instanceof EntityPlayer) {
            AffinityData affinityData = AffinityData.For(ent.getAITarget());
            float enderDepth = affinityData.getAffinityDepth(Affinity.ENDER);
            if (enderDepth == 1.0f) {
                ent.setRevengeTarget(null);
            }
        }
    }
    if (!(ent instanceof EntityPlayer))
        return;
    AffinityData affinityData = AffinityData.For(ent);
    affinityData.tickDiminishingReturns();
    float waterDepth = affinityData.getAffinityDepth(Affinity.WATER);
    float fireDepth = affinityData.getAffinityDepth(Affinity.FIRE);
    float natureDepth = affinityData.getAffinityDepth(Affinity.NATURE);
    float iceDepth = affinityData.getAffinityDepth(Affinity.ICE);
    float lifeDepth = affinityData.getAffinityDepth(Affinity.LIFE);
    float enderDepth = affinityData.getAffinityDepth(Affinity.ENDER);
    float lightningDepth = affinityData.getAffinityDepth(Affinity.LIGHTNING);
    AffinityModifiers.instance.applySpeedModifiersBasedOnDepth((EntityPlayer) ent, natureDepth, iceDepth, lightningDepth);
    AffinityModifiers.instance.applyHealthModifiers((EntityPlayer) ent, enderDepth, waterDepth, fireDepth, lightningDepth);
    applyFulmintion((EntityPlayer) ent, lightningDepth);
    if (lightningDepth >= 0.5f) {
        ent.stepHeight = 1.014f;
    } else if (ent.stepHeight == 1.014f) {
        ent.stepHeight = 0.5f;
    }
    affinityData.accumulatedLifeRegen += 0.025 * lifeDepth;
    if (affinityData.accumulatedLifeRegen > 1.0f) {
        affinityData.accumulatedLifeRegen -= 1.0f;
        ent.heal(1);
    }
    if (natureDepth == 1.0f) {
        if (ent.worldObj.canBlockSeeTheSky((int) ent.posX, (int) ent.posY, (int) ent.posZ) && ent.worldObj.isDaytime()) {
            affinityData.accumulatedHungerRegen += 0.02f;
            if (affinityData.accumulatedHungerRegen > 1.0f) {
                ((EntityPlayer) ent).getFoodStats().addStats(1, 0.025f);
                affinityData.accumulatedHungerRegen -= 1;
            }
        } else {
            ((EntityPlayer) ent).addExhaustion(0.025f);
        }
        if (ent.isCollidedHorizontally) {
            if (!ent.isSneaking()) {
                float movement = ExtendedProperties.For(ent).getIsFlipped() ? -0.25f : 0.25f;
                ent.moveEntity(0, movement, 0);
                ent.motionY = 0;
            } else {
                ent.motionY *= 0.79999999;
            }
            ent.fallDistance = 0;
        }
    }
    // Ender Affinity
    if (enderDepth >= 0.75f && affinityData.hasActivatedNightVision()) {
        if (!ent.worldObj.isRemote && (!ent.isPotionActive(Potion.nightVision.id) || ent.getActivePotionEffect(Potion.nightVision).getDuration() <= 220)) {
            ent.addPotionEffect(new PotionEffect(Potion.nightVision.id, 300, 1));
        }
    }
    if (ent.onGround)
        affinityData.setLastGroundPosition(new AMVector3(ent));
    affinityData.tickCooldown();
    if (ent.isInWater()) {
        float earthDepth = affinityData.getAffinityDepth(Affinity.EARTH);
        if (earthDepth > 0.25f && ent.motionY > -0.3f) {
            ent.addVelocity(0, -0.01f * earthDepth, 0);
        }
        if (waterDepth > 0.5f) {
            if (!ent.isPotionActive(BuffList.swiftSwim.id) || ent.getActivePotionEffect(BuffList.swiftSwim).getDuration() < 10) {
                ent.addPotionEffect(new BuffEffectSwiftSwim(100, waterDepth > 0.75f ? 2 : 1));
            }
        }
        if (waterDepth > 0.4 && ent.worldObj.rand.nextInt(20) < 4)
            ent.setAir(ent.getAir() + 1);
        if (!ent.worldObj.isRemote && ent.worldObj.rand.nextInt(100) < 5) {
            ent.setAir(ent.getAir() + 1);
            byte[] data = new AMDataWriter().add(ent.getEntityId()).add(ent.getAir()).generate();
            AMNetHandler.INSTANCE.sendPacketToClientPlayer((EntityPlayerMP) ent, AMPacketIDs.SYNC_AIR_CHANGE, data);
        }
        boolean waterMovementFlag = false;
        if ((ent instanceof EntityPlayer && ((EntityPlayer) ent).inventory.armorInventory[1] != null && ((EntityPlayer) ent).inventory.armorInventory[1].getItem() == ItemsCommonProxy.waterGuardianOrbs)) {
            waterMovementFlag = true;
            if (!ent.worldObj.isRemote && (!ent.isPotionActive(BuffList.waterBreathing) || ent.getActivePotionEffect(BuffList.waterBreathing).getDuration() <= 200))
                ent.addPotionEffect(new BuffEffectWaterBreathing(400, 2));
        }
        if (waterDepth > 0.5f || waterMovementFlag) {
            applyReverseWaterMovement(ent);
        }
    }
    if (ent.worldObj.isRaining() && !ent.worldObj.isRemote && ent.worldObj.getBiomeGenForCoords((int) Math.floor(ent.posX), (int) Math.floor(ent.posZ)).canSpawnLightningBolt()) {
        float airDepth = affinityData.getAffinityDepth(Affinity.AIR);
        if (airDepth > 0.5f && airDepth < 0.85f && !ent.worldObj.isRemote && ent.worldObj.rand.nextInt(100) < 10) {
            if (!ent.isSneaking() && !ent.isPotionActive(BuffList.gravityWell) && !ent.isInsideOfMaterial(Material.water) && ent.isWet()) {
                double velX = ent.worldObj.rand.nextDouble() - 0.5;
                double velY = ent.worldObj.rand.nextDouble() - 0.5;
                double velZ = ent.worldObj.rand.nextDouble() - 0.5;
                ent.addVelocity(velX, velY, velZ);
                AMNetHandler.INSTANCE.sendVelocityAddPacket(ent.worldObj, ent, velX, velY, velZ);
            }
        }
    }
    if (ent.isSneaking()) {
        if (iceDepth >= 0.5f) {
            makeIceBridge((EntityPlayer) ent, iceDepth);
        }
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) AffinityData(am2.playerextensions.AffinityData) AMDataWriter(am2.network.AMDataWriter) AMVector3(am2.api.math.AMVector3) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityEnderman(net.minecraft.entity.monster.EntityEnderman) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 7 with AffinityData

use of am2.playerextensions.AffinityData in project ArsMagica2 by Mithion.

the class AffinityHelper method onEntityFall.

@SubscribeEvent
public void onEntityFall(LivingFallEvent event) {
    EntityLivingBase ent = event.entityLiving;
    if (!(ent instanceof EntityPlayer))
        return;
    AffinityData affinityData = AffinityData.For(ent);
    float earthDepth = affinityData.getAffinityDepth(Affinity.EARTH);
    if (earthDepth > 0.25f) {
        event.distance += 1.25 * (earthDepth);
    }
    float airDepth = affinityData.getAffinityDepth(Affinity.AIR);
    if (airDepth >= 0.5f) {
        event.distance -= 2 * (airDepth);
        if (event.distance < 0)
            event.distance = 0;
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) AffinityData(am2.playerextensions.AffinityData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 8 with AffinityData

use of am2.playerextensions.AffinityData in project ArsMagica2 by Mithion.

the class AffinityHelper method onEntityHurt.

@SubscribeEvent
public void onEntityHurt(LivingHurtEvent event) {
    EntityLivingBase ent = event.entityLiving;
    AffinityData affinityData = AffinityData.For(ent);
    if (event.source.getSourceOfDamage() instanceof EntityPlayer) {
        float attackerFireDepth = AffinityData.For((EntityLivingBase) event.source.getSourceOfDamage()).getAffinityDepth(Affinity.FIRE);
        if (attackerFireDepth > 0.8f && ((EntityPlayer) event.source.getSourceOfDamage()).getCurrentEquippedItem() == null) {
            ent.setFire(4);
            event.ammount += 3;
        }
        float attackerLightningDepth = AffinityData.For((EntityLivingBase) event.source.getSourceOfDamage()).getAffinityDepth(Affinity.LIGHTNING);
        if (attackerLightningDepth > 0.75f && !ent.worldObj.isRemote && ((EntityPlayer) event.source.getSourceOfDamage()).getCurrentEquippedItem() == null) {
            EntityLightningBolt elb = new EntityLightningBolt(ent.worldObj, ent.posX, ent.posY, ent.posZ);
            elb.setPosition(ent.posX, ent.posY, ent.posZ);
            ent.worldObj.addWeatherEffect(elb);
        }
    }
    if (!(ent instanceof EntityPlayer))
        return;
    float earthDepth = affinityData.getAffinityDepth(Affinity.EARTH);
    if (earthDepth > 0.25f) {
        float reduction = 0.1f * earthDepth;
        event.ammount -= event.ammount * reduction;
    }
    float arcaneDepth = affinityData.getAffinityDepth(Affinity.ARCANE);
    if (arcaneDepth > 0.25f) {
        event.ammount *= 1.1f;
    }
    float waterDepth = affinityData.getAffinityDepth(Affinity.WATER);
    if (waterDepth > 0.9f && event.source.getSourceOfDamage() instanceof EntityEnderman) {
        event.source.getSourceOfDamage().attackEntityFrom(DamageSource.drown, 2);
    }
    float fireDepth = affinityData.getAffinityDepth(Affinity.FIRE);
    if (event.source.isFireDamage()) {
        float reduction = 1 - (0.6f * fireDepth);
        event.ammount = event.ammount * reduction;
    }
    float enderDepth = affinityData.getAffinityDepth(Affinity.ENDER);
    if (event.source == DamageSource.magic || event.source == DamageSource.wither) {
        float reduction = 1 - (0.75f * enderDepth);
        event.ammount = event.ammount * reduction;
    }
    if (event.source.getSourceOfDamage() instanceof EntityLivingBase) {
        float natureDepth = affinityData.getAffinityDepth(Affinity.NATURE);
        if (natureDepth == 1.0f) {
            ((EntityLivingBase) event.source.getSourceOfDamage()).attackEntityFrom(DamageSource.cactus, 3);
        } else if (natureDepth >= 0.75f) {
            ((EntityLivingBase) event.source.getSourceOfDamage()).attackEntityFrom(DamageSource.cactus, 2);
        } else if (natureDepth >= 0.5f) {
            ((EntityLivingBase) event.source.getSourceOfDamage()).attackEntityFrom(DamageSource.cactus, 1);
        }
        float iceDepth = affinityData.getAffinityDepth(Affinity.ICE);
        BuffEffectFrostSlowed effect = null;
        if (iceDepth == 1.0f) {
            effect = new BuffEffectFrostSlowed(200, 2);
        } else if (iceDepth >= 0.75f) {
            effect = new BuffEffectFrostSlowed(160, 1);
        } else if (iceDepth >= 0.5f) {
            effect = new BuffEffectFrostSlowed(100, 0);
        }
        if (effect != null) {
            ((EntityLivingBase) event.source.getSourceOfDamage()).addPotionEffect(effect);
        }
    }
    if (event.ammount == 0)
        event.setCanceled(true);
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) AffinityData(am2.playerextensions.AffinityData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt) EntityEnderman(net.minecraft.entity.monster.EntityEnderman) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 9 with AffinityData

use of am2.playerextensions.AffinityData in project ArsMagica2 by Mithion.

the class GuiSkillTrees method drawAffinity.

private void drawAffinity() {
    hoveredAffinity = null;
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    int IIconsize = 16;
    int halfIconSize = IIconsize / 2;
    int cx = l + xSize / 2 - halfIconSize;
    int cy = i1 + ySize / 2 - halfIconSize;
    int angle = -90;
    int distance = 85;
    int smallDist = 15;
    float angleOffset = 17.5f;
    AffinityData ad = AffinityData.For(Minecraft.getMinecraft().thePlayer);
    for (Affinity aff : Affinity.getOrderedAffinities()) {
        IIcon IIcon = aff.representItem.getIconFromDamage(aff.representMeta);
        int newX = (int) (cx + Math.cos(Math.toRadians(angle)) * distance);
        int newY = (int) (cy + Math.sin(Math.toRadians(angle)) * distance);
        int cx1 = (int) (cx + Math.cos(Math.toRadians(angle + angleOffset)) * smallDist);
        int cx2 = (int) (cx + Math.cos(Math.toRadians(angle - angleOffset)) * smallDist);
        int cy1 = (int) (cy + Math.sin(Math.toRadians(angle + angleOffset)) * smallDist);
        int cy2 = (int) (cy + Math.sin(Math.toRadians(angle - angleOffset)) * smallDist);
        float depthDist = ((distance - smallDist) * ad.getAffinityDepth(aff)) + smallDist;
        int lx = (int) (cx + Math.cos(Math.toRadians(angle)) * depthDist);
        int ly = (int) (cy + Math.sin(Math.toRadians(angle)) * depthDist);
        int displace = (int) ((Math.max(cx1, cx2) - Math.min(cx1, cx2) + Math.max(cy1, cy2) - Math.min(cy1, cy2)) / 3f);
        if (ad.getAffinityDepth(aff) > 0.01f) {
            AMGuiHelper.instance.fractalLine2d(lx + halfIconSize, ly + halfIconSize, cx1 + halfIconSize, cy1 + halfIconSize, this.zLevel, aff.color, displace, 1.1f);
            AMGuiHelper.instance.fractalLine2d(lx + halfIconSize, ly + halfIconSize, cx2 + halfIconSize, cy2 + halfIconSize, this.zLevel, aff.color, displace, 1.1f);
            AMGuiHelper.instance.fractalLine2d(cx1 + halfIconSize, cy1 + halfIconSize, lx + halfIconSize, ly + halfIconSize, this.zLevel, aff.color, displace, 0.8f);
            AMGuiHelper.instance.fractalLine2d(cx2 + halfIconSize, cy2 + halfIconSize, lx + halfIconSize, ly + halfIconSize, this.zLevel, aff.color, displace, 0.8f);
        } else {
            AMGuiHelper.instance.line2d(lx + halfIconSize, ly + halfIconSize, cx1 + halfIconSize, cy1 + halfIconSize, this.zLevel, aff.color);
            AMGuiHelper.instance.line2d(lx + halfIconSize, ly + halfIconSize, cx2 + halfIconSize, cy2 + halfIconSize, this.zLevel, aff.color);
        }
        DrawIconAtXY(IIcon, "items", newX, newY, IIconsize, IIconsize, false);
        String depthString = String.format("%.2f", ad.getAffinityDepth(aff) * 100);
        fontRendererObj.drawString(depthString, newX + halfIconSize - fontRendererObj.getStringWidth(depthString) / 2, newY + IIconsize, aff.color, false);
        angle += 36;
        // if (lastMouseX > l && lastMouseX < l + xSize && lastMouseY > i1 && lastMouseY < i1 + ySize){
        if (lastMouseX > newX && lastMouseX < newX + IIconsize) {
            if (lastMouseY > newY && lastMouseY < newY + IIconsize) {
                hoveredAffinity = aff;
            }
        }
    // }
    }
}
Also used : IIcon(net.minecraft.util.IIcon) AffinityData(am2.playerextensions.AffinityData) Affinity(am2.api.spell.enums.Affinity)

Example 10 with AffinityData

use of am2.playerextensions.AffinityData in project ArsMagica2 by Mithion.

the class TileEntityInscriptionTable method writeRecipeAndDataToBook.

public ItemStack writeRecipeAndDataToBook(ItemStack bookstack, EntityPlayer player, String title) {
    if (bookstack.getItem() == Items.written_book && this.currentRecipe != null) {
        if (!currentRecipeIsValid().valid)
            return bookstack;
        if (!bookstack.hasTagCompound())
            bookstack.setTagCompound(new NBTTagCompound());
        else if (// don't overwrite a completed spell
        bookstack.getTagCompound().getBoolean("spellFinalized"))
            return bookstack;
        LinkedHashMap<String, Integer> materialsList = new LinkedHashMap<String, Integer>();
        materialsList.put(ItemsCommonProxy.rune.getItemStackDisplayName(new ItemStack(ItemsCommonProxy.rune, 1, ItemsCommonProxy.rune.META_BLANK)), 1);
        ArrayList<ItemStack> componentRecipeList = new ArrayList<ItemStack>();
        int count = 0;
        ArrayList<ISpellPart> allRecipeItems = new ArrayList<ISpellPart>();
        for (ArrayList<ISpellPart> shapeGroup : shapeGroups) {
            if (shapeGroup == null || shapeGroup.size() == 0)
                continue;
            allRecipeItems.addAll(shapeGroup);
        }
        allRecipeItems.addAll(currentRecipe);
        for (ISpellPart part : allRecipeItems) {
            if (part == null) {
                LogHelper.error("Unable to write recipe to book.  Recipe part is null!");
                return bookstack;
            }
            Object[] recipeItems = part.getRecipeItems();
            SpellRecipeItemsEvent event = new SpellRecipeItemsEvent(SkillManager.instance.getSkillName(part), SkillManager.instance.getShiftedPartID(part), recipeItems);
            MinecraftForge.EVENT_BUS.post(event);
            recipeItems = event.recipeItems;
            if (recipeItems == null) {
                LogHelper.error("Unable to write recipe to book.  Recipe items are null for part %d!", part.getID());
                return bookstack;
            }
            for (int i = 0; i < recipeItems.length; ++i) {
                Object o = recipeItems[i];
                String materialkey = "";
                int qty = 1;
                ItemStack recipeStack = null;
                if (o instanceof ItemStack) {
                    materialkey = ((ItemStack) o).getDisplayName();
                    recipeStack = (ItemStack) o;
                } else if (o instanceof Item) {
                    recipeStack = new ItemStack((Item) o);
                    materialkey = ((Item) o).getItemStackDisplayName(new ItemStack((Item) o));
                } else if (o instanceof Block) {
                    recipeStack = new ItemStack((Block) o);
                    materialkey = ((Block) o).getLocalizedName();
                } else if (o instanceof String) {
                    if (((String) o).startsWith("P:")) {
                        String s = ((String) o).substring(2);
                        int pfx = SpellRecipeManager.parsePotionMeta(s);
                        recipeStack = new ItemStack(Items.potionitem, 1, pfx);
                        materialkey = recipeStack.getDisplayName();
                    } else if (((String) o).startsWith("E:")) {
                        int[] ids = SpellRecipeManager.ParseEssenceIDs((String) o);
                        materialkey = "Essence (";
                        for (int powerID : ids) {
                            PowerTypes type = PowerTypes.getByID(powerID);
                            materialkey += type.name() + "/";
                        }
                        if (materialkey.equals("Essence (")) {
                            ++i;
                            continue;
                        }
                        o = recipeItems[++i];
                        if (materialkey.startsWith("Essence (")) {
                            materialkey = materialkey.substring(0, materialkey.lastIndexOf("/")) + ")";
                            qty = (Integer) o;
                            int flag = 0;
                            for (int f : ids) {
                                flag |= f;
                            }
                            recipeStack = new ItemStack(ItemsCommonProxy.essence, qty, ItemsCommonProxy.essence.META_MAX + flag);
                        }
                    } else {
                        ArrayList<ItemStack> ores = OreDictionary.getOres((String) o);
                        recipeStack = ores.size() > 0 ? ores.get(1) : null;
                        materialkey = (String) o;
                    }
                }
                if (materialsList.containsKey(materialkey)) {
                    int old = materialsList.get(materialkey);
                    old += qty;
                    materialsList.put(materialkey, old);
                } else {
                    materialsList.put(materialkey, qty);
                }
                if (recipeStack != null)
                    componentRecipeList.add(recipeStack);
            }
        }
        materialsList.put(ItemsCommonProxy.spellParchment.getItemStackDisplayName(new ItemStack(ItemsCommonProxy.spellParchment)), 1);
        StringBuilder sb = new StringBuilder();
        int sgCount = 0;
        int[][] shapeGroupCombos = new int[shapeGroups.size()][];
        for (ArrayList<ISpellPart> shapeGroup : shapeGroups) {
            sb.append("Shape Group " + ++sgCount + "\n\n");
            Iterator<ISpellPart> it = shapeGroup.iterator();
            shapeGroupCombos[sgCount - 1] = SpellPartListToStringBuilder(it, sb, " -");
            sb.append("\n");
        }
        sb.append("Combination:\n\n");
        Iterator<ISpellPart> it = currentRecipe.iterator();
        ArrayList<Integer> outputCombo = new ArrayList<Integer>();
        int[] outputData = SpellPartListToStringBuilder(it, sb, null);
        ArrayList<NBTTagString> pages = Story.splitStoryPartIntoPages(sb.toString());
        sb = new StringBuilder();
        sb.append("\n\nMaterials List:\n\n");
        for (String s : materialsList.keySet()) {
            sb.append(materialsList.get(s) + " x " + s + "\n");
        }
        pages.addAll(Story.splitStoryPartIntoPages(sb.toString()));
        sb = new StringBuilder();
        sb.append("Affinity Breakdown:\n\n");
        it = currentRecipe.iterator();
        HashMap<Affinity, Integer> affinityData = new HashMap<Affinity, Integer>();
        int cpCount = 0;
        while (it.hasNext()) {
            ISpellPart part = it.next();
            if (part instanceof ISpellComponent) {
                EnumSet<Affinity> aff = ((ISpellComponent) part).getAffinity();
                for (Affinity affinity : aff) {
                    int qty = 1;
                    if (affinityData.containsKey(affinity)) {
                        qty = 1 + affinityData.get(affinity);
                    }
                    affinityData.put(affinity, qty);
                }
                cpCount++;
            }
        }
        ValueComparator vc = new ValueComparator(affinityData);
        TreeMap<Affinity, Integer> sorted = new TreeMap<Affinity, Integer>(vc);
        sorted.putAll(affinityData);
        for (Affinity aff : sorted.keySet()) {
            float pct = (float) sorted.get(aff) / (float) cpCount * 100f;
            sb.append(String.format("%s: %.2f%%", aff.toString(), pct));
            sb.append("\n");
        }
        pages.addAll(Story.splitStoryPartIntoPages(sb.toString()));
        Story.WritePartToNBT(bookstack.stackTagCompound, pages);
        bookstack = Story.finalizeStory(bookstack, title, player.getCommandSenderName());
        int[] recipeData = new int[componentRecipeList.size() * 3];
        int idx = 0;
        for (ItemStack stack : componentRecipeList) {
            recipeData[idx++] = Item.getIdFromItem(stack.getItem());
            recipeData[idx++] = stack.stackSize;
            recipeData[idx++] = stack.getItemDamage();
        }
        bookstack.stackTagCompound.setIntArray("spell_combo", recipeData);
        bookstack.stackTagCompound.setIntArray("output_combo", outputData);
        bookstack.stackTagCompound.setInteger("numShapeGroups", shapeGroupCombos.length);
        int index = 0;
        for (int[] sgArray : shapeGroupCombos) {
            bookstack.stackTagCompound.setIntArray("shapeGroupCombo_" + index++, sgArray);
        }
        bookstack.stackTagCompound.setString("spell_mod_version", AMCore.instance.getVersion());
        if (currentSpellName.equals(""))
            currentSpellName = "Spell Recipe";
        bookstack.setStackDisplayName(currentSpellName);
        this.currentRecipe.clear();
        for (ArrayList<ISpellPart> list : shapeGroups) list.clear();
        currentSpellName = "";
        bookstack.stackTagCompound.setBoolean("spellFinalized", true);
        worldObj.playSound(xCoord, yCoord, zCoord, "arsmagica2:misc.inscriptiontable.takebook", 1.0f, 1.0f, true);
        worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
    }
    return bookstack;
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) NBTTagString(net.minecraft.nbt.NBTTagString) Item(net.minecraft.item.Item) PowerTypes(am2.api.power.PowerTypes) NBTTagString(net.minecraft.nbt.NBTTagString) SpellRecipeItemsEvent(am2.api.events.SpellRecipeItemsEvent) Block(net.minecraft.block.Block) Affinity(am2.api.spell.enums.Affinity) ItemStack(net.minecraft.item.ItemStack)

Aggregations

AffinityData (am2.playerextensions.AffinityData)10 Affinity (am2.api.spell.enums.Affinity)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)5 EntityLivingBase (net.minecraft.entity.EntityLivingBase)4 ItemStack (net.minecraft.item.ItemStack)3 EntityEnderman (net.minecraft.entity.monster.EntityEnderman)2 AffinityChangingEvent (am2.api.events.AffinityChangingEvent)1 ManaCostEvent (am2.api.events.ManaCostEvent)1 SpellRecipeItemsEvent (am2.api.events.SpellRecipeItemsEvent)1 AMVector2 (am2.api.math.AMVector2)1 AMVector3 (am2.api.math.AMVector3)1 PowerTypes (am2.api.power.PowerTypes)1 AMDataWriter (am2.network.AMDataWriter)1 ExtendedProperties (am2.playerextensions.ExtendedProperties)1 RiftStorage (am2.playerextensions.RiftStorage)1 SkillData (am2.playerextensions.SkillData)1 SpellRequirements (am2.spell.SpellUtils.SpellRequirements)1 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 Block (net.minecraft.block.Block)1