Class ImplicitFluidConverter

java.lang.Object
org.cyclops.evilcraft.core.fluid.ImplicitFluidConverter
Direct Known Subclasses:
BloodFluidConverter

public class ImplicitFluidConverter extends Object
An implicit converter for changing fluid types with a conversion rate.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ImplicitFluidConverter(net.minecraft.world.level.material.Fluid target)
    Make a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addConverter(net.minecraft.world.level.material.Fluid fluid, double rate)
    Add a fluid converter.
    boolean
    canConvert(net.minecraft.world.level.material.Fluid fluid)
    If the given fluid can be converter.
    net.minecraftforge.fluids.FluidStack
    convert(net.minecraftforge.fluids.FluidStack fluid)
    Convert the given fluid to the target fluid.
    net.minecraftforge.fluids.FluidStack
    convertReverse(net.minecraft.world.level.material.Fluid target, net.minecraftforge.fluids.FluidStack fluid)
    Convert the given fluid from target fluid to the given fluid.
    double
    getRatio(net.minecraft.world.level.material.Fluid target)
    The conversion ratio to the given target fluid.
    net.minecraft.world.level.material.Fluid
     
    void
    Register the converters config from the given string array.
    void
    setTarget(net.minecraft.world.level.material.Fluid target)
    Set a new target, this will not remove the old target from the possible converters.

    Methods inherited from class java.lang.Object

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

    • ImplicitFluidConverter

      public ImplicitFluidConverter(net.minecraft.world.level.material.Fluid target)
      Make a new instance.
      Parameters:
      target - The fluid to convert to.
  • Method Details

    • setTarget

      public void setTarget(net.minecraft.world.level.material.Fluid target)
      Set a new target, this will not remove the old target from the possible converters.
      Parameters:
      target - The target fluid.
    • getTarget

      public net.minecraft.world.level.material.Fluid getTarget()
      Returns:
      The target fluid.
    • addConverter

      public void addConverter(net.minecraft.world.level.material.Fluid fluid, double rate)
      Add a fluid converter.
      Parameters:
      fluid - The fluid to convert to.
      rate - The rate of conversion that will be multiplied with every conversion.
    • canConvert

      public boolean canConvert(net.minecraft.world.level.material.Fluid fluid)
      If the given fluid can be converter.
      Parameters:
      fluid - The fluid to convert.
      Returns:
      If it can be converted.
    • convert

      public net.minecraftforge.fluids.FluidStack convert(net.minecraftforge.fluids.FluidStack fluid)
      Convert the given fluid to the target fluid.
      Parameters:
      fluid - The fluid stack to convert from.
      Returns:
      The converted fluid stack.
    • convertReverse

      public net.minecraftforge.fluids.FluidStack convertReverse(net.minecraft.world.level.material.Fluid target, net.minecraftforge.fluids.FluidStack fluid)
      Convert the given fluid from target fluid to the given fluid.
      Parameters:
      target - The fluid to convert to.
      fluid - The fluid stack to convert, it must be of the same fluid type of the main target of this converter instance.
      Returns:
      The converted fluid stack.
    • getRatio

      public double getRatio(net.minecraft.world.level.material.Fluid target)
      The conversion ratio to the given target fluid.
      Parameters:
      target - The target fluid.
      Returns:
      The conversion ratio.
    • registerFromConfig

      public void registerFromConfig(String[] config)
      Register the converters config from the given string array.
      Parameters:
      config - The config where each element is in the form 'fluidname:ratio'.