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.

[1.15.2] [Recipe] How to add a recipe which matchs different items from the same tag?

Featured Replies

Posted
comment_385545

Hello world,

I'm trying to realize a mod with Forge 1.15.2. I don't have big problem, but I want to implement a specific recipe, for an item.

To craft this item, I want players to use 7 different dyes, whatever they are. Only 7 different colors dyes. I found the Tags system, so I used it to write my recipe. But players can still make the recipe with 7 bone meal.

I searched a bit, but I didn't find solution for this problem.

 

Do you know how to deal with that, and force players to give 7 different items, corresponding to the same Tag, without forcing especially the dye type ?

Here is my recipe.json file :

 

{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "bgd",
    "ddd",
    "ddd"
  ],
  "key": {
    "b": {
      "item": "rainbowportals:magic_bucket"
    },
    "g": {
      "item": "minecraft:water_bucket"
    },
    "d": {
      "tag": "forge:dyes"
    }
  },
  "result": {
    "type": "minecraft:item",
    "item": "rainbowportals:dye_bucket"
  }
}

 

Thanks by advance :)

comment_385548

You will need to make your own IRecipe implementation.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author
comment_385561

Hi, thank you for the reply.

 

I tried to do that, but I don't know how to "register" this new IRecipe. I read some things about "IRecipeFactory", but it seems to be obsolete. I tried too some thing with IRecipeSerializer, but it doesn't seems to work, since I cannot use the identifier from my json recipe.

Do you know how I can manage to register this IRecipe and make it usable ?

Here is my recipes register class

@Mod.EventBusSubscriber(modid = RainbowPortals.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
class RainbowPortalsRecipes {
    companion object {

        @SubscribeEvent
        @JvmStatic
        fun registerRecipes(event : RegistryEvent.Register<IRecipeSerializer<*>>) {
            event.registry.register(DyeBucketRecipe.Serializer().setRegistryName("dye_bucket_recipe"))
        }
    }
}

 

Thanks by advance :)

comment_385563
3 minutes ago, Dracoctix said:

DyeBucketRecipe.Serializer()

You either need to call new on this or show what this method does.

 

Also, it may be that you're working in Kotlin and I just don't know how Kotlin works. What is it that "doesn't seems to work"?

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author
comment_385566

It's my class, `new` keyword doesn't exist in Kotin. I only need to call the class constructor like any method :)

 

When I run my world, I have an error saying that "dye_bucket_recipe" is an unknown type. I just figured it out, I forgot the modid prefix. So the recipe is loaded. It doesn't work like I want to, but it's certainly algorithmic problem, so I'll debug that by myself ^^

 

Thank you very much for your 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...

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.