MCPcopy Index your code
hub / github.com/GregTech6/gregtech6 / container

Method container

src/main/java/gregapi/util/ST.java:849–877  ·  view source on GitHub ↗
(ItemStack aStack, boolean aCheckIFluidContainerItems)

Source from the content-addressed store, hash-verified

847 }
848
849 public static ItemStack container(ItemStack aStack, boolean aCheckIFluidContainerItems) {
850 if (invalid(aStack)) return NI;
851 // Decrease Durability by 1 for these Items.
852 if (ItemsGT.CONTAINER_DURABILITY.contains(aStack, T)) return copyMeta(meta_(aStack) + 1, aStack);
853 // Use normal Container Item Mechanics.
854 if (item_(aStack).hasContainerItem(aStack)) return copy(item_(aStack).getContainerItem(aStack));
855 // These are all special Cases, in which it is intended to have only GT Blocks outputting those Container Items.
856 if (IL.Cell_Empty.exists()) {
857 if (IL.Cell_Empty.equal(aStack, F, T)) return NI;
858 if (IL.Cell_Empty.equal(aStack, T, T)) return IL.Cell_Empty.get(1);
859 }
860 if (IL.SC2_Teapot_Empty.exists()) {
861 if (IL.SC2_Teapot_Empty.equal(aStack, F, T)) return NI;
862 if (IL.SC2_Teapot_Empty.equal(aStack, T, T)) return IL.SC2_Teapot_Empty.get(1);
863 }
864 if (IL.SC2_Teacup_Empty.exists()) {
865 if (IL.SC2_Teacup_Empty.equal(aStack, F, T)) return NI;
866 if (IL.SC2_Teacup_Empty.equal(aStack, T, T)) return IL.SC2_Teacup_Empty.get(1);
867 }
868 if (aCheckIFluidContainerItems && item_(aStack) instanceof IFluidContainerItem && ((IFluidContainerItem)item_(aStack)).getCapacity(aStack) > 0) {
869 ItemStack tStack = amount(1, aStack);
870 ((IFluidContainerItem)item_(aStack)).drain(tStack, Integer.MAX_VALUE, T);
871 if (tStack.stackSize <= 0) return NI;
872 if (tStack.getTagCompound() == null) return tStack;
873 if (tStack.getTagCompound().hasNoTags()) tStack.setTagCompound(null);
874 return tStack;
875 }
876 return NI;
877 }
878
879 public static ItemStack container(ItemStack aStack, boolean aCheckIFluidContainerItems, int aSize) {
880 return amount(aSize, container(aStack, aCheckIFluidContainerItems));

Callers 15

drainMethod · 0.95
onEatenMethod · 0.95
onItemUseFirstMethod · 0.95
processBucketMethod · 0.95
food_canMethod · 0.95
fillMethod · 0.95
createMethod · 0.95
getCraftingResultMethod · 0.95
getCraftingResultMethod · 0.95
findRecipeMethod · 0.95
findRecipeMethod · 0.95
findRecipeMethod · 0.95

Calls 14

invalidMethod · 0.95
copyMetaMethod · 0.95
meta_Method · 0.95
item_Method · 0.95
copyMethod · 0.95
amountMethod · 0.95
containsMethod · 0.65
existsMethod · 0.65
equalMethod · 0.65
getMethod · 0.65
drainMethod · 0.65
hasContainerItemMethod · 0.45

Tested by

no test coverage detected