Jump to content

Help with logs tags


Aj3douglas

Recommended Posts

Hello,

Im fairly new to modding, however I am not new to java.

I Want to get an ingredient, in my config file I either wanna specify "minecraft:cobblestone" or "logs", I have these methods to try and deal with that

    private fun resolveItemTag(tagName:String):Tag<Item> =
            ItemTags.getCollection()[ResourceLocation(tagName)] ?: throw RuntimeException("The item tag $tagName does not exist!")

    private fun resolveIngredient(material:String):Ingredient =
        if(material.contains(":")) Ingredient.fromItems(resolveItem(material))
    else Ingredient.fromTag(resolveItemTag(material))

    private fun resolveItem(registryName:String):Item =
            ForgeRegistries.ITEMS.getValue(ResourceLocation("minecraft")) ?: throw RuntimeException("The item $registryName does not exist!")

However I get "The item tag logs does not exist!"

Link to comment
Share on other sites

Howdy

Well that code doesn't look much like Java to me so I can't really help you with that.  Except to suggest that

ResourceLocation("minecraft") doesn't contain your registryName parameter.

 

This working example of tags and recipes that use tags might be helpful, perhaps.

 

https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe35_recipes

 

 

-TGG

 

 

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.