use of thaumcraft.api.aspects.IEssentiaContainerItem in project Railcraft by Railcraft.
the class EssentiaHelper method getEssentia.
public static boolean getEssentia(IInventory inv, int slot, Aspect aspect) {
ItemStack stack = inv.getStackInSlot(slot);
if (!InvTools.isEmpty(stack) && 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 = ThaumcraftPlugin.BLOCKS.get("jar");
inv.setInventorySlotContents(slot, emptyJar);
} else
jar.setAspects(stack, aspects);
return true;
}
}
return false;
}
Aggregations