Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

My system works fine but i can brew a resistance potion with a resistance potion. Any help?

Here is the class that extends IBrewingRecipe:

 

public class PotionRecipe implements IBrewingRecipe{

 

private ItemStack input;

private ItemStack ingredient;

private ItemStack output;

 

public PotionRecipe(ItemStack input, ItemStack ingredient, ItemStack output) {

this.input = input;

this.ingredient = ingredient;

this.output = output;

}

 

@Override

public boolean isInput(ItemStack input2) {

if(!input2.hasTagCompound())

return false;

return PotionUtils.getPotionFromItem(input2)==PotionUtils.getPotionFromItem(this.input);

}

 

@Override

public boolean isIngredient(ItemStack ingredient2) {

return ingredient2.getItem()==Items.REDSTONE  || ingredient2.getItem()==Items.GLOWSTONE_DUST || ingredient2.getItem()==Items.IRON_INGOT||ingredient2.getItem()==Items.FERMENTED_SPIDER_EYE;

}

 

@Override

public ItemStack getOutput(ItemStack input2, ItemStack ingredient2) {

 

if(ingredient2 != null && input2 != null && isIngredient(ingredient2))  {

ItemStack output2 = this.output.copy();

if (input2 != output2)

{

return output2;

}

return null;

}

else

return null;

}

 

}

 

How I register the recipes:

 

public void postInit(FMLPostInitializationEvent event)

  {BrewingRecipeRegistry.addRecipe(new PotionRecipe(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM,1), CustomPotionTypes.resistance), new ItemStack(Items.FERMENTED_SPIDER_EYE,1), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM,1), CustomPotionTypes.weakening)));

    BrewingRecipeRegistry.addRecipe(new PotionRecipe(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM,1), PotionTypes.AWKWARD), new ItemStack(Items.IRON_INGOT,1), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM,1), CustomPotionTypes.resistance)));

 

    }

 

In get output you never check if input2 is input. And honestly forge why would you just check to see if the item is the same when you should be comparing ItemStacks.....

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Note these edits work for me.

 

           // This
   @Override
   public boolean isInput(ItemStack input2) {
      if(!input2.hasTagCompound())
         return false;
      return PotionType.getPotionTypeForName(input2.getTagCompound().getString("Potion")) == PotionType.getPotionTypeForName(input.getTagCompound().getString("Potion"));
   }
           // And this
   @Override
   public ItemStack getOutput(ItemStack input2, ItemStack ingredient2) {
	   if(ingredient2 != null && input2 != null && isIngredient(ingredient2))  {
		   ItemStack output2 = this.output.copy();
		   if (input2 != output2 && isInput(input2)) {
			   return output2;
		   } return null;
	   }  else
		   return null;
   }

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

That doesn't seems to solve the problem. I'm pretty sure that the check that you edit didn't change anything.The isInput was my fault ,though ;D. The problem with the system is that even though iron ingot brew the resistance one and fermented spider eye brews the resistance potion to the weakening one, the iron ingot still brew the resistance potion to itself.

  • Author

I assume you mean the potiontypes:

 

public class CustomPotionTypes {

public static PotionType resistance;

public static PotionType weakening;

public static void init(){

resistance= GameRegistry.register(new PotionType(new PotionEffect(MobEffects.RESISTANCE, 1800)).setRegistryName("resistance"));

weakening= GameRegistry.register(new PotionType(new PotionEffect(CustomPotion.weakening, 1800)).setRegistryName("weakening"));

}}

 

In the Mod file:

public void preInit(FMLPreInitializationEvent event)

    {

    CustomPotionTypes.init();

   

            }

 

 

  • Author

 

package minh2908.ores.init.potion;

 

import net.minecraft.init.Items;

import net.minecraft.item.ItemStack;

import net.minecraft.potion.PotionType;

import net.minecraftforge.common.brewing.IBrewingRecipe;

 

public class PotionRecipe implements IBrewingRecipe{

 

private ItemStack input;

private ItemStack ingredient;

private ItemStack output;

 

public PotionRecipe(ItemStack input, ItemStack ingredient, ItemStack output) {

this.input = input;

this.ingredient = ingredient;

this.output = output;

}

 

@Override

public boolean isInput(ItemStack input2) {

if(!input2.hasTagCompound())

return false;

return PotionType.getPotionTypeForName(input2.getTagCompound().getString("Potion")) == PotionType.getPotionTypeForName(input.getTagCompound().getString("Potion"));

  }

 

@Override

public boolean isIngredient(ItemStack ingredient2) {

return ingredient2.getItem()==Items.REDSTONE  || ingredient2.getItem()==Items.GLOWSTONE_DUST || ingredient2.getItem()==Items.IRON_INGOT||ingredient2.getItem()==Items.FERMENTED_SPIDER_EYE;

}

 

@Override

public ItemStack getOutput(ItemStack input2, ItemStack ingredient2) {

 

if(ingredient2 != null && input2 != null && isIngredient(ingredient2))  {

ItemStack output2 = this.output.copy();

if (input2 != output2 && isInput(input2))

{

return output2;

}

return null;

}

else

return null;

}

 

}

 

  • Author

I've found the solution! Turns out the ingredient check was defective :P. Thanks for your help, though, especially on reminding me of the ingredient check.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.