From 6298fb2bc2b5a78548251a77173c3850c4e3d3b9 Mon Sep 17 00:00:00 2001 From: Jeremy Diamond Date: Wed, 9 Apr 2014 01:27:39 -0700 Subject: [PATCH] Fixing crash when old version of AM2 is present --- .../forbidden/items/wands/ManaWandUpdate.java | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/com/spiteful/forbidden/items/wands/ManaWandUpdate.java b/src/com/spiteful/forbidden/items/wands/ManaWandUpdate.java index f7d336e..4b58883 100644 --- a/src/com/spiteful/forbidden/items/wands/ManaWandUpdate.java +++ b/src/com/spiteful/forbidden/items/wands/ManaWandUpdate.java @@ -20,27 +20,31 @@ public class ManaWandUpdate implements IWandRodOnUpdate { { if(player.ticksExisted % 100 == 0){ - IExtendedProperties prop = ArsMagicaApi.instance.getExtendedProperties(player); - - float cost; - if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("vinteum")) - cost = 90.0F; - else - cost = 150.0F; + try + { + IExtendedProperties prop = ArsMagicaApi.instance.getExtendedProperties(player); - if(prop == null || prop.getCurrentMana() <= 0) - return; - - - for(int x = 0;x < primals.length;x++){ - if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack)) { - if(prop.getCurrentMana() > cost) - { - prop.setCurrentMana(prop.getCurrentMana() - cost); - ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + float cost; + if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("vinteum")) + cost = 90.0F; + else + cost = 150.0F; + + if(prop == null || prop.getCurrentMana() <= 0) + return; + + + for(int x = 0;x < primals.length;x++){ + if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack)) { + if(prop.getCurrentMana() > cost) + { + prop.setCurrentMana(prop.getCurrentMana() - cost); + ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true); + } } } } + catch(Throwable e){} } }