Skip to content

Commit

Permalink
Reduce updates on Casting Channels, Smeltery should interact better w…
Browse files Browse the repository at this point in the history
…ith dumb pipes
  • Loading branch information
mDiyo committed Sep 19, 2013
1 parent 89c0f2e commit cb84235
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/tconstruct/blocks/CastingChannelBlock.java
Expand Up @@ -40,10 +40,10 @@ public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer
}
else
{
int amount = 0;
if (tile.getFluid() != null)
amount = tile.getLiquidAmount();
player.addChatMessage("LiquidAmount: " + amount);
//int amount = 0;
//if (tile.getFluid() != null)
//amount = tile.getLiquidAmount();
//player.addChatMessage("LiquidAmount: " + amount);
tile.setActive(true);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/tconstruct/blocks/LavaTankBlock.java
Expand Up @@ -248,6 +248,7 @@ public void onNeighborBlockChange (World world, int x, int y, int z, int nBlockI
}
}

@Override
public boolean removeBlockByPlayer (World world, EntityPlayer player, int x, int y, int z)
{
player.addExhaustion(0.025F);
Expand Down
12 changes: 7 additions & 5 deletions src/tconstruct/blocks/logic/CastingChannelLogic.java
Expand Up @@ -51,7 +51,7 @@ public void updateEntity ()
if (this.pullingLiquids)
pullLiquids();
}
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
//this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
if (ticks == 20)
{
if (recentlyFilledDelay != 0)
Expand Down Expand Up @@ -419,7 +419,7 @@ public int fill (FluidStack stack, boolean doFill)

if (doFill)
{
this.worldObj.markBlockForRenderUpdate(this.xCoord, this.yCoord, this.zCoord);
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
this.liquid = transfered;
}
recentlyFilledDelay = 2;
Expand All @@ -436,15 +436,15 @@ public int fill (FluidStack stack, boolean doFill)
if ((doFill) && (spaceInTank > 0))
{
this.liquid.amount = this.fillMax;
this.worldObj.markBlockForRenderUpdate(this.xCoord, this.yCoord, this.zCoord);
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
return spaceInTank;
}

if (doFill)
{
this.liquid.amount += stack.amount;
this.worldObj.markBlockForRenderUpdate(this.xCoord, this.yCoord, this.zCoord);
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
return stack.amount;
}
Expand Down Expand Up @@ -491,6 +491,7 @@ public FluidStack drain (int maxDrain, boolean doDrain)
}
if (doDrain)
{
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(drained, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this));
}
return drained;
Expand Down Expand Up @@ -626,7 +627,8 @@ public boolean getActive ()
@Override
public void setActive (boolean flag)
{
pullingLiquids = flag;
//pullingLiquids = flag;
pullingLiquids = !pullingLiquids;
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/tconstruct/blocks/logic/SmelteryDrainLogic.java
Expand Up @@ -68,7 +68,8 @@ public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDra
@Override
public boolean canFill (ForgeDirection from, Fluid fluid)
{
return from == getForgeDirection().getOpposite();
//return true;
return from == getForgeDirection();//.getOpposite();
}

@Override
Expand All @@ -89,7 +90,7 @@ public boolean canDrain (ForgeDirection from, Fluid fluid)
}
}
}
return from == getForgeDirection() && containsFluid;
return from == getForgeDirection().getOpposite() && containsFluid;
}

@Override
Expand Down
5 changes: 4 additions & 1 deletion src/tconstruct/blocks/logic/SmelteryLogic.java
Expand Up @@ -957,9 +957,12 @@ public FluidStack drain (int maxDrain, boolean doDrain)
@Override
public int fill (FluidStack resource, boolean doFill)
{
if (resource != null && resource.amount + currentLiquid < maxLiquid)
if (resource != null && currentLiquid < maxLiquid)//resource.amount + currentLiquid < maxLiquid)
{
if (resource.amount + currentLiquid > maxLiquid)
resource.amount = maxLiquid - currentLiquid;
int amount = resource.amount;

if (doFill)
{
if (addMoltenMetal(resource, false))
Expand Down

0 comments on commit cb84235

Please sign in to comment.