Only update intake tile on server side, should fix #296
This commit is contained in:
parent
22971108b0
commit
2e8cc6a714
@ -48,33 +48,40 @@ public class TileIntake extends TileEntity implements IFluidHandler
|
|||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void updateEntity()
|
||||||
{
|
{
|
||||||
if((this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == Blocks.water)
|
if(!worldObj.isRemote)
|
||||||
&& (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) == 0))
|
|
||||||
{
|
{
|
||||||
this.waterTank.fill(new FluidStack(FluidRegistry.WATER, waterPerTick), true);
|
if((this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == Blocks.water)
|
||||||
this.tickSinceLastConsume++;
|
&& (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) == 0))
|
||||||
|
|
||||||
if(this.tickSinceLastConsume == 200)
|
|
||||||
{
|
{
|
||||||
this.tickSinceLastConsume = 0;
|
this.waterTank.fill(new FluidStack(FluidRegistry.WATER, waterPerTick), true);
|
||||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord - 1, this.zCoord);
|
this.tickSinceLastConsume++;
|
||||||
|
|
||||||
|
if(this.tickSinceLastConsume == 200)
|
||||||
|
{
|
||||||
|
this.tickSinceLastConsume = 0;
|
||||||
|
this.worldObj.setBlockToAir(this.xCoord, this.yCoord - 1, this.zCoord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if((this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord) != null)
|
||||||
|
&& (this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord) instanceof IFluidHandler))
|
||||||
|
{
|
||||||
|
IFluidHandler export = (IFluidHandler) this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
|
||||||
|
this.waterTank.drain(
|
||||||
|
export.fill(ForgeDirection.DOWN,
|
||||||
|
new FluidStack(FluidRegistry.WATER, Math.min(this.waterTank.getFluidAmount(), exportAmountPerTick)), true), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if((this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord) != null)
|
|
||||||
&& (this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord) instanceof IFluidHandler))
|
|
||||||
{
|
{
|
||||||
IFluidHandler export = (IFluidHandler) this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
|
Random random = this.worldObj.rand;
|
||||||
this.waterTank.drain(
|
|
||||||
export.fill(ForgeDirection.DOWN,
|
|
||||||
new FluidStack(FluidRegistry.WATER, Math.min(this.waterTank.getFluidAmount(), exportAmountPerTick)), true), true);
|
|
||||||
}
|
|
||||||
Random random = this.worldObj.rand;
|
|
||||||
if(this.waterTank.getFluidAmount() > 0)
|
|
||||||
this.worldObj.spawnParticle("dripWater", this.xCoord + random.nextDouble(), this.yCoord + random.nextDouble(),
|
this.worldObj.spawnParticle("dripWater", this.xCoord + random.nextDouble(), this.yCoord + random.nextDouble(),
|
||||||
this.zCoord + random.nextDouble(), random.nextDouble(), -0.5D, random.nextDouble());
|
this.zCoord + random.nextDouble(), random.nextDouble(), -0.5D, random.nextDouble());
|
||||||
if(random.nextInt(100) == 0)
|
|
||||||
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, ModInfo.PREFIX + "intake", 1F, 1F, true);
|
if(random.nextInt(100) == 0)
|
||||||
|
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, ModInfo.PREFIX + "intake", 1F, 1F, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user