NiKiT0$iK67RUS написал(а):
timaxa007 написал(а):
setDamage - у предмета это повреждаемость самого предмета, а не урон от предмета.
Урон может браться из материала предмета и используется в методе getItemAttributeModifiers() добавляя модификатор урона.
Скорость через метод func_150893_a(ItemStack p_150893_1_, Block p_150893_2_).
Пример можешь посмотреть в мече.
я понял делать так
package ru.SNiWS.TESTS;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
public class BestPickAxe extends ItemPickaxe {
protected BestPickAxe() {
super(ToolMaterial.EMERALD);
this.setCreativeTab(CreativeTabs.tabTools);
this.setTextureName("mybestmod:BestPickAxe");
this.canRepair = true;
this.getItemAttributeModifiers( );
public static void func_150893_a(ItemStack p_150893_1_, BestPickAxe p_150893_2_);
}
}
но начальника ругается, а что писать в this.getItemAttributeModifiers( ) так и не понял, может статейку с эти добром подскажешь какую ?
когда было так работало
public class BestPickAxe extends ItemPickaxe {
protected BestPickAxe() {
super(ToolMaterial.EMERALD);
this.setCreativeTab(CreativeTabs.tabTools);
this.setTextureName("mybestmod:BestPickAxe");
this.canRepair = true;
}
}
Немного подправил код.(Но ты уж учи Жабу - Java)
public class BestPickAxe extends ItemPickaxe {
private float weaponDamage;
//Ты не указал версию, так что хз
protected BestPickAxe(float damage) {
super(ToolMaterial.EMERALD);
this.setCreativeTab(CreativeTabs.tabTools);
this.setTextureName("mybestmod:BestPickAxe");
this.canRepair = true;
this.weaponDamage = damage;
}
public Multimap getItemAttributeModifiers()
{
Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.weaponDamage, 0));
return multimap;
}
}