Only update intake tile on server side, should fix #296
parent
22971108b0
commit
2e8cc6a714
|
@ -48,33 +48,40 @@ public class TileIntake extends TileEntity implements IFluidHandler
|
|||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if((this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == Blocks.water)
|
||||
&& (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) == 0))
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
this.waterTank.fill(new FluidStack(FluidRegistry.WATER, waterPerTick), true);
|
||||
this.tickSinceLastConsume++;
|
||||
|
||||
if(this.tickSinceLastConsume == 200)
|
||||
if((this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == Blocks.water)
|
||||
&& (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) == 0))
|
||||
{
|
||||
this.tickSinceLastConsume = 0;
|
||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord - 1, this.zCoord);
|
||||
this.waterTank.fill(new FluidStack(FluidRegistry.WATER, waterPerTick), true);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if((this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord) != null)
|
||||
&& (this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord) instanceof IFluidHandler))
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
Random random = this.worldObj.rand;
|
||||
if(this.waterTank.getFluidAmount() > 0)
|
||||
Random random = this.worldObj.rand;
|
||||
|
||||
this.worldObj.spawnParticle("dripWater", this.xCoord + random.nextDouble(), this.yCoord + 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
|
||||
|
|
Loading…
Reference in New Issue