2013-05-23 05:01:19 +00:00
|
|
|
|
|
|
|
package net.minecraftforge.fluids;
|
|
|
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2013-05-23 05:01:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reference Tile Entity implementation of {@link IFluidHandler}. Use/extend this or write your own.
|
|
|
|
*/
|
2013-07-17 04:40:49 +00:00
|
|
|
public class TileFluidHandler extends TileEntity implements IFluidHandler
|
|
|
|
{
|
2013-05-23 05:01:19 +00:00
|
|
|
protected FluidTank tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
|
|
|
|
|
|
|
|
@Override
|
2014-02-05 08:05:37 +00:00
|
|
|
public void readFromNBT(NBTTagCompound tag)
|
2013-07-17 04:40:49 +00:00
|
|
|
{
|
2014-02-05 08:05:37 +00:00
|
|
|
super.readFromNBT(tag);
|
2014-01-30 02:34:23 +00:00
|
|
|
tank.readFromNBT(tag);
|
2013-05-23 05:01:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-05-18 12:11:56 +00:00
|
|
|
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
2013-07-17 04:40:49 +00:00
|
|
|
{
|
2016-05-18 12:11:56 +00:00
|
|
|
tag = super.writeToNBT(tag);
|
2014-01-30 02:34:23 +00:00
|
|
|
tank.writeToNBT(tag);
|
2016-05-18 10:29:10 +00:00
|
|
|
return tag;
|
2013-05-23 05:01:19 +00:00
|
|
|
}
|
|
|
|
|
2014-01-30 02:34:23 +00:00
|
|
|
/* IFluidHandler */
|
2013-05-23 05:01:19 +00:00
|
|
|
@Override
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
2013-07-17 04:40:49 +00:00
|
|
|
{
|
2013-05-23 05:01:19 +00:00
|
|
|
return tank.fill(resource, doFill);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
2013-07-17 04:40:49 +00:00
|
|
|
{
|
|
|
|
if (resource == null || !resource.isFluidEqual(tank.getFluid()))
|
|
|
|
{
|
2013-05-23 05:01:19 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return tank.drain(resource.amount, doDrain);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
2013-07-17 04:40:49 +00:00
|
|
|
{
|
2013-05-23 05:01:19 +00:00
|
|
|
return tank.drain(maxDrain, doDrain);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public boolean canFill(EnumFacing from, Fluid fluid)
|
2013-07-17 04:40:49 +00:00
|
|
|
{
|
2013-05-23 05:01:19 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public boolean canDrain(EnumFacing from, Fluid fluid)
|
2013-07-17 04:40:49 +00:00
|
|
|
{
|
2013-05-23 05:01:19 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
2013-07-17 04:40:49 +00:00
|
|
|
{
|
2013-05-23 05:01:19 +00:00
|
|
|
return new FluidTankInfo[] { tank.getInfo() };
|
|
|
|
}
|
|
|
|
}
|