Mariculture

Mariculture

2M Downloads

Tanks ignore "filtering" fluid arguments

AlexIIL opened this issue ยท 2 comments

commented

Your fluid tanks (tested with the "Fluid Tank" block) don't seem to respect the fluidstack fluid part of IFluidHandler.drain(side, FluidStack, doDrain). This is a problem for filtered extration pipes (specifically BuildCraft emerald fluid pipes) as they pass in the fluid that they want to extract. I think you can fix this by changing https://github.com/joshiejack/Mariculture/blob/1.7.10-1.3.0/src/main/java/mariculture/core/tile/TileTankBlock.java#L92 something along the lines of this:

@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
    if (resource == null) {
        // BuildCraft takes this as "The return must be equal to the given argument" so it just returns null 
        // Feel free to disagree with that though, and take it for "anything"
        return null;
    }
    if (resource.isFluidEqual(tank.getFluid())) {
        return drain(from, resource.amount, doDrain);
    }
    return null;
}

You may also want to do the same for canDrain but BuildCraft dosn't use that method so it won't change this particular situation if you do so.

I tested this with version 1.2.4.2a, however this seems to still be the case in https://github.com/joshiejack/Mariculture/blob/1.7.10-1.3.0/src/main/java/mariculture/core/tile/TileTankBlock.java#L92.

(This was reported to us in the BC IRC chat by Sungak)

commented

Out of interest, why was this closed? Is 1.7.10 not being maintained or was this invalid?

commented

I'm not working on 1.7.10 anymore. I was just closing everything, that was related to that. (Except that one where other people are discussing/pr'ing). I'm happy to accept PR's. But I'm not working on it myself.