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 float quantaPerBlockFloat = 8F;
|
||||||
protected int density = 1;
|
protected int density = 1;
|
||||||
protected int densityDir = -1;
|
protected int densityDir = -1;
|
||||||
|
protected int temperature = 295;
|
||||||
|
|
||||||
protected int tickRate = 20;
|
protected int tickRate = 20;
|
||||||
protected int renderPass = 1;
|
protected int renderPass = 1;
|
||||||
|
@ -55,6 +56,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
|
||||||
|
|
||||||
this.fluidName = fluid.getName();
|
this.fluidName = fluid.getName();
|
||||||
this.density = fluid.density;
|
this.density = fluid.density;
|
||||||
|
this.temperature = fluid.temperature;
|
||||||
this.maxScaledLight = fluid.luminosity;
|
this.maxScaledLight = fluid.luminosity;
|
||||||
this.tickRate = fluid.viscosity / 200;
|
this.tickRate = fluid.viscosity / 200;
|
||||||
fluid.setBlockID(id);
|
fluid.setBlockID(id);
|
||||||
|
@ -78,6 +80,12 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockFluidBase setTemperature(int temperature)
|
||||||
|
{
|
||||||
|
this.temperature = temperature;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public BlockFluidBase setTickRate(int tickRate)
|
public BlockFluidBase setTickRate(int tickRate)
|
||||||
{
|
{
|
||||||
if (tickRate <= 0) tickRate = 20;
|
if (tickRate <= 0) tickRate = 20;
|
||||||
|
@ -303,6 +311,16 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
|
||||||
}
|
}
|
||||||
return ((BlockFluidBase)block).density;
|
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)
|
public static double getFlowDirection(IBlockAccess world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,14 @@ public class Fluid
|
||||||
*/
|
*/
|
||||||
protected int density = 1000;
|
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
|
* Viscosity ("thickness") of the fluid - completely arbitrary; negative values are not
|
||||||
* permissible.
|
* permissible.
|
||||||
|
@ -132,6 +140,12 @@ public class Fluid
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Fluid setTemperature(int temperature)
|
||||||
|
{
|
||||||
|
this.temperature = temperature;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Fluid setViscosity(int viscosity)
|
public Fluid setViscosity(int viscosity)
|
||||||
{
|
{
|
||||||
this.viscosity = viscosity;
|
this.viscosity = viscosity;
|
||||||
|
@ -200,6 +214,11 @@ public class Fluid
|
||||||
return this.density;
|
return this.density;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final int getTemperature()
|
||||||
|
{
|
||||||
|
return this.temperature;
|
||||||
|
}
|
||||||
|
|
||||||
public final int getViscosity()
|
public final int getViscosity()
|
||||||
{
|
{
|
||||||
return this.viscosity;
|
return this.viscosity;
|
||||||
|
@ -252,6 +271,7 @@ public class Fluid
|
||||||
/* Stack-based Accessors */
|
/* Stack-based Accessors */
|
||||||
public int getLuminosity(FluidStack stack){ return getLuminosity(); }
|
public int getLuminosity(FluidStack stack){ return getLuminosity(); }
|
||||||
public int getDensity(FluidStack stack){ return getDensity(); }
|
public int getDensity(FluidStack stack){ return getDensity(); }
|
||||||
|
public int getTemperature(FluidStack stack){ return getTemperature(); }
|
||||||
public int getViscosity(FluidStack stack){ return getViscosity(); }
|
public int getViscosity(FluidStack stack){ return getViscosity(); }
|
||||||
public boolean isGaseous(FluidStack stack){ return isGaseous(); }
|
public boolean isGaseous(FluidStack stack){ return isGaseous(); }
|
||||||
public int getColor(FluidStack stack){ return getColor(); }
|
public int getColor(FluidStack stack){ return getColor(); }
|
||||||
|
@ -259,6 +279,7 @@ public class Fluid
|
||||||
/* World-based Accessors */
|
/* World-based Accessors */
|
||||||
public int getLuminosity(World world, int x, int y, int z){ return getLuminosity(); }
|
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 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 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 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(); }
|
public int getColor(World world, int x, int y, int z){ return getColor(); }
|
||||||
|
|
Loading…
Reference in a new issue