From ba4e48627cd5e244082989b9d37dcc7637886dad Mon Sep 17 00:00:00 2001 From: blue42u Date: Tue, 29 Apr 2014 08:33:00 -0500 Subject: [PATCH] Fix the casting glitch --- .../blocks/logic/CastingBasinLogic.java | 48 +++++++++---------- .../blocks/logic/CastingTableLogic.java | 48 +++++++++---------- 2 files changed, 44 insertions(+), 52 deletions(-) diff --git a/src/main/java/tconstruct/blocks/logic/CastingBasinLogic.java b/src/main/java/tconstruct/blocks/logic/CastingBasinLogic.java index 1c45de88..cc573141 100644 --- a/src/main/java/tconstruct/blocks/logic/CastingBasinLogic.java +++ b/src/main/java/tconstruct/blocks/logic/CastingBasinLogic.java @@ -70,22 +70,19 @@ public class CastingBasinLogic extends InventoryLogic implements IFluidTank, IFl public int updateCapacity () // Only used to initialize { - int ret = TConstruct.ingotLiquidValue; - ItemStack inv = inventory[0]; + int ret = TConstruct.ingotLiquidValue; + int rec = TConstruct.basinCasting.getCastingAmount(this.liquid, inv); - if (inv != null && inv.getItem() instanceof IPattern) - { - int cost = ((IPattern) inv.getItem()).getPatternCost(inv); - if (cost > 0) - ret *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5; - else - ret = TConstruct.basinCasting.getCastingAmount(this.liquid, inv); - } - - else - { - ret = TConstruct.basinCasting.getCastingAmount(this.liquid, inv); + if (rec > 0) + ret = rec; + else { + if (inv != null && inv.getItem() instanceof IPattern) + { + int cost = ((IPattern) inv.getItem()).getPatternCost(inv); + if (cost > 0) + ret *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5; + } } TConstruct.logger.info("Ret: " + ret); @@ -96,19 +93,18 @@ public class CastingBasinLogic extends InventoryLogic implements IFluidTank, IFl { int ret = TConstruct.ingotLiquidValue; - ItemStack inv = inventory[0]; - - if (inv != null && inv.getItem() instanceof IPattern) - { - int cost = ((IPattern) inv.getItem()).getPatternCost(inv); - if (cost > 0) - ret *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5; - else - ret = capacity; - } - - else + if (capacity > 0) ret = capacity; + else { + ItemStack inv = inventory[0]; + + if (inv != null && inv.getItem() instanceof IPattern) + { + int cost = ((IPattern) inv.getItem()).getPatternCost(inv); + if (cost > 0) + ret *= cost * 0.5; + } + } return ret; } diff --git a/src/main/java/tconstruct/blocks/logic/CastingTableLogic.java b/src/main/java/tconstruct/blocks/logic/CastingTableLogic.java index 7ffa5fc8..ab8cf13d 100644 --- a/src/main/java/tconstruct/blocks/logic/CastingTableLogic.java +++ b/src/main/java/tconstruct/blocks/logic/CastingTableLogic.java @@ -70,22 +70,19 @@ public class CastingTableLogic extends InventoryLogic implements IFluidTank, IFl public int updateCapacity () // Only used to initialize { - int ret = TConstruct.ingotLiquidValue; - ItemStack inv = inventory[0]; + int ret = TConstruct.ingotLiquidValue; + int rec = TConstruct.tableCasting.getCastingAmount(this.liquid, inv); - if (inv != null && inv.getItem() instanceof IPattern) - { - int cost = ((IPattern) inv.getItem()).getPatternCost(inv); - if (cost > 0) - ret *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5; - else - ret = TConstruct.tableCasting.getCastingAmount(this.liquid, inv); - } - - else - { - ret = TConstruct.tableCasting.getCastingAmount(this.liquid, inv); + if (rec > 0) + ret = rec; + else { + if (inv != null && inv.getItem() instanceof IPattern) + { + int cost = ((IPattern) inv.getItem()).getPatternCost(inv); + if (cost > 0) + ret *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5; + } } TConstruct.logger.info("Ret: " + ret); @@ -96,19 +93,18 @@ public class CastingTableLogic extends InventoryLogic implements IFluidTank, IFl { int ret = TConstruct.ingotLiquidValue; - ItemStack inv = inventory[0]; - - if (inv != null && inv.getItem() instanceof IPattern) - { - int cost = ((IPattern) inv.getItem()).getPatternCost(inv); - if (cost > 0) - ret *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5; - else - ret = capacity; - } - - else + if (capacity > 0) ret = capacity; + else { + ItemStack inv = inventory[0]; + + if (inv != null && inv.getItem() instanceof IPattern) + { + int cost = ((IPattern) inv.getItem()).getPatternCost(inv); + if (cost > 0) + ret *= cost * 0.5; + } + } return ret; }