Forgified Fabric API

Forgified Fabric API

13M Downloads

Crash with Vampirism - FluidHandling - Still Fluid

maxanier opened this issue ยท 2 comments

commented

Describe the bug

The game crashes trying to fill a glass bottle with Vampirism's blood fluid
TeamLapen/Vampirism#1271

Steps to reproduce

  1. Install Vampirism https://www.curseforge.com/minecraft/mc-mods/vampirism-become-a-vampire https://github.com/TeamLapen/Vampirism
  2. Become a vampire (/vampirism level vampirism:vampire 1)
  3. Put a glass bottle on your hotbar
  4. Look at a cow or villager and hold down V to feed
  5. Game will crash shortly after
    ...

Logs

https://mclo.gs/9CSMjIt

Additional context

Crucial part is

java.lang.IllegalArgumentException: Cannot convert flowing fluid vampirism:blood (de.teamlapen.vampirism.fluids.BloodFluid@1b9c716f) into a still fluid.
	at TRANSFORMER/[email protected]+6d3178f577/net.fabricmc.fabric.impl.transfer.fluid.FluidVariantImpl.of(FluidVariantImpl.java:48)
	at TRANSFORMER/[email protected]+6d3178f577/net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant.of(FluidVariant.java:72)
	at TRANSFORMER/[email protected]+6d3178f577/net.fabricmc.fabric.impl.transfer.compat.ForgeCompatUtil.toFluidStorageView(ForgeCompatUtil.java:49)
	at TRANSFORMER/[email protected]+6d3178f577/net.fabricmc.fabric.impl.transfer.compat.FluidStorageFluidHandler.fill(FluidStorageFluidHandler.java:67)
	at TRANSFORMER/[email protected]/de.teamlapen.vampirism.fluids.BloodHelper.lambda$fill$2(BloodHelper.java:90)
	at TRANSFORMER/[email protected]/net.minecraftforge.common.util.LazyOptional.map(LazyOptional.java:195)
	at TRANSFORMER/[email protected]/de.teamlapen.vampirism.fluids.BloodHelper.fill(BloodHelper.java:90)

Vampirism calls IFluigHandler#fill with its BloodFluid

ForgifiedFabric somehow decides that Vampirism's blood is not still and crashes

if (!fluid.isStill(fluid.getDefaultState()) && fluid != Fluids.EMPTY) {

I was unable to find where Fluid#isStill is defined.

commented

Fluid#isStill translates to Fluid#isSource on mojmap, which returns false in BloodFluid, making the fluid always appear flowing even when it's in a still state. Is there any specific reason for this?

commented

Ah, I see. Thank you.
Not sure why we return false. Maybe the old method title was misleading.

Anyways, I changed it to true, and everything seems to work fine now.