Jump to content

[Already Implemented] Interface for Itemstack that Contains Fluids


Recommended Posts

Edit: Apparently I was blind and couldn't find the IFluidContainerItem interface. Apologies for that!


Hey all!


The current method of having an item contain a FluidStack requires that the person registers the item in question, and with this method they are only able to register a static amount. What I'd love to be able to do is take an item that can contain a variable amount of fluid and throw it into a machine, say an Aqueous Accumulator from Thermal Expansion 3, and have it start to fill up the item with the fluid. I don't mean consumes the item and gives another that has 1000mB of water "contained," but instead have it slowly fill up to 50mB, 100mB, 5323mB if I so wish.


For this, what I'd like to submit is an interface that can be added to an item, so that the modder can specify what types of fluids can be added to their item, the max quantity of fluid that can be there, as well as being able to load in any fluid that it so wishes. I have an interface with 5 simple methods below that I think should be able to cover everything that both a modder and a player may wish for.


public interface IItemFluidContainer 
public boolean hasRoomForFluid(ItemStack itemStack, Fluid reference);

public FluidStack getFluidStackByFluid(ItemStack itemStack, Fluid reference);

public int getCapacityByFluid(ItemStack itemStack, Fluid reference);

public ItemStack getResultFromSyphoningFluid(ItemStack itemStack, FluidStack fluid);

public ItemStack getResultFromAddingFluid(ItemStack itemStack, FluidStack fluid);


Of course it's missing the imports, but that should be easy enough. Let me know what you think!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.