Jump to content

[1.16.4]Best Practice getting type of items for DataGeneration?


Recommended Posts

Posted (edited)

Good morning,

so I'm currently in the process of converting my recipes to DataGeneration(1.7.x to 1.16.x).

In the past I would simply copypasta groups of code blocks, primarily due to laziness and lack of time. I want to change that, and if it's just to render my code a little bit more professionell. 

I remember in the past you could "group up" item types by calling their material, but no matter how much I'm trying to convert this method, and browsing the Forge/MC Snapshot files, I don't think this method is available any more(correct me if I'm wrong). So, in code, here's what I mean:

 
//I want to turn this...
ShapelessRecipeBuilder.shapelessRecipe(
	Items.STRING)
          .addIngredient(Items.WHITE_WOOL, 2)
          .addCriterion("has_wool", hasItem(Items.WHITE_WOOL)).build(consumer);

ShapelessRecipeBuilder.shapelessRecipe(
	Items.STRING)
          .addIngredient(Items.BLACK_WOOL, 2)
          .addCriterion("has_wool", hasItem(Items.BLACK_WOOL)).build(consumer);
//...into something like this...
ShapelessRecipeBuilder.shapelessRecipe(
	Items.STRING)
          .addIngredient((any)ItemType(of).WOOL, 2)
          .addCriterion("has_wool", hasItem((any)ItemType(of).WOOL)).build(consumer);
	

 

Material, ItemType, or an ItemArray, what would you recommend? I'd need that info to actually browse the correct files.

Edited by Cratthorax

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.