Fluidlogged API

Fluidlogged API

356k Downloads

Rewrite Status?

Rongmario opened this issue ยท 7 comments

commented

What's the status on the rewrite? I'm interested in helping out and would like to see the API mature.

Discord: Rongmario#9898 (if you use)

commented

@jbredwards Question about the rewritten API: what's the replacement for BlockFluidloggedClassic? I am having issues where my kelp seems to be rendering with water around it (as if it's a source block on land) despite being underwater. I published the branch here; any help would be great. UnderwaterPlantBlock is my attempt to force blocks to be fluidlogged at all times.

commented

what's the replacement for BlockFluidloggedClassic?

There's no exact replacement for BlockFluidloggedClassic, but the new IFluidloggable is capable of everything BlockFluidloggedClassic was. What you're doing with UnderwaterPlantBlock is exactly what I had in mind for a permanent fluidlogged block.

I am having issues where my kelp seems to be rendering with water around it (as if it's a source block on land) despite being underwater.

Fluidlogged fluids will always render from sides they can't flow from (see IFluidloggable#canFluidFlow).

Btw, I don't think the Block#onBlockAdded method has to be overriden, this mod ASMs World#setBlockState here to set any old fluid IBlockState as a FluidState if the block replacing it is fluidloggable. Once I get a release out to curseforge (getting very close, probably in the coming days) I'll start working on a wiki to make this stuff clearer. It warms my heart that people are taking interest in my mod :D

commented

Btw, I don't think the Block#onBlockAdded method has to be overriden, this mod ASMs World#setBlockState here to set any old fluid IBlockState as a FluidState if the block replacing it is fluidloggable.

Good point, thank you! At the time I was still testing and hadn't overriden canPlaceBlockAt yet to make sure it would only be placed in water and not land.

Fluidlogged fluids will always render from sides they can't flow from (see IFluidloggable#canFluidFlow).

Thanks. I made that method return true for UnderwaterPlantBlock and it fixed the issue. Hopefully that's the right way of doing it. Kelp is generally surrounded by water at all times so flowing shouldn't really happen anyways.

commented

@jbredwards Is there any sort of possibility that placing fluidlogged blocks during worldgen (i.e. in DecorateBiomeEvent.Post or PopulateChunkEvent) might cause unintended consequences? I'm trying to debug why my kelp works absolutely fine when placed manually but it all pops off into items during worldgen. I disabled all my logic for checking that the kelp's in the right position and popping it off, but the blocks still break. Presumably there's some vanilla behavior here I'm not aware of. If you could take a look/possibly spot something obvious I've missed, it'd be appreciated!

(I temporarily changed canFluidFlow to return false just in case that was the issue, but it didn't help.)

commented

It probably has to do with the kelp using Material.PLANTS, which can be destroyed by fluids. Try creating a new material & see if that helps.

commented

Thank you so much! That was exactly the problem.

commented

Looking more and more like 1.13 every day! All thanks to your hard work. ๐Ÿ™‚

2022-03-12_09 46 26
2022-03-12_09 46 30