Jump to content

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


Dracoctix

Recommended Posts

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.