tutorial:recipe_type
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorial:recipe_type [2021/02/16 06:30] – created themovieayt | tutorial:recipe_type [2021/12/01 11:46] (current) – added commentary that RecipeSerializer is missing ayutac | ||
---|---|---|---|
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: | ||
===== Adding the Block ===== | ===== Adding the Block ===== | ||
Line 9: | Line 12: | ||
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 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<?> | + | |
- | return null; | + | |
- | } | + | |
- | + | ||
- | @Override | + | |
- | public RecipeType<?> | + | |
- | return null; | + | |
- | } | + | |
} | } | ||
</ | </ | ||
Line 123: | Line 102: | ||
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 134: | Line 118: | ||
@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 145: | Line 129: | ||
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(); | ||
public static final String ID = " | public static final String ID = " | ||
+ | } | ||
+ | @Override | ||
+ | pubilc RecipeType<?> | ||
+ | return Type.INSTANCE; | ||
} | } | ||
} | } | ||
</ | </ | ||
+ | |||
+ | What's still missing is the RecipeSerializer, | ||
+ | |||
SOURCE: | SOURCE: | ||
[[https:// | [[https:// | ||
tutorial/recipe_type.1613457031.txt.gz · Last modified: 2021/02/16 06:30 by themovieayt