BaseMetals icon indicating copy to clipboard operation
BaseMetals copied to clipboard

Supporting NBT in Custom hammer Recipes (Thanks to RacerDelux of MMD)

Open jriwanek opened this issue 8 years ago • 5 comments

[2:53 PM] RacerDelux: ok so you have to make your own ShapedOreRecipe [2:53 PM] RacerDelux: and implement thse methods [2:53 PM] RacerDelux: public class MPBRecipe extends ShapedOreRecipe{

public MPBRecipe(Block result, Object... recipe){super(result, recipe); } public MPBRecipe(Item result, Object... recipe){ super(result, recipe); } public MPBRecipe(ItemStack result, Object... recipe){ super(result, recipe); }

@Override public ItemStack getCraftingResult(InventoryCrafting craftMatrix) {

[2:53 PM] RacerDelux: thats an example from mine [2:53 PM] RacerDelux: in the getcraftingresult [2:54 PM] RacerDelux: you can get the stack of items that were in the table [2:54 PM] RacerDelux: then you do [2:54 PM] RacerDelux: tmp.setTagCompound(new NBTTagCompound()); tmp.getTagCompound().setString("test", "I am a new item!"); [2:54 PM] RacerDelux: where tmp is a new itemstack [2:55 PM] RacerDelux: and then at the end of getcraftingresult [2:55 PM] RacerDelux: you just return tmp [2:55 PM] RacerDelux: or whatever you call the itemstack

jriwanek avatar Feb 10 '17 09:02 jriwanek