tutorial:recipe_type
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:recipe_type [2021/08/29 18:18] – fixed missing bracket banana | tutorial:recipe_type [2026/04/11 19:44] (current) – Docs redirect cassiancc | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ~~REDIRECT> | ||
| + | |||
| ====== Creating a Custom Recipe Type ====== | ====== Creating a Custom Recipe Type ====== | ||
| 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! | ||
| Line 12: | Line 14: | ||
| public class TestRecipeBlock extends Block { | public class TestRecipeBlock extends Block { | ||
| private static final Text TITLE = new TranslatableText(" | private static final Text TITLE = new TranslatableText(" | ||
| - | public | + | public |
| super(settings); | super(settings); | ||
| } | } | ||
| Line 102: | Line 104: | ||
| public ItemStack craft(CraftingInventory inv) { | public ItemStack craft(CraftingInventory inv) { | ||
| return this.getOutput().copy(); | return this.getOutput().copy(); | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public boolean fits(int width, int height) { | ||
| + | return true; | ||
| } | } | ||
| } | } | ||
| Line 113: | Line 120: | ||
| @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.size(0) < 2) return false; |
| - | return inputA.test(inventory.getInvStack(0)) && inputB.test(inventory.getInvStack(1)); | + | return inputA.test(inventory.getStack(0)) && inputB.test(inventory.getStack(1)); |
| } | } | ||
| } | } | ||
| Line 124: | Line 131: | ||
| public class TestRecipe implements Recipe< | public class TestRecipe implements Recipe< | ||
| //[...] | //[...] | ||
| - | public static Type implements RecipeType< | + | public static |
| private Type() {} | private Type() {} | ||
| public static final Type INSTANCE = new Type(); | public static final Type INSTANCE = new Type(); | ||
| Line 136: | Line 143: | ||
| </ | </ | ||
| + | What's still missing is the RecipeSerializer, | ||
| SOURCE: | SOURCE: | ||
| [[https:// | [[https:// | ||
tutorial/recipe_type.1630261129.txt.gz · Last modified: 2021/08/29 18:18 by banana