2021-03-02 18:04:08 +08:00
|
|
|
package me.towdium.jecalculation.utils;
|
|
|
|
|
|
2021-04-28 22:38:45 +08:00
|
|
|
import net.minecraft.item.Item;
|
2021-03-02 18:04:08 +08:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
|
|
public class ItemStackHelper {
|
2023-12-16 09:33:08 -06:00
|
|
|
|
2021-04-28 22:38:45 +08:00
|
|
|
public static final Item EMPTY_ITEM = null;
|
2022-12-18 14:31:25 +08:00
|
|
|
public static final ItemStack EMPTY_ITEM_STACK = new ItemStack((Item) null);
|
2021-03-02 18:04:08 +08:00
|
|
|
|
2024-12-27 10:00:00 +00:00
|
|
|
private static final String GREGTECH_LARGE_FLUID_CELL_ID = "gt.metaitem.01";
|
|
|
|
|
|
2021-05-01 15:38:40 +08:00
|
|
|
public static boolean isEmpty(ItemStack stack) {
|
|
|
|
|
return stack == null || stack == EMPTY_ITEM_STACK || stack.getItem() == EMPTY_ITEM;
|
|
|
|
|
}
|
2024-12-27 10:00:00 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if the given ItemStack is a GregTech large fluid container. This method checks for all variants of the
|
|
|
|
|
* item.
|
|
|
|
|
*
|
|
|
|
|
* @param itemStack The ItemStack to check.
|
|
|
|
|
* @return True if the ItemStack is a GregTech large fluid container, false otherwise.
|
|
|
|
|
*/
|
|
|
|
|
public static boolean isGregTechLargeFluidContainer(ItemStack itemStack) {
|
|
|
|
|
Item item = itemStack.getItem();
|
|
|
|
|
if (item == null) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return item.getUnlocalizedName()
|
|
|
|
|
.equals(GREGTECH_LARGE_FLUID_CELL_ID);
|
|
|
|
|
}
|
2021-03-02 18:04:08 +08:00
|
|
|
}
|