added temperature to fluids
it could be useful for blocks that are affected by temperature
This commit is contained in:
parent
6397939c9e
commit
bf8f5aa306
2 changed files with 39 additions and 0 deletions
|
@ -39,6 +39,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
|
|||
protected float quantaPerBlockFloat = 8F;
|
||||
protected int density = 1;
|
||||
protected int densityDir = -1;
|
||||
protected int temperature = 295;
|
||||
|
||||
protected int tickRate = 20;
|
||||
protected int renderPass = 1;
|
||||
|
@ -55,6 +56,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
|
|||
|
||||
this.fluidName = fluid.getName();
|
||||
this.density = fluid.density;
|
||||
this.temperature = fluid.temperature;
|
||||
this.maxScaledLight = fluid.luminosity;
|
||||
this.tickRate = fluid.viscosity / 200;
|
||||
fluid.setBlockID(id);
|
||||
|
@ -78,6 +80,12 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
|
|||
return this;
|
||||
}
|
||||
|
||||
public BlockFluidBase setTemperature(int temperature)
|
||||
{
|
||||
this.temperature = temperature;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BlockFluidBase setTickRate(int tickRate)
|
||||
{
|
||||
if (tickRate <= 0) tickRate = 20;
|
||||
|
@ -304,6 +312,16 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
|
|||
return ((BlockFluidBase)block).density;
|
||||
}
|
||||
|
||||
public static final int getTemperature(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
if (!(block instanceof BlockFluidBase))
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return ((BlockFluidBase)block).temperature;
|
||||
}
|
||||
|
||||
public static double getFlowDirection(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
|
|
|
@ -58,6 +58,14 @@ public class Fluid
|
|||
*/
|
||||
protected int density = 1000;
|
||||
|
||||
/**
|
||||
* Temperature of the fluid - completely arbitrary; higher temperature indicates that the fluid is
|
||||
* hotter than air.
|
||||
*
|
||||
* Default value is approximately the real-life room temperature of water in degrees Kelvin.
|
||||
*/
|
||||
protected int temperature = 295;
|
||||
|
||||
/**
|
||||
* Viscosity ("thickness") of the fluid - completely arbitrary; negative values are not
|
||||
* permissible.
|
||||
|
@ -132,6 +140,12 @@ public class Fluid
|
|||
return this;
|
||||
}
|
||||
|
||||
public Fluid setTemperature(int temperature)
|
||||
{
|
||||
this.temperature = temperature;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Fluid setViscosity(int viscosity)
|
||||
{
|
||||
this.viscosity = viscosity;
|
||||
|
@ -200,6 +214,11 @@ public class Fluid
|
|||
return this.density;
|
||||
}
|
||||
|
||||
public final int getTemperature()
|
||||
{
|
||||
return this.temperature;
|
||||
}
|
||||
|
||||
public final int getViscosity()
|
||||
{
|
||||
return this.viscosity;
|
||||
|
@ -252,6 +271,7 @@ public class Fluid
|
|||
/* Stack-based Accessors */
|
||||
public int getLuminosity(FluidStack stack){ return getLuminosity(); }
|
||||
public int getDensity(FluidStack stack){ return getDensity(); }
|
||||
public int getTemperature(FluidStack stack){ return getTemperature(); }
|
||||
public int getViscosity(FluidStack stack){ return getViscosity(); }
|
||||
public boolean isGaseous(FluidStack stack){ return isGaseous(); }
|
||||
public int getColor(FluidStack stack){ return getColor(); }
|
||||
|
@ -259,6 +279,7 @@ public class Fluid
|
|||
/* World-based Accessors */
|
||||
public int getLuminosity(World world, int x, int y, int z){ return getLuminosity(); }
|
||||
public int getDensity(World world, int x, int y, int z){ return getDensity(); }
|
||||
public int getTemperature(World world, int x, int y, int z){ return getTemperature(); }
|
||||
public int getViscosity(World world, int x, int y, int z){ return getViscosity(); }
|
||||
public boolean isGaseous(World world, int x, int y, int z){ return isGaseous(); }
|
||||
public int getColor(World world, int x, int y, int z){ return getColor(); }
|
||||
|
|
Loading…
Reference in a new issue