Jump to content

Recommended Posts

Posted

Hello! I'm currently trying to add a custom brewing stand recipe, however it seems to output the wrong potion! Instead of giving me the extended levitation potion, it's giving me the extended jumpless potion.

 

ModPotions.java

public class ModPotions {

    public static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, SurvivalExtras2.MOD_ID);
    public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTION_TYPES, SurvivalExtras2.MOD_ID);
    private static ArrayList<BrewingRecipe> recipes = new ArrayList<>();

    public static final RegistryObject<Effect> milkEffect = EFFECTS.register("milk", () ->
            new EffectMilk(EffectType.NEUTRAL, 0xFFFFFF));
    public static final RegistryObject<Potion> milkPotion = POTIONS.register("milk_potion", () ->
            new Potion(new EffectInstance(milkEffect.get())));

    public static final RegistryObject<Effect> starEffect = EFFECTS.register("star", () ->
            new EffectStar(EffectType.BENEFICIAL, 0xFFFF00));
    public static final RegistryObject<Potion> baseStarPotion = POTIONS.register("base_star", () ->
            new Potion(new EffectInstance(starEffect.get(), 400, 0)));

    public static final RegistryObject<Effect> burntEffect = EFFECTS.register("burnt", () ->
            new EffectBlank(EffectType.HARMFUL, 0x1f1f1f));

    public static final RegistryObject<Effect> challengeEffect = EFFECTS.register("food_kingdom_challenge", () ->
            new EffectChallenge(EffectType.BENEFICIAL, 0xFFFF00));

    public static final RegistryObject<Effect> jumpless = EFFECTS.register("jumpless", () ->
            new EffectBlank(EffectType.HARMFUL, 0xDD00B3));
    public static final RegistryObject<Potion> jumplessPotion = POTIONS.register("base_jumpless", () ->
            new Potion(new EffectInstance(jumpless.get(), 45*20)));
    public static final RegistryObject<Potion> jumplessPotionExtended = POTIONS.register("jumpless_extended", () ->
            new Potion(new EffectInstance(jumpless.get(), 90*20)));

    public static final RegistryObject<Potion> mysteriousPotion = POTIONS.register("se2_mysterious", Potion::new);

    public static final RegistryObject<Potion> levitationBase = POTIONS.register("base_levitation", () ->
            new Potion(new EffectInstance(Effects.LEVITATION, 90*20)));
    public static final RegistryObject<Potion> levitationExtended = POTIONS.register("levitation_extended", () ->
            new Potion(new EffectInstance(Effects.LEVITATION, 180*20)));
    public static final RegistryObject<Potion> levitationExtra = POTIONS.register("levitation_extra", () ->
            new Potion(new EffectInstance(Effects.LEVITATION, 45*20, 1)));

    public static void addRecipes(FMLCommonSetupEvent event) {
        initRecipes();
        for (BrewingRecipe recipe : recipes) {
            event.enqueueWork(() -> BrewingRecipeRegistry.addRecipe(recipe));
        }
    }

    public static void initRecipes() {
        addAwkwardRecipe(Items.MILK_BUCKET, milkPotion.get());
        addAwkwardRecipe(ModItems.mysteriousCore.get(), mysteriousPotion.get());
        addAwkwardRecipe(ModItems.flightEssence.get(), levitationBase.get());

        addMysteriousRecipe(Items.NETHER_STAR, baseStarPotion.get());
        addMysteriousRecipe(Items.RABBIT_FOOT, jumplessPotion.get());

        addWaterRecipe(ModItems.enchantIngot.get(), new ItemStack(Items.EXPERIENCE_BOTTLE));

        addRedstoneRecipe(jumplessPotion.get(), jumplessPotionExtended.get());
        addRedstoneRecipe(levitationBase.get(), levitationExtended.get());

        addGlowstoneRecipe(levitationBase.get(), levitationExtra.get());

    }

    public static void addAwkwardRecipe(Item ingredient, Potion potion) {
        recipes.add(new BrewingRecipe(
                Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.AWKWARD)),
                Ingredient.fromItems(ingredient),
                PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potion)));
    }

    public static void addMysteriousRecipe(Item ingredient, Potion potion) {
        recipes.add(new BrewingRecipe(
                Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), ModPotions.mysteriousPotion.get())),
                Ingredient.fromItems(ingredient),
                PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potion)));
    }

    public static void addWaterRecipe(Item ingredient, ItemStack output) {
        recipes.add(new BrewingRecipe(
                Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.WATER)),
                Ingredient.fromItems(ingredient),
                output
        ));
    }

    public static void addRedstoneRecipe(Potion potionIn, Potion potionOut) {
        recipes.add(new BrewingRecipe(
                Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionIn)),
                Ingredient.fromItems(Items.REDSTONE),
                PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionOut)));
    }

    public static void addGlowstoneRecipe(Potion potionIn, Potion potionOut) {
        recipes.add(new BrewingRecipe(
                Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionIn)),
                Ingredient.fromItems(Items.GLOWSTONE_DUST),
                PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionOut)));
    }

}

 

Full repo is at https://github.com/hammy3502/survival-extras-2 if you need to look anywhere else. Thank you so much for any help!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.