Package net.minecraftforge.fluids
Class FluidAttributes
java.lang.Object
net.minecraftforge.fluids.FluidAttributes
- Direct Known Subclasses:
 FluidAttributes.Water
Minecraft Forge Fluid Implementation
 This class is a fluid (liquid or gas) equivalent to "Item." It describes the nature of a fluid
 and contains its general properties.
 These properties do not have inherent gameplay mechanics - they are provided so that mods may
 choose to take advantage of them.
 Fluid implementations are not required to actively use these properties, nor are objects
 interfacing with fluids required to make use of them, but it is encouraged.
 The default values can be used as a reference point for mods adding fluids such as oil or heavy
 water.
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class - 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprivate final intColor used by universal bucket and the ModelFluid baked model.private final intDensity of the fluid - completely arbitrary; negative density indicates that the fluid is lighter than air.private final SoundEventprivate final SoundEventprivate final ResourceLocationprivate final booleanThis indicates if the fluid is gaseous.private final intThe light level emitted by this fluid.private final ResourceLocationprivate final RarityThe rarity of the fluid.private final ResourceLocationprivate final intTemperature of the fluid - completely arbitrary; higher temperature indicates that the fluid is hotter than air.private Stringprivate final intViscosity ("thickness") of the fluid - completely arbitrary; negative values are not permissible. - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFluidAttributes(FluidAttributes.Builder builder, Fluid fluid)  - 
Method Summary
Modifier and TypeMethodDescriptionstatic FluidAttributes.Builderbuilder(ResourceLocation stillTexture, ResourceLocation flowingTexture) final booleancanBePlacedInWorld(IBlockDisplayReader reader, BlockPos pos, FluidState state) final booleancanBePlacedInWorld(IBlockDisplayReader reader, BlockPos pos, FluidStack state) booleandoesVaporize(IBlockDisplayReader reader, BlockPos pos, FluidStack fluidStack) Determines if this fluid should vaporize in dimensions where water vaporizes when placed.getBlock(IBlockDisplayReader reader, BlockPos pos, FluidState state) getBucket(FluidStack stack) intgetColor()intgetColor(IBlockDisplayReader world, BlockPos pos) intgetColor(FluidStack stack) final intintgetDensity(IBlockDisplayReader world, BlockPos pos) intgetDensity(FluidStack stack) getDisplayName(FluidStack stack) Returns the localized name of this fluid.getEmptySound(IBlockDisplayReader world, BlockPos pos) getEmptySound(FluidStack stack) getFillSound(IBlockDisplayReader world, BlockPos pos) getFillSound(FluidStack stack) getFlowingTexture(IBlockDisplayReader world, BlockPos pos) getFlowingTexture(FluidStack stack) final intintgetLuminosity(IBlockDisplayReader world, BlockPos pos) intgetLuminosity(FluidStack stack) getRarity(IBlockDisplayReader world, BlockPos pos) getRarity(FluidStack stack) getStateForPlacement(IBlockDisplayReader reader, BlockPos pos, FluidStack state) getStillTexture(IBlockDisplayReader world, BlockPos pos) getStillTexture(FluidStack stack) final intintgetTemperature(IBlockDisplayReader world, BlockPos pos) intgetTemperature(FluidStack stack) Returns the translation key of this fluid.getTranslationKey(FluidStack stack) A FluidStack sensitive version of getTranslationKeyfinal intintgetViscosity(IBlockDisplayReader world, BlockPos pos) intgetViscosity(FluidStack stack) final booleanbooleanisGaseous(IBlockDisplayReader world, BlockPos pos) booleanisGaseous(FluidStack stack) final booleanvoidvaporize(PlayerEntity player, World worldIn, BlockPos pos, FluidStack fluidStack) Called instead of placing the fluid block ifnet.minecraft.world.dimension.Dimension#doesWaterVaporize()and#doesVaporize(FluidStack)are true. 
- 
Field Details
- 
BUCKET_VOLUME
public static final int BUCKET_VOLUME- See Also:
 
 - 
translationKey
 - 
stillTexture
 - 
flowingTexture
 - 
overlayTexture
 - 
fillSound
 - 
emptySound
 - 
luminosity
private final int luminosityThe light level emitted by this fluid. Default value is 0, as most fluids do not actively emit light. - 
density
private final int densityDensity of the fluid - completely arbitrary; negative density indicates that the fluid is lighter than air. Default value is approximately the real-life density of water in kg/m^3. - 
temperature
private final int temperatureTemperature 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. - 
viscosity
private final int viscosityViscosity ("thickness") of the fluid - completely arbitrary; negative values are not permissible. Default value is approximately the real-life density of water in m/s^2 (x10^-3). Higher viscosity means that a fluid flows more slowly, like molasses. Lower viscosity means that a fluid flows more quickly, like helium. - 
isGaseous
private final boolean isGaseousThis indicates if the fluid is gaseous. Generally this is associated with negative density fluids. - 
rarity
The rarity of the fluid. Used primarily in tool tips. - 
color
private final int colorColor used by universal bucket and the ModelFluid baked model. Note that this int includes the alpha so converting this to RGB with alpha would be float r = ((color >> 16) & 0xFF) / 255f; // red float g = ((color >> 8) & 0xFF) / 255f; // green float b = ((color >> 0) & 0xFF) / 255f; // blue float a = ((color >> 24) & 0xFF) / 255f; // alpha 
 - 
 - 
Constructor Details
- 
FluidAttributes
 
 - 
 - 
Method Details
- 
getBucket
 - 
getBlock
 - 
getStateForPlacement
 - 
canBePlacedInWorld
 - 
canBePlacedInWorld
 - 
isLighterThanAir
public final boolean isLighterThanAir() - 
doesVaporize
Determines if this fluid should vaporize in dimensions where water vaporizes when placed. To preserve the intentions of vanilla, fluids that can turn lava into obsidian should vaporize. This prevents players from making the nether safe with a single bucket. Based onnet.minecraft.item.BucketItem#tryPlaceContainedLiquid(PlayerEntity, World, BlockPos)- Parameters:
 fluidStack- The fluidStack is trying to be placed.- Returns:
 - true if this fluid should vaporize in dimensions where water vaporizes when placed.
 
 - 
vaporize
public void vaporize(@Nullable PlayerEntity player, World worldIn, BlockPos pos, FluidStack fluidStack) Called instead of placing the fluid block ifnet.minecraft.world.dimension.Dimension#doesWaterVaporize()and#doesVaporize(FluidStack)are true. Override this to make your explosive liquid blow up instead of the default smoke, etc. Based onnet.minecraft.item.BucketItem#tryPlaceContainedLiquid(PlayerEntity, World, BlockPos)- Parameters:
 player- Player who tried to place the fluid. May be null for blocks like dispensers.worldIn- World to vaporize the fluid in.pos- The position in the world the fluid block was going to be placed.fluidStack- The fluidStack that was going to be placed.
 - 
getDisplayName
Returns the localized name of this fluid. - 
getTranslationKey
A FluidStack sensitive version of getTranslationKey - 
getTranslationKey
Returns the translation key of this fluid. - 
getLuminosity
public final int getLuminosity() - 
getDensity
public final int getDensity() - 
getTemperature
public final int getTemperature() - 
getViscosity
public final int getViscosity() - 
isGaseous
public final boolean isGaseous() - 
getRarity
 - 
getColor
public int getColor() - 
getStillTexture
 - 
getFlowingTexture
 - 
getOverlayTexture
 - 
getFillSound
 - 
getEmptySound
 - 
getLuminosity
 - 
getDensity
 - 
getTemperature
 - 
getViscosity
 - 
isGaseous
 - 
getRarity
 - 
getColor
 - 
getStillTexture
 - 
getFlowingTexture
 - 
getFillSound
 - 
getEmptySound
 - 
getLuminosity
 - 
getDensity
 - 
getTemperature
 - 
getViscosity
 - 
isGaseous
 - 
getRarity
 - 
getColor
 - 
getStillTexture
 - 
getFlowingTexture
 - 
getFillSound
 - 
getEmptySound
 - 
builder
public static FluidAttributes.Builder builder(ResourceLocation stillTexture, ResourceLocation flowingTexture)  - 
getTextures
 
 -