Skip to content

Commit

Permalink
Fix the casting glitch
Browse files Browse the repository at this point in the history
  • Loading branch information
blue42u committed Apr 29, 2014
1 parent 330fc16 commit ba4e486
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 50 deletions.
46 changes: 21 additions & 25 deletions src/main/java/tconstruct/blocks/logic/CastingBasinLogic.java
Expand Up @@ -70,22 +70,19 @@ public int getCapacity ()

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);
Expand All @@ -96,20 +93,19 @@ public int updateCapacity (int capacity)
{
int ret = TConstruct.ingotLiquidValue;

ItemStack inv = inventory[0];
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 *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5;
else
ret = capacity;
if (inv != null && inv.getItem() instanceof IPattern)
{
int cost = ((IPattern) inv.getItem()).getPatternCost(inv);
if (cost > 0)
ret *= cost * 0.5;
}
}

else
ret = capacity;

return ret;
}

Expand Down
46 changes: 21 additions & 25 deletions src/main/java/tconstruct/blocks/logic/CastingTableLogic.java
Expand Up @@ -70,22 +70,19 @@ public int getCapacity ()

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);
Expand All @@ -96,20 +93,19 @@ public int updateCapacity (int capacity)
{
int ret = TConstruct.ingotLiquidValue;

ItemStack inv = inventory[0];
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 *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5;
else
ret = capacity;
if (inv != null && inv.getItem() instanceof IPattern)
{
int cost = ((IPattern) inv.getItem()).getPatternCost(inv);
if (cost > 0)
ret *= cost * 0.5;
}
}

else
ret = capacity;

return ret;
}

Expand Down

0 comments on commit ba4e486

Please sign in to comment.