diff --git a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java index d953cca..a611fdd 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -227,6 +227,81 @@ } /** + * Attempts to empty a full container. + * + * @param container + * ItemStack representing the full container. + * @return Empty container if successful, otherwise null. + */ + public static ItemStack drainFluidContainer(ItemStack container) + { + if (container == null) + { + return null; + } + + FluidContainerData data = containerFluidMap.get(new ContainerKey(container)); + if (data != null) + { + return data.emptyContainer.copy(); + } + + return null; + } + + /** + * Determines the capacity of a full container. + * + * @param container + * The full container. + * @return The containers capacity, or 0 if the ItemStack does not represent + * a registered container. + */ + public static int getContainerCapacity(ItemStack container) + { + return getContainerCapacity(null, container); + } + + /** + * Determines the capacity of a container. + * + * @param fluid + * FluidStack containing the type of fluid the capacity should be + * determined for (ignored for full containers). + * @param container + * The container (full or empty). + * @return The containers capacity, or 0 if the ItemStack does not represent + * a registered container or the FluidStack is not registered with + * the empty container. + */ + public static int getContainerCapacity(FluidStack fluid, ItemStack container) + { + if (container == null) + { + return 0; + } + + FluidContainerData data = containerFluidMap.get(new ContainerKey(container)); + + if (data != null) + { + return data.fluid.amount; + } + + if (fluid != null) + { + data = filledContainerMap.get(new ContainerKey(container, fluid)); + + if (data != null) + { + return data.fluid.amount; + } + } + + return 0; + } + + /** * Determines if a container holds a specific fluid. */ public static boolean containsFluid(ItemStack container, FluidStack fluid) diff --git a/src/main/resources/fmlversion.properties b/src/main/resources/fmlversion.properties index c151d13..f9c7afa 100644 --- a/src/main/resources/fmlversion.properties +++ b/src/main/resources/fmlversion.properties @@ -1,6 +1,6 @@ fmlbuild.major.number=7 fmlbuild.minor.number=10 fmlbuild.revision.number=25 -fmlbuild.build.number=66 +fmlbuild.build.number=67 fmlbuild.mcversion=1.7.10 fmlbuild.mcpversion=9.05