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"));
}
}
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") + ".");
}
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);
}
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);
}
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));
}
Aggregations