Sinytra / ForgifiedFabricAPI

Fabric API implemented on top of NeoForge
https://sinytra.org/docs
Apache License 2.0
113 stars 15 forks source link

Crash with Vampirism - FluidHandling - Still Fluid #68

Closed maxanier closed 11 months ago

maxanier commented 11 months ago

Describe the bug

The game crashes trying to fill a glass bottle with Vampirism's blood fluid https://github.com/TeamLapen/Vampirism/issues/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/fabric_transfer_api_v1@3.3.1+6d3178f577/net.fabricmc.fabric.impl.transfer.fluid.FluidVariantImpl.of(FluidVariantImpl.java:48)
    at TRANSFORMER/fabric_transfer_api_v1@3.3.1+6d3178f577/net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant.of(FluidVariant.java:72)
    at TRANSFORMER/fabric_transfer_api_v1@3.3.1+6d3178f577/net.fabricmc.fabric.impl.transfer.compat.ForgeCompatUtil.toFluidStorageView(ForgeCompatUtil.java:49)
    at TRANSFORMER/fabric_transfer_api_v1@3.3.1+6d3178f577/net.fabricmc.fabric.impl.transfer.compat.FluidStorageFluidHandler.fill(FluidStorageFluidHandler.java:67)
    at TRANSFORMER/vampirism@1.9.3/de.teamlapen.vampirism.fluids.BloodHelper.lambda$fill$2(BloodHelper.java:90)
    at TRANSFORMER/forge@47.1.3/net.minecraftforge.common.util.LazyOptional.map(LazyOptional.java:195)
    at TRANSFORMER/vampirism@1.9.3/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 https://github.com/Sinytra/ForgifiedFabricAPI/blob/2272fc7f939db7a7dd6e43ed64dea5d94693ba45/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/impl/transfer/fluid/FluidVariantImpl.java#L39

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

Su5eD commented 11 months ago

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?

maxanier commented 11 months ago

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.