I'm facing an issue with canning machine recipe:
NBTTagCompound fullMagazineNBT = ItemMagazine.getNBTForAmmo(ItemMagazine.MAX_AMMO);
addCanningRecipe(input.forExactStack(new ItemStack(magazine, 1, 0, emptyMagazineNBT)),
input.forStack(new ItemStack(cartridge, 20)),
new ItemStack(magazine, 1, 0, fullMagazineNBT));
...
public static NBTTagCompound getNBTForAmmo (int value) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger(AMMO_KEY, value);
return nbt;
}
...
private static void addCanningRecipe (IRecipeInput container, IRecipeInput filler, ItemStack out) {
Recipes.cannerBottle.addRecipe(container, filler, out, false);
}
Display More
Debugger shows that addCanningRecipe gets output item stack with NBT ammo MAX_AMMO = 20, however, this recipe produces a magazine with NBT ammo 0. Is it an API bug, or am I doing it the wrong way?
By the way, I'm totally not a Java programmer, so beware of ugly code.