Search in sources :

Example 76 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class SpellBase method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
    if (!stack.hasTagCompound())
        return;
    ItemStack legacySpell = SpellUtils.instance.constructSpellStack(stack);
    SpellRequirements reqs = SpellUtils.instance.getSpellRequirements(legacySpell, player);
    float manaCost = reqs.manaCost;
    float burnout = reqs.burnout;
    ArrayList<ItemStack> reagents = reqs.reagents;
    ManaCostEvent mce = new ManaCostEvent(legacySpell, player, manaCost, 0);
    MinecraftForge.EVENT_BUS.post(mce);
    manaCost = mce.manaCost;
    list.add(String.format("\2477Mana Cost: %.2f", manaCost));
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
        HashMap<Affinity, Float> affinityData = SpellUtils.instance.AffinityFor(legacySpell);
        for (Affinity aff : affinityData.keySet()) {
            list.add(String.format("%s (%.2f%%)", aff.toString(), affinityData.get(aff) * 100));
        }
        if (stack.stackTagCompound.hasKey("Lore")) {
            NBTTagList nbttaglist1 = stack.stackTagCompound.getTagList("Lore", Constants.NBT.TAG_COMPOUND);
            if (nbttaglist1.tagCount() > 0) {
                for (int j = 0; j < nbttaglist1.tagCount(); ++j) {
                    list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + nbttaglist1.getStringTagAt(j));
                }
            }
        }
    } else {
        list.add(StatCollector.translateToLocal("am2.tooltip.shiftForAffinity"));
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) SpellRequirements(am2.spell.SpellUtils.SpellRequirements) ManaCostEvent(am2.api.events.ManaCostEvent) Affinity(am2.api.spell.enums.Affinity) ItemStack(net.minecraft.item.ItemStack) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 77 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class ItemSpellStaff method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    if (stack.stackTagCompound == null || isMagiTechStaff())
        return;
    float chargeCost = 1;
    ItemStack spell = getSpellStack(stack);
    if (spell != null) {
        chargeCost = SpellUtils.instance.getSpellRequirements(spell, par2EntityPlayer).manaCost;
    }
    if (chargeCost == 0)
        chargeCost = 1;
    float chargeRemaining = stack.stackTagCompound.getFloat(NBT_CHARGE);
    int chargesRemaining = (int) Math.ceil(chargeRemaining / chargeCost);
    par3List.add(StatCollector.translateToLocal("am2.tooltip.charge") + ": " + (int) chargeRemaining + " / " + maxCharge);
    par3List.add("" + chargesRemaining + " " + StatCollector.translateToLocal("am2.tooltip.uses") + ".");
}
Also used : ItemStack(net.minecraft.item.ItemStack) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 78 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class CompendiumEntryBoss method getCompendiumGui.

@Override
@SideOnly(Side.CLIENT)
protected GuiArcaneCompendium getCompendiumGui(String searchID, int meta) {
    String modEntityID = "arsmagica2." + searchID;
    Class entityClass = (Class) EntityList.stringToClassMapping.get(modEntityID);
    if (entityClass != null) {
        try {
            Constructor ctor = entityClass.getConstructor(World.class);
            return new GuiArcaneCompendium((Entity) ctor.newInstance(Minecraft.getMinecraft().theWorld));
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
    return new GuiArcaneCompendium(searchID);
}
Also used : GuiArcaneCompendium(am2.guis.GuiArcaneCompendium) Constructor(java.lang.reflect.Constructor) InvocationTargetException(java.lang.reflect.InvocationTargetException) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 79 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class CompendiumEntryMob method getCompendiumGui.

@Override
@SideOnly(Side.CLIENT)
protected GuiArcaneCompendium getCompendiumGui(String searchID, int meta) {
    String modEntityID = searchID.indexOf(".") == -1 ? "arsmagica2." + searchID : searchID;
    Class entityClass = (Class) EntityList.stringToClassMapping.get(modEntityID);
    if (entityClass != null) {
        try {
            Constructor ctor = entityClass.getConstructor(World.class);
            return new GuiArcaneCompendium((Entity) ctor.newInstance(Minecraft.getMinecraft().theWorld));
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
    return new GuiArcaneCompendium(searchID);
}
Also used : GuiArcaneCompendium(am2.guis.GuiArcaneCompendium) Constructor(java.lang.reflect.Constructor) InvocationTargetException(java.lang.reflect.InvocationTargetException) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 80 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class ItemManaPotionBundle method getSubItems.

@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
    par3List.add(new ItemStack(ItemsCommonProxy.manaPotionBundle, 1, (0 << 8) + 3));
    par3List.add(new ItemStack(ItemsCommonProxy.manaPotionBundle, 1, (1 << 8) + 3));
    par3List.add(new ItemStack(ItemsCommonProxy.manaPotionBundle, 1, (2 << 8) + 3));
    par3List.add(new ItemStack(ItemsCommonProxy.manaPotionBundle, 1, (3 << 8) + 3));
    par3List.add(new ItemStack(ItemsCommonProxy.manaPotionBundle, 1, (4 << 8) + 3));
}
Also used : ItemStack(net.minecraft.item.ItemStack) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

SideOnly (cpw.mods.fml.relauncher.SideOnly)204 ItemStack (net.minecraft.item.ItemStack)52 IIcon (net.minecraft.util.IIcon)17 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)17 Vec3dCube (uk.co.qmunity.lib.vec.Vec3dCube)13 Block (net.minecraft.block.Block)12 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)10 TileEntity (net.minecraft.tileentity.TileEntity)10 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)9 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)8 ArrayList (java.util.ArrayList)8 Rotation (uk.co.qmunity.lib.transform.Rotation)8 AMParticle (am2.particles.AMParticle)6 IconFlipped (net.minecraft.client.renderer.IconFlipped)6 ItemBlock (net.minecraft.item.ItemBlock)6 Minecraft (net.minecraft.client.Minecraft)5 Tessellator (net.minecraft.client.renderer.Tessellator)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)5 GuiScreen (net.minecraft.client.gui.GuiScreen)4 RenderHelper (uk.co.qmunity.lib.client.render.RenderHelper)4