Jump to content

Recommended Posts

Posted

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!"

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.