### Priority Example Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/anvil-combining-recipes.mdx An example demonstrating how to set a priority for a recipe. Higher priority values mean the recipe will be displayed earlier. Negative numbers are allowed. This example shows an iron pickaxe recipe with a priority of 10. ```json { "type": "rrv:anvil_combining", "left": "minecraft:stick", "right": "minecraft:iron_ingot", "result": { "id": "minecraft:iron_pickaxe", "components": { "minecraft:damage": 30 }, "priority": 10 } ``` -------------------------------- ### Example Client Recipe Implementation Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/client-recipes.mdx A Java example demonstrating the implementation of `ReliableClientRecipe` for an upgrading recipe. It shows how to define inputs, outputs, bind slots, and add custom modifiers and rendering. ```java public class UpgradingClientRecipe implements ReliableClientRecipe { private final Identifier id; private final SlotContent baseItem, upgradeItem, output; //You can design your constructor to suit your needs public UpgradingClientRecipe(Identifier id, Ingredient baseItem, Ingredient upgradeItem, ItemStackTemplate resultItem) { //Define your inputs and outputs here this.baseItem = SlotContent.of(baseItem); this.upgradeItem = SlotContent.of(upgradeItem); this.resultItem = SlotContent.of(resultItem); this.id = id; } // Prior to RRV 8.0.0, this was `getViewType`. @Override public ReliableClientRecipeType getType() { return ExampleModClientRecipeType.INSTANCE; //Here you need your client recipe type's instance you created before } // The identifier of this recipe, used for clientside operations like recipe hiding. Only available/required since v8.0.0. // If this recipe does not have a file associated with it, prefix the path with ' e.g. `minecraft:/code_driven_recipe` so that users do not look for a nonexistent file. public Identifier getId() { return id; } @Override public void bindSlots(RecipeViewMenu.SlotFillContext slotFillContext) { //Tell RRV which SlotContent belongs to which of your previously defined slots slotFillContext.bindSlot(0, this.baseItem); slotFillContext.bindSlot(1, this.upgradeItem); slotFillContext.bindSlot(2, this.resultItem); // When you want to add custom information to some of your items simply add a stack modifier to the corresponding slots slotFillContext.addAdditionalStackModifier(1, (stack, tooltip) -> { tooltip.add(Component.literal("Used to upgrade an item!")); }); // You can also bind a slot as "optional" and provide it with a valid SlotRenderer to ensure a slot // is only rendered if there's an item in it // The default SlotRenderer is used for rendering Minecraft's default slot texture slotFillContext.bindOptionalSlot(0, this.result, RecipeViewMenu.OptionalSlotRenderer.DEFAULT); } @Override public List getIngredients() { return List.of(this.baseItem, this.upgradeItem); //Return all of your inputs here } @Override public List getResults() { return List.of(this.resultItem); //Return all of your outputs here } // Recipes with more complicated displays can override `renderRecipe`. public void renderRecipe(RecipeViewScreen screen, RecipePosition recipePosition, GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTicks) { guiGraphics.text(Minecraft.getInstance().font, "Rendered text on the center of the screen!", 5, 20, -16777216, false); if ((mouseX > 65 && mouseX < 90) && mouseY < 37 && mouseY > 5) { guiGraphics.setTooltipForNextFrame(Component.literal("Text in a tooltip when hovering over an area!"), mouseX, mouseY); } } } ``` -------------------------------- ### Client-side RRV Plugin Example Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/finalizing-your-plugins.mdx Example Java code for a client-side RRV plugin that adds custom recipe providers. ```java public class ExampleModClientIntegration implements ReliableRecipeViewerClientPlugin { @Override public void onIntegrationInitialize() { //For the client ItemView.addClientRecipeProvider(recipeList -> { // provides a list of `ReliableClientRecipe`s to add to // Upgrading ClientRecipeManager.INSTANCE.getRecipesForType(ExampleModRecipes.UPGRADING_RECIPE_TYPE).forEach(upgradingRecipeHolder -> { // provides a list of `RecipeHolder`s for you to convert UpgradingRecipe recipe = upgradingRecipeHolder.value(); recipeList.add(new UpgradingClientRecipe(recipe.getBaseItem(), recipe.getUpgradeItem(), recipe.getResult())); }); }); } } ``` -------------------------------- ### Server-side RRV Plugin Example Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/finalizing-your-plugins.mdx Example Java code for a server-side RRV plugin that synchronizes a custom recipe type. ```java public class ExampleModIntegration implements ReliableRecipeViewerPlugin { @Override public void onIntegrationInitialize() { // Here, you can tell the server to synchronize your mod's recipes to the client. In this example, we're using the server recipe manager to synchronize recipes for an example mod's upgrading recipe type. ServerRecipeManager.INSTANCE.synchronizeRecipeType(ExampleModRecipes.UPGRADING_RECIPE_SERIALIZER, ExampleModRecipes.UPGRADING_RECIPE_TYPE); } } ``` -------------------------------- ### Stone (Items) - Language File Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/info-recipes.mdx Example JSON file for the English language translation of the stone info recipe. ```json { "rrv.info.stone": "Stone can be found underground." } ``` -------------------------------- ### Example Client Recipe Type Implementation Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/client-recipe-type.mdx An example Java class implementing `ReliableClientRecipeType` to define a new client recipe type for crafting, including display name, GUI dimensions, texture, slot count, slot placement, ID, icon, and craft references. ```java public class UpgradingClientRecipeType implements ReliableClientRecipeType { //Create an instance of your client recipe type here //Relevant for next steps protected static final ReliableClientRecipeType INSTANCE = new ReliableClientRecipeType(); @Override public Component getDisplayName() { return Component.literal("Upgrading"); //This is the name of your recipe type, displayed later in the recipe view. } @Override public int getDisplayWidth() { return 100; //The width of your type's gui texture } @Override public int getDisplayHeight() { return 40; //The height of your type's gui texture } @Override public @Nullable Identifier getGuiTexture() { return Identifier.fromNamespaceAndPath("example-mod", "textures/gui/type/upgrading.png"); // The background texture of your recipe. } @Override public int getSlotCount() { return 3; //The amount of slots required to show a single recipe of this type - this includes two inputs and a result. } @Override public void placeSlots(RecipeViewMenu.SlotDefinition slotDefinition) { //Tell RRV where your slots are located by calling slotDefinition.addItemSlot(); //NOTE: Slot position is relative to your gui texture slotDefinition.addItemSlot(0, 10, 20); slotDefinition.addItemSlot(1, 40, 20); slotDefinition.addItemSlot(2, 60, 20); } @Override public Identifier getId() { return Identifier.fromNamespaceAndPath("example-mod", "upgrading"); // The unique id of this recipe type } @Override public ItemStack getIcon() { return ItemStack.EMPTY; //The icon displayed in the recipe view screen } @Override public List getCraftReferences() { return List.of(); //Return a list of blocks/items that can be used to process your recipes (e.g. for Smelting it would be the Furnace) } } ``` -------------------------------- ### Stone (Items) - Recipe File Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/info-recipes.mdx Example JSON file for an info recipe that uses an item to display information about stone. ```json { "type": "rrv:info", "key": "#minecraft:stone", "text": "rrv.info.stone" } ``` -------------------------------- ### Priority Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/world-interaction-recipes.mdx Example of a world interaction recipe with a specified priority to control display order. ```json { "type": "rrv:world_interaction", "left": "minecraft:water", "right": "minecraft:lava", "result": "minecraft:cobblestone", "priority": 10 } ``` -------------------------------- ### Tag Translation Example Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/translating-tags.mdx Examples of how to format tag translations in JSON for RRV. ```json "tag.item.minecraft.beds": "Translation of the item tag 'minecraft:beds'" "tag.block.minecraft.mineable.pickaxe": "Translation of the block tag 'minecraft:mineable/pickaxe'" ``` -------------------------------- ### Alias definition in JSON Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/aliases.mdx Example of how to define aliases for items using a JSON file within a resource pack. ```json { "aliases": { "minecraft:enchanting_table": [ "enchantment table" ], "minecraft:crafting_table": [ "workbench" ] } } ``` -------------------------------- ### Binding Dependent Slots Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/client-recipes.mdx An example demonstrating how to bind dependent slots in a client recipe using `bindDependentSlot`. This is useful for synchronizing recipe outputs with inputs, such as in dye or decorated pot recipes. ```java @Override public void bindSlots(RecipeViewMenu.SlotFillContext slotFillContext) { //... slotFillContext.bindDependentSlot(0, this.input::index, this.input2); } ``` -------------------------------- ### Programmatic API Example Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/world-interaction-recipes.mdx Java code snippet demonstrating how to add a world interaction recipe programmatically using RRV's client integration. ```java ItemView.addClientReloadCallback(() -> { ItemView.addWorldInteractionRecipe(new WorldInteractionClientRecipe(Identifier.fromNamespaceAndPath("example-mod", "stone_axe"), SlotContent.of(Items.STONE), SlotContent.of(Items.WOODEN_AXE), SlotContent.of(Items.STONE_AXE))); }); ``` -------------------------------- ### Tag Exclusion Example Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/translating-tags.mdx Example of a JSON file to exclude block and item tags from user visibility in RRV. ```json { "type": "rrv:exclusions", "block": [ "minecraft:all_hanging_signs", ], "item": [ "minecraft:completes_find_tree_tutorial" ] } ``` -------------------------------- ### Resource Pack Index Modification Example Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/index-editing.mdx An example JSON structure for modifying the RRV index via a resource pack. This demonstrates replacing the index, adding items with 'after' and 'before' conditions, and removing items. ```json { "replace": true, "values": [ { "components": { "minecraft:stored_enchantments": { "minecraft:aqua_affinity": 1 } }, "count": 1, "id": "minecraft:enchanted_book" }, { "id": "minecraft:water", "after": "minecraft:grass_block" }, { "id": "minecraft:water", "before": "minecraft:grass_block" }, "minecraft:water", "minecraft:stone" ] } ``` -------------------------------- ### Chest Boats (Item Tags) - Language File Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/info-recipes.mdx Example JSON file for the English language translation of the chest boats info recipe. ```json { "rrv.info.chest_boats": "A boat in a chest!" } ``` -------------------------------- ### Cobblestone (Items) Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/world-interaction-recipes.mdx Example of a world interaction recipe using specific items for water and lava. ```json { "type": "rrv:world_interaction", "left": "minecraft:water", "right": "minecraft:lava", "result": "minecraft:cobblestone" } ``` -------------------------------- ### Chest Boats (Item Tags) Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/world-interaction-recipes.mdx Example of a world interaction recipe using item tags for chests and boats. ```json { "type": "rrv:world_interaction", "left": "#c:chests", "right": "#minecraft:boats", "result": "minecraft:oak_chest_boat" } ``` -------------------------------- ### Chest Boats (Item Tags) - Recipe File Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/info-recipes.mdx Example JSON file for an info recipe that uses an item tag to display information about chest boats. ```json { "type": "rrv:info", "key": "#minecraft:chest_boats", "text": "rrv.info.chest_boats" } ``` -------------------------------- ### Adding aliases via ItemView API Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/aliases.mdx Example of how to add aliases programmatically using the ItemView API in Java. ```java ItemView.addAlias(Items.EMERALD, "ruby"); ItemView.addAliases(Items.DIAMOND, List.of("ruby", "sapphire")); ``` -------------------------------- ### Iron Pickaxes (Item Stacks) Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/anvil-combining-recipes.mdx An example of an anvil combining recipe using item stacks, including custom components like damage. The recipe file should be named 'iron_pickaxe.json' and placed in 'assets//rrv/recipe'. ```json { "type": "rrv:anvil_combining", "left": "minecraft:stick", "right": "minecraft:iron_ingot", "result": { "id": "minecraft:iron_pickaxe", "components": { "minecraft:damage": 30 } } } ``` -------------------------------- ### Cobblestone (Items) Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/anvil-combining-recipes.mdx An example of an anvil combining recipe using specific items (water and lava) to produce cobblestone. The recipe file should be named 'cobblestone.json' and placed in 'assets//rrv/recipe'. ```json { "type": "rrv:anvil_combining", "left": "minecraft:water", "right": "minecraft:lava", "result": "minecraft:cobblestone" } ``` -------------------------------- ### Chest Boats (Item Tags) Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/anvil-combining-recipes.mdx An example of an anvil combining recipe using item tags for 'chests' and 'boats'. The recipe file should be named 'chest_boats.json' and placed in 'assets//rrv/recipe'. ```json { "type": "rrv:anvil_combining", "left": "#c:chests", "right": "#minecraft:boats", "result": "minecraft:oak_chest_boat" } ``` -------------------------------- ### Manually Position Recipe Share Button Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/CHANGELOG-LATEST.md Example of how to manually position the recipe sharing button by overriding a method in ReliableClientRecipeType. ```java public class MyReliableClientRecipeType extends ReliableClientRecipeType { @Override protected void placeRecipeShareButton() { // Custom positioning logic here super.placeRecipeShareButton(); } } ``` -------------------------------- ### Recipe Exclusion JSON Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/hiding-recipes.mdx An example JSON file to hide recipes from the Reliable Recipe Viewer. Recipes listed under their type ID will be hidden. ```json { "type": "rrv:exclusions", "minecraft:furnace_smelting": [ "minecraft:stone", "minecraft:deepslate" ] } ``` -------------------------------- ### SlotContent Usage Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/utilities.mdx Demonstrates how to create a SlotContent instance to represent item stacks for recipe content. ```java SlotContent.of(); ``` -------------------------------- ### Enabling Item Transfer and Mapping Slots Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/client-recipes.mdx This Java code demonstrates how to enable item transfer from the player's inventory to a workstation's GUI by overriding methods in a class that implements ReliableClientRecipe. It includes enabling the transfer, specifying the corresponding crafting screen, and linking recipe slots to inventory slots. ```java @Override public boolean supportsItemTransfer() { return true; // Enable item transfer } @Override public List>> getTransferClasses() { return List.of(UpgradingScreen.class); // Tell which screen is the corresponding crafting gui } @Override public void mapRecipeItems(RecipeTransferMap map) { //Link your recipe slots to the corresponding slots in the destination inventory (the crafting inventory) map.linkSlots(0, 1); map.linkSlots(1, 2); } ``` -------------------------------- ### Server Recipe Synchronization API Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/CHANGELOG.md Instructions for synchronizing vanilla recipes using Fabric and NeoForge APIs. ```java ServerRecipeManager.synchronizeRecipeType(your_recipe_serializer, your_recipe_type); ``` -------------------------------- ### Registering Keybinds API Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/CHANGELOG.md API for registering keybinds when hovering over item slots. ```java thanks @Fox2Code ``` -------------------------------- ### Adding Stack-Sensitive Items Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/utilities.mdx Shows how to add custom item stacks as stack-sensitives to the index using a reload callback. ```java ItemView.addStackSensitive() ItemView.addReloadCallback() ``` -------------------------------- ### Programmatic Info Recipe Addition Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/modpacks/info-recipes.mdx Java code snippet demonstrating how to add info recipes programmatically via a mod's client integration. ```java ItemView.addClientReloadCallback(() -> { ItemView.addInfoRecipe(new InfoClientRecipe(Identifier.fromNamespaceAndPath("example-mod", "stone"), SlotContent.of(Items.STONE), "Stone can be found underground.")); ItemView.addInfoRecipe(new InfoClientRecipe(Identifier.fromNamespaceAndPath("example-mod", "stone"), SlotContent.of(Items.STONE), Component.translatable("rrv.info.stone"))); }); ``` -------------------------------- ### Client Recipe Provider API Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/CHANGELOG.md Adding a list of client recipes directly using ItemView. ```java ItemView.addClientRecipeProvider(your_provider); ``` -------------------------------- ### Client Recipe Retrieval Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/CHANGELOG.md How to retrieve synchronized recipes on the client side. ```java ClientRecipeManager.getRecipesForType(your_recipe_type); ``` -------------------------------- ### Excluding Items from Index Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/utilities.mdx Illustrates how to exclude specific items from the index using ItemView.excludeItem(). ```java ItemView.excludeItem() ``` -------------------------------- ### Maven Dependency Configuration Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/docs/mods/depending-on-rrv.mdx This snippet shows how to add the Reliable Recipe Viewer (RRV) as a dependency in a Maven project using Kotlin DSL. It includes repository configuration and specific dependency declarations for different Minecraft versions and mod loaders (Fabric and NeoForge). ```kotlin repositories { exclusiveContent { forRepository { maven { name = "Cassian's Maven" url = uri("https://maven.cassian.cc") } } filter { includeGroupAndSubgroups("cc.cassian") } } } dependencies { // Fabric (1.21.11 and below) modImplementation("cc.cassian.rrv:reliable-recipe-viewer-fabric:${rrv_version}+${minecraft_version}") // Fabric (26.1 and above) implementation("cc.cassian.rrv:reliable-recipe-viewer-fabric:${rrv_version}+${minecraft_version}") // NeoForge implementation("cc.cassian.rrv:reliable-recipe-viewer-neoforge:${rrv_version}+${minecraft_version}") } ``` -------------------------------- ### Client Recipe ID Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/CHANGELOG.md Overriding ClientRecipe#getId to provide a valid Identifier. ```java ClientRecipe#getId ``` -------------------------------- ### Excluding Client Recipes Source: https://github.com/cassiancc/reliablerecipeviewer/blob/rrv/CHANGELOG.md Hiding client recipes by their ID using a resource pack or API method. ```java rrv:exclusions ``` ```java ItemView#excludeRecipe ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.