Class FluidProperties

java.lang.Object
com.stereowalker.unionlib.world.level.material.FluidProperties

public abstract class FluidProperties extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Map<net.minecraft.world.level.material.Fluid, FluidProperties>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canDrownIn(net.minecraft.world.entity.LivingEntity entity)
    Returns whether the entity can drown in the fluid.
    boolean
    canExtinguish(net.minecraft.world.entity.Entity entity)
    Returns whether the entity can be extinguished by this fluid.
    boolean
    canPushEntity(net.minecraft.world.entity.Entity entity)
    Returns whether the fluid can push an entity.
    boolean
    canSwim(net.minecraft.world.entity.Entity entity)
    Returns whether the entity can swim in the fluid.
    create(net.minecraft.resources.Identifier name)
     
    float
    fallDistanceModifier(net.minecraft.world.entity.Entity entity)
    Returns how much the fluid should scale the damage done to a falling entity when hitting the ground per tick.
    net.minecraft.resources.Identifier
     
    fromFluid(net.minecraft.world.level.material.Fluid fluid)
     
    void
    itemMovement(net.minecraft.world.entity.item.ItemEntity entity)
    Performs what to do when an item is in a fluid.
    double
    motionScale(net.minecraft.world.entity.Entity entity)
    Returns how much the velocity of the fluid should be scaled by when applied to an entity.
    boolean
    move(net.minecraft.world.level.material.FluidState state, net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.phys.Vec3 movementVector, double gravity)
    Performs how an entity moves when within the fluid.
    abstract net.minecraft.resources.Identifier
     
    static <T> T
    or(net.minecraft.world.level.material.Fluid fluid, Function<FluidProperties, T> func, T or)
     
    net.minecraft.resources.Identifier
     
    net.minecraft.resources.Identifier
     
    boolean
    supportsBoats(net.minecraft.world.entity.vehicle.boat.AbstractBoat boat)
    Returns whether the boat can be used on the fluid.
    boolean
    supportsBoats(net.minecraft.world.level.material.FluidState state, net.minecraft.world.entity.vehicle.boat.AbstractBoat boat)
    Returns whether the boat can be used on the fluid.
    int
     
    int
    tintColor(net.minecraft.world.level.material.FluidState state, net.minecraft.client.renderer.block.BlockAndTintGetter getter, net.minecraft.core.BlockPos pos)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • fluidProps

      public static final Map<net.minecraft.world.level.material.Fluid, FluidProperties> fluidProps
  • Constructor Details

    • FluidProperties

      public FluidProperties()
  • Method Details

    • fromFluid

      public static FluidProperties fromFluid(net.minecraft.world.level.material.Fluid fluid)
    • or

      public static <T> T or(net.minecraft.world.level.material.Fluid fluid, Function<FluidProperties, T> func, T or)
    • create

      public static FluidProperties.Builder create(net.minecraft.resources.Identifier name)
    • name

      public abstract net.minecraft.resources.Identifier name()
    • stillTexture

      public net.minecraft.resources.Identifier stillTexture()
    • flowingTexture

      public net.minecraft.resources.Identifier flowingTexture()
    • overlayTexture

      public net.minecraft.resources.Identifier overlayTexture()
    • tintColor

      public int tintColor()
    • tintColor

      public int tintColor(net.minecraft.world.level.material.FluidState state, net.minecraft.client.renderer.block.BlockAndTintGetter getter, net.minecraft.core.BlockPos pos)
    • motionScale

      public double motionScale(net.minecraft.world.entity.Entity entity)
      Returns how much the velocity of the fluid should be scaled by when applied to an entity.
      Parameters:
      entity - the entity in the fluid
      Returns:
      a scalar to multiply to the fluid velocity
    • canPushEntity

      public boolean canPushEntity(net.minecraft.world.entity.Entity entity)
      Returns whether the fluid can push an entity.
      Parameters:
      entity - the entity in the fluid
      Returns:
      true if the entity can be pushed by the fluid, false otherwise
    • canSwim

      public boolean canSwim(net.minecraft.world.entity.Entity entity)
      Returns whether the entity can swim in the fluid.
      Parameters:
      entity - the entity in the fluid
      Returns:
      true if the entity can swim in the fluid, false otherwise
    • fallDistanceModifier

      public float fallDistanceModifier(net.minecraft.world.entity.Entity entity)
      Returns how much the fluid should scale the damage done to a falling entity when hitting the ground per tick.

      Implementation: If the entity is in many fluids, the smallest modifier is applied.

      Parameters:
      entity - the entity in the fluid
      Returns:
      a scalar to multiply to the fall damage
    • canExtinguish

      public boolean canExtinguish(net.minecraft.world.entity.Entity entity)
      Returns whether the entity can be extinguished by this fluid.
      Parameters:
      entity - the entity in the fluid
      Returns:
      true if the entity can be extinguished, false otherwise
    • move

      public boolean move(net.minecraft.world.level.material.FluidState state, net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.phys.Vec3 movementVector, double gravity)
      Performs how an entity moves when within the fluid. If using custom movement logic, the method should return true. Otherwise, the movement logic will default to water.
      Parameters:
      state - the state of the fluid
      entity - the entity moving within the fluid
      movementVector - the velocity of how the entity wants to move
      gravity - the gravity to apply to the entity
      Returns:
      true if custom movement logic is performed, false otherwise
    • canDrownIn

      public boolean canDrownIn(net.minecraft.world.entity.LivingEntity entity)
      Returns whether the entity can drown in the fluid.
      Parameters:
      entity - the entity in the fluid
      Returns:
      true if the entity can drown in the fluid, false otherwise
    • itemMovement

      public void itemMovement(net.minecraft.world.entity.item.ItemEntity entity)
      Performs what to do when an item is in a fluid.
      Parameters:
      entity - the item in the fluid
    • supportsBoats

      public boolean supportsBoats(net.minecraft.world.entity.vehicle.boat.AbstractBoat boat)
      Returns whether the boat can be used on the fluid.
      Parameters:
      boat - the boat trying to be used on the fluid
      Returns:
      true if the boat can be used, false otherwise
    • supportsBoats

      public boolean supportsBoats(net.minecraft.world.level.material.FluidState state, net.minecraft.world.entity.vehicle.boat.AbstractBoat boat)
      Returns whether the boat can be used on the fluid.
      Parameters:
      state - the state of the fluid
      boat - the boat trying to be used on the fluid
      Returns:
      true if the boat can be used, false otherwise