Closed ghost closed 7 months ago
Interesting. Raw Ender currently uses the standard Forge BlockFluidFinite, so it would be good if those mods added proper support for that. Here's how I do it.
I could make which fluid type it uses configurable, though.
I use the fluid registry lookup. FluidRegistry.lookupFluidForBlock or something like that. If that returns null. my machines ignore it. However, it also has to extend BlockFluidBase or BlockLiquid (the parent of the vanilla blocks) and be of metadata zero. Which fails for yours?
@ReikaKalseki, the only methods I overwrite of BlockFluidFinite are texture-related, so I use the default Forge implementation for everything else.
BlockFluidFinite uses metadata to determine how 'full' that particular blockspace is. Metadata 7 is 'full' (1 buckets worth), and metadata 0 is 1/8 'full' (125mb worth). There are no source blocks--each block is representative of a certain amount of fluid.
So, when consuming a BlockFluidFinite, you need to take that into account, and only consume the amount of fluid that exists in the block based on its metadata.
You might want to use the IFluidBlock.drain method: https://github.com/MinecraftForge/MinecraftForge/blob/1710ls/src/main/java/net/minecraftforge/fluids/BlockFluidFinite.java#L312-L321
My systems deal in blocks - and only some can even handle non-bucket amounts.
@ReikaKalseki, okay, then your pump and BlockFluidFinite will just not be compatible, but it still might be a good idea to use the Forge interface. Something like:
if (block instanceof IFluidBlock && ((IFluidBlock) block).canDrain(world, x, y, z))
{
IFluidBlock fluidBlock = (IFluidBlock) block;
// dry run
FluidStack drainedFluidStack = fluidBlock.drain(world, x, y, z, false);
if (drainedFluidStack != null && drainedFluidStack.amount == FluidContainerRegistry.BUCKET_VOLUME)
{
// do the actual draining
return fluidBlock.drain(world, x, y, z, true);
}
return null;
}
// pseudo-code
else if (block is lava/water)
{
// standard drain logic for vanilla fluids
}
Not perfect, and will still fail to handle most BlockFluidFinite blocks (given that 'full' finite fluid blocks are rather rare), but that might be the most Forge-compatible way to do it.
That code is not compatible with vanilla fluids.
@ReikaKalseki, you may have seen it before I edited in the else if
block. Vanilla fluids will need special handling.
I feel like you think I'm doing something wacky with my mod and you want me to prove to you that 'my way' is worth supporting, but I'm not doing anything wacky at all.
It's totally up to you if you want to support BlockFluidFinite, but just be aware that it is not specific to my mod; it is native to Forge, so you need to decide whether or not you want to support a Forge thing. It's not my job to provide you a perfect implementation.
Many modded blocks also use the BlockLiquid class, so it would need to be more than just lava in water.
Also, given that both vanilla and 95% of mod fluids use the source block system, it is in fact the Finite system that would need special handling.
@ReikaKalseki, I feel like you're deliberately misinterpreting me at this point. I don't have anything more to say, as nothing you're talking about has anything to do with code that I have written.
Look at the Forge source code and create an issue on their repository if you don't like it:
@ReikaKalseki, I feel like you're deliberately misinterpreting me at this point. I don't have anything more to say, as nothing you're talking about has anything to do with code that I have written.
....?
....?
Perhaps I'm misinterpreting you? What's your goal here? Are you trying to collaborate with me to find a solution? If so, it doesn't feel that way to me.
As I said, I will need to insert special handling...in several places.
I will say that I do not really approve of the existence of two separate and fundamentally incompatible systems.
Right, and as I said, I had nothing to do with either of those systems. I don't like it either, but that's what exists.
There, I added support for it on my four pumps, though one of them can only handle full buckets.
Nice!
Leaving this open because I think the config option is still a good idea.
Config option?
@ReikaKalseki, your work is done; you can safely ignore this issue now. Appreciate the quick fix.
I was talking about the config option suggested in the OP to make Raw Ender optionally use BlockFluidClassic instead of BlockFluidFinite:
Is it possible to make it configurable to whether or not raw ender has a source block instead of the current flow mechanics?
No longer applicable. Raw Ender has been completely rewritten as fluids have changed drastically.
Raw ender does not seem to be pumpable. This has been observed with the RotaryCraft pump, as well as the ender-thermic pump from Extra Utilities (although it does replace raw ender with stone).
I was able to use the Expanded Redstone pump successfully, but this seems to be due to an exploit discovered with that pump: it will actually collect fluid flow blocks in addition to source blocks.
Because of these issues, and observations about the behavior of raw ender, I'm assuming that you don't have raw ender source blocks? Is it possible to make it configurable to whether or not raw ender has a source block instead of the current flow mechanics?