Lib Block Attributes

Lib Block Attributes

853k Downloads

No way to get an actual Fluid from a FluidVolume

LemmaEOF opened this issue ยท 4 comments

commented

I'm trying to get a Fluid from an abstract FluidVolume, but it doesn't seem to be possible at all. You can only get the FluidKey, and I can't find any way to convert from an abstract FluidKey to a Fluid. I think having an abstract FluidVolume in the first place is inherently counterproductive; it makes interaction between even vanilla and modded nearly unintelligible, since you don't know what type of FluidVolume you're dealing with, which is a massive roadblock to doing anything else. I honestly think it'd be an infinitely better experience to add the merge/split code into the Silk FluidInstance and use those instead.

commented
FluidVolume volume = ...
if (volume instanceof NormalFluidVolume) {
    Fluid minecraftFluid = ((NormalFluidVolume) volume).getRawFluid();
} else if (volume instanceof PotionFluidVolume) {
    Potion minecraftPotion = ((PotionFluidVolume) volume).getPotion();
} else {
    // We don't know
}
commented

Although I can add a getRawFluid() method to FluidVolume and FluidKey and just let them return null for things based on stuff other than fluids?

commented

Ok I've added some utility/helper methods in 0.3.4 and I've updated the fluids and fluid inventory wiki pages a bit.

commented

I'm satisfied with how it's set up.