Package org.cyclops.evilcraft.core.fluid
Class ImplicitFluidConverter
java.lang.Object
org.cyclops.evilcraft.core.fluid.ImplicitFluidConverter
- Direct Known Subclasses:
BloodFluidConverter
An implicit converter for changing fluid types with a conversion rate.
-
Constructor Summary
ConstructorsConstructorDescriptionImplicitFluidConverter(net.minecraft.world.level.material.Fluid target) Make a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConverter(net.minecraft.world.level.material.Fluid fluid, double rate) Add a fluid converter.booleancanConvert(net.minecraft.world.level.material.Fluid fluid) If the given fluid can be converter.net.minecraftforge.fluids.FluidStackconvert(net.minecraftforge.fluids.FluidStack fluid) Convert the given fluid to the target fluid.net.minecraftforge.fluids.FluidStackconvertReverse(net.minecraft.world.level.material.Fluid target, net.minecraftforge.fluids.FluidStack fluid) Convert the given fluid from target fluid to the given fluid.doublegetRatio(net.minecraft.world.level.material.Fluid target) The conversion ratio to the given target fluid.net.minecraft.world.level.material.FluidvoidregisterFromConfig(String[] config) Register the converters config from the given string array.voidsetTarget(net.minecraft.world.level.material.Fluid target) Set a new target, this will not remove the old target from the possible converters.
-
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
Register the converters config from the given string array.- Parameters:
config- The config where each element is in the form 'fluidname:ratio'.
-