注册撬棍属性
This commit is contained in:
parent
ab886e10cd
commit
e9dfd5fa22
1 changed files with 37 additions and 34 deletions
|
@ -20,37 +20,40 @@ import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Crowbar extends SwordItem {
|
public class Crowbar extends SwordItem {
|
||||||
|
|
||||||
|
public static final Tier TIER = new Tier() {
|
||||||
|
public int getUses() {
|
||||||
|
return 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getSpeed() {
|
||||||
|
return 4f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAttackDamageBonus() {
|
||||||
|
return 3.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull TagKey<Block> getIncorrectBlocksForDrops() {
|
||||||
|
return BlockTags.INCORRECT_FOR_IRON_TOOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEnchantmentValue() {
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NotNull Ingredient getRepairIngredient() {
|
||||||
|
return Ingredient.of(new ItemStack(Items.IRON_INGOT));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public Crowbar() {
|
public Crowbar() {
|
||||||
super(new Tier() {
|
super(TIER, new Properties().stacksTo(1).attributes(SwordItem.createAttributes(TIER, 2, -2f)));
|
||||||
public int getUses() {
|
|
||||||
return 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getSpeed() {
|
|
||||||
return 4f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getAttackDamageBonus() {
|
|
||||||
return 3.5f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull TagKey<Block> getIncorrectBlocksForDrops() {
|
|
||||||
return BlockTags.INCORRECT_FOR_IRON_TOOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLevel() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEnchantmentValue() {
|
|
||||||
return 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull Ingredient getRepairIngredient() {
|
|
||||||
return Ingredient.of(new ItemStack(Items.IRON_INGOT));
|
|
||||||
}
|
|
||||||
}, new Properties());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,12 +63,12 @@ public class Crowbar extends SwordItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ItemStack getCraftingRemainingItem(ItemStack itemstack) {
|
public @NotNull ItemStack getCraftingRemainingItem(ItemStack itemstack) {
|
||||||
ItemStack retval = new ItemStack(this);
|
ItemStack stack = new ItemStack(this);
|
||||||
retval.setDamageValue(itemstack.getDamageValue() + 1);
|
stack.setDamageValue(itemstack.getDamageValue() + 1);
|
||||||
if (retval.getDamageValue() >= retval.getMaxDamage()) {
|
if (stack.getDamageValue() >= stack.getMaxDamage()) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
return retval;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue