public static boolean getEssentia(IInventory inv, int slot, Aspect aspect) {
ItemStack stack = inv.getStackInSlot(slot);
if (stack != null && stack.getItem() instanceof IEssentiaContainerItem && "item.BlockJarFilledItem".equals(stack.getUnlocalizedName())) {
IEssentiaContainerItem jar = (IEssentiaContainerItem) stack.getItem();
AspectList aspects = jar.getAspects(stack);
if (aspects.getAmount(aspect) > 0) {
aspects.remove(aspect, 1);
if (aspects.size() == 0) {
ItemStack emptyJar = GameRegistry.findItemStack("Thaumcraft", "blockJar", 1);
inv.setInventorySlotContents(slot, emptyJar);
} else
jar.setAspects(stack, aspects);
return true;
}
}
return false;
}