- 93
- 0
У меня небольшая проблема, я создал предмет у которого при крафте должно отниматься 1 прочность и сам рецепт. Вроди бы всё правильно крафт не работает.
Предмет
И крафт
Предмет
Код:
public class WoodenHammer extends Item {
public WoodenHammer(){
this.setUnlocalizedName("WoodenHammer");
this.setCreativeTab(Main.tabSP);
this.setTextureName("sp" + ":WoodenHammer");
this.setMaxStackSize(1);
this.setContainerItem(this);
this.setNoRepair();
this.setMaxDamage(10);
}
public ItemStack getContainerItem(ItemStack is) {
if (is.getItemDamage() >= 0) {
is.setItemDamage(is.getItemDamage() + 1);
return is;
}
return super.getContainerItem(is);
}
}
Код:
@EventHandler
public void init(FMLPreInitializationEvent event){
//Рецепты верстак
GameRegistry.addShapelessRecipe(new ItemStack(Main.CompressedCobblestone, 1),
new Object[] {new ItemStack(Main.WoodenHammer, 1, OreDictionary.WILDCARD_VALUE),
Blocks.cobblestone,Blocks.cobblestone,Blocks.cobblestone,Blocks.cobblestone});
}