joshiejack / Mariculture

Minecraft Mod
MIT License
44 stars 42 forks source link

Tanks ignore "filtering" fluid arguments #348

Closed AlexIIL closed 8 years ago

AlexIIL commented 8 years ago

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)

AlexIIL commented 8 years ago

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

joshiejack commented 8 years ago

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.