Merge branch 'master' of github.com:EnderShadow/MinecraftForge into miscchanges

This commit is contained in:
Christian 2013-08-01 07:20:30 -04:00
commit cf4f1377d4
2 changed files with 39 additions and 0 deletions

View file

@ -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;
@ -319,6 +327,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)
{

View file

@ -61,6 +61,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.
@ -135,6 +143,12 @@ public class Fluid
return this;
}
public Fluid setTemperature(int temperature)
{
this.temperature = temperature;
return this;
}
public Fluid setViscosity(int viscosity)
{
this.viscosity = viscosity;
@ -203,6 +217,11 @@ public class Fluid
return this.density;
}
public final int getTemperature()
{
return this.temperature;
}
public final int getViscosity()
{
return this.viscosity;
@ -255,6 +274,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(); }
@ -262,6 +282,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(); }