From 78fae6c4ed28b0ee104e68ee7c8f7d9e24954606 Mon Sep 17 00:00:00 2001 From: Jeremy Diamond Date: Mon, 3 Feb 2014 01:33:20 -0800 Subject: [PATCH] Cap discount, fixing wand charging while beacon is inactive --- .../forbidden/items/SoulWandUpdate.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/com/spiteful/forbidden/items/SoulWandUpdate.java b/src/com/spiteful/forbidden/items/SoulWandUpdate.java index c4ce37d..8616ad8 100644 --- a/src/com/spiteful/forbidden/items/SoulWandUpdate.java +++ b/src/com/spiteful/forbidden/items/SoulWandUpdate.java @@ -6,6 +6,7 @@ import com.spiteful.forbidden.Compat; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntitySkull; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.wands.IWandRodOnUpdate; import thaumcraft.common.items.wands.ItemWandCasting; @@ -33,7 +34,7 @@ public class SoulWandUpdate implements IWandRodOnUpdate { int z = info.getInteger("z"); TileEntityPlayerBeacon bacon = (TileEntityPlayerBeacon) player.worldObj.getBlockTileEntity(x, y, z); - if(bacon != null) + if(bacon != null && bacon.hasSkull()) { if(Compat.tt) { @@ -46,6 +47,19 @@ public class SoulWandUpdate implements IWandRodOnUpdate { if(player.worldObj.getBlockId(x, y, z - 1) == Compat.tabletID) return; } + + TileEntitySkull skull = (TileEntitySkull) bacon.worldObj.getBlockTileEntity(bacon.xCoord, bacon.yCoord + 1, bacon.zCoord); + if(skull == null) + return; + else if (!skull.getExtraType().equals(bacon.getOwner())) + return; + + int cost; + if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("soul")) + cost = 20; + else + cost = 50; + int charge = 0; for(int j = 0;j < primals.length;j++) { @@ -66,6 +80,10 @@ public class SoulWandUpdate implements IWandRodOnUpdate { { return; } + catch(NoClassDefFoundError e) + { + return; + } } } }