User Tools

Site Tools


tutorial:recipe_type

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:recipe_type [2021/02/16 06:30] – created themovieayttutorial:recipe_type [2021/08/29 18:18] – fixed missing bracket banana
Line 2: Line 2:
 In this page, we will create our own custom recipe type, including the shapeless version! In this page, we will create our own custom recipe type, including the shapeless version!
 We won't use any vanilla Minecraft classes, it will be a fully custom recipe type. We won't use any vanilla Minecraft classes, it will be a fully custom recipe type.
 +
 +You can find and learn how to make other recipe types.
 +[[tutorial:cooking_recipe_type|Creating a custom cooking recipe type]]
  
 ===== Adding the Block ===== ===== Adding the Block =====
Line 40: Line 43:
  @Override  @Override
  public void onInitialize() {    public void onInitialize() {  
-    //Wait i gotta take a break hold on..+    // Resuming later...
     }     }
 } }
Line 87: Line 90:
  return this.id;  return this.id;
  }  }
- + //[...]
- @Override +
- public boolean matches(CraftingInventory inv, World world) { +
- return false; +
-+
- +
- @Override +
- public ItemStack craft(CraftingInventory inv) { +
- return null; +
-+
- +
- @Override +
- public boolean fits(int width, int height) { +
- return false; +
-+
- +
- @Override +
- public RecipeSerializer<?> getSerializer() { +
- return null; +
-+
- +
- @Override +
- public RecipeType<?> getType() { +
- return null; +
- }+
 } }
 </code> </code>
Line 134: Line 113:
  @Override   @Override 
  public boolean matches(CraftingInventory inv, World world) {  public boolean matches(CraftingInventory inv, World world) {
- if(inv.getInvSize(0 < 2) return false;+ if(inv.getInvSize(0< 2) return false;
  return inputA.test(inventory.getInvStack(0)) && inputB.test(inventory.getInvStack(1));  return inputA.test(inventory.getInvStack(0)) && inputB.test(inventory.getInvStack(1));
  }  }
Line 149: Line 128:
  public static final Type INSTANCE = new Type();  public static final Type INSTANCE = new Type();
  public static final String ID = "test_recipe";  public static final String ID = "test_recipe";
 + }
 + @Override
 + pubilc RecipeType<?> getType() {
 + return Type.INSTANCE;
  }  }
 } }
 </code> </code>
 +
 +
 SOURCE: SOURCE:
 [[https://github.com/natanfudge/fabric-docs/blob/master/newdocs/Modding-Tutorials/Crafting-Recipes/defining-custom-crafting-recipes.md|Defining Custom Crafting Recipes]] [[https://github.com/natanfudge/fabric-docs/blob/master/newdocs/Modding-Tutorials/Crafting-Recipes/defining-custom-crafting-recipes.md|Defining Custom Crafting Recipes]]
  
tutorial/recipe_type.txt · Last modified: 2021/12/01 11:46 by ayutac