Fluidlogged API

Fluidlogged API

305k Downloads

Interaction with non-fluid water (eg underwater decoration) blocks crashes

AechtRob opened this issue ยท 1 comments

commented

My mod, Prehistoric Nature, uses blocks set as Material of Water, but they are not fluid blocks. This is used for underwater plants for example. This is a fairly common technique used in many 1.12 mods to circumvent lack of vanilla fluidlogging, and makes the blocks render nicely under water.

I've had a crash reported in conjunction with FluidLogged API (Fluidlogged-API-v1.8.1c-mc1.12.2.jar), where the api tries to cast these blocks to net.minecraftforge.fluids.IFluidBlock without first checking whether the blocks are instances of that in the first place (which they are not).

An example crash trace is below. I had a quick look at what is happening on line 692 but it goes down a rabbit-hole :P so I'll leave it to you. As far as I can tell, the thing missing is just to check whether block instance of IFluidBlock before doing wherever that cast is happening?

java.lang.ClassCastException: net.lepidodendron.block.BlockStalkedAlgae$BlockCustom cannot be cast to net.minecraftforge.fluids.IFluidBlock
at git.jbredwards.fluidlogged_api.mod.asm.plugins.ASMHooks.getFluidHandler(ASMHooks.java:692)
at net.minecraftforge.fluids.FluidUtil.getFluidHandler(FluidUtil.java:543)
at net.eve0415.ifpatcher.patch.PatchPump.isFullFluid(PatchPump.java:83)
at net.eve0415.ifpatcher.patch.PatchPump.lambda$getFarthestFluid$0(PatchPump.java:63)
at java.util.ArrayList.removeIf(ArrayList.java:1415)
at net.eve0415.ifpatcher.patch.PatchPump.getFarthestFluid(PatchPump.java:63)
at net.eve0415.ifpatcher.patch.PatchPump.work(PatchPump.java:44)
at com.buuz135.industrial.tile.world.FluidPumpTile.work(FluidPumpTile.java)
at com.buuz135.industrial.tile.WorkingAreaElectricMachine.performWork(WorkingAreaElectricMachine.java:112)
at net.ndrei.teslacorelib.tileentities.ElectricMachine.protectedUpdate(ElectricMachine.kt:280)
at com.buuz135.industrial.tile.CustomElectricMachine.protectedUpdate(CustomElectricMachine.java:120)
at com.buuz135.industrial.tile.world.FluidPumpTile.protectedUpdate(FluidPumpTile.java:76)
at net.ndrei.teslacorelib.tileentities.ElectricTileEntity.innerUpdate(ElectricTileEntity.kt:118)
at net.ndrei.teslacorelib.tileentities.SidedTileEntity.update(SidedTileEntity.kt:991)
at com.zeitheron.hammercore.asm.McHooks.tickTile(McHooks.java:38)
at net.minecraft.world.World.updateEntities(World.java:1838)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:613)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:767)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:279)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
at java.lang.Thread.run(Thread.java:750)

commented

should be fixed in v1.8.1d, feel free to reopen if it isn't