PageBrewingRecipe removes already defined potion recipes
JayJay1989 opened this issue ยท 3 comments
i encountered a problem, when i add a new page with a Brewing recipe,
it got overwritten or deleted by forge for some reason.
is there any other way to display already defined brewing recipes?
my code:
ModPotions.java
public class ModPotions {
public static final Potion FREEZING = new Freezing("Freezing", true, 13035007, 0, 0)
.registerPotionAttributeModifier(
SharedMonsterAttributes.MOVEMENT_SPEED, Freezing.MODIFIER_UUID.toString(),
-0.25D, 1
);
public static final PotionType NORMAL_FREEZING = new PotionType("Freezing", new PotionEffect[] { new PotionEffect(FREEZING, 700) }).setRegistryName("Freezing");
public static final PotionType LONG_FREEZING = new PotionType("Freezing", new PotionEffect[] { new PotionEffect(FREEZING, 1400) }).setRegistryName("long_freezing");
public static void registerPotions()
{
registerPotion(NORMAL_FREEZING, LONG_FREEZING, FREEZING);
registerPotionRecipes();
}
private static void registerPotion(PotionType defaultPotion, PotionType longPotion, Potion potionEffect)
{
ForgeRegistries.POTIONS.register(potionEffect);
ForgeRegistries.POTION_TYPES.register(defaultPotion);
ForgeRegistries.POTION_TYPES.register(longPotion);
}
private static void registerPotionRecipes()
{
PotionHelper.addMix(PotionTypes.AWKWARD, ModItems.crystalized_dust, NORMAL_FREEZING);
PotionHelper.addMix(NORMAL_FREEZING, Items.REDSTONE, LONG_FREEZING);
}
}
guideapicompat.java
splashPotionFreezeEntry.addPage(new PageText("guide.morerefinedstorage.entry.splashpotionfreeze.info"));
splashPotionFreezeEntry.addPage(new PageBrewingRecipe(new BrewingRecipe(
PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), PotionTypes.AWKWARD),
new ItemStack(ModItems.crystalized_dust),
PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), ModPotions.NORMAL_FREEZING)))
);
splashPotionFreezeEntry.addPage(new PageBrewingRecipe(new BrewingRecipe(
PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), ModPotions.NORMAL_FREEZING),
new ItemStack(Items.REDSTONE),
PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), ModPotions.LONG_FREEZING)))
);
PotionUtils.addPotionToItemStack() removes the already existed recipes for some reason.
got it working with a workarround
private ItemStack createPotion(ItemPotion potionItem, String potionType){
ItemStack potion = new ItemStack(potionItem);
NBTTagCompound addPotionType = new NBTTagCompound();
addPotionType.setString("Potion", potionType);
potion.setTagCompound(addPotionType);
return potion;
}
splashPotionFreezeEntry.addPage(new PageText("guide.morerefinedstorage.entry.splashpotionfreeze.info"));
splashPotionFreezeEntry.addPage(new PageBrewingRecipe(new BrewingRecipe(
createPotion(Items.SPLASH_POTION, "minecraft:awkward"),
new ItemStack(ModItems.crystalized_dust),
createPotion(Items.SPLASH_POTION, "morerefinedstorage:freezing")))
);
splashPotionFreezeEntry.addPage(new PageBrewingRecipe(new BrewingRecipe(
createPotion(Items.SPLASH_POTION, "morerefinedstorage:freezing"),
new ItemStack(Items.REDSTONE),
createPotion(Items.SPLASH_POTION, "morerefinedstorage:long_freezing")))
);