Posted June 7, 20205 yr 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!"
June 7, 20205 yr 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
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.