修复武器属性

This commit is contained in:
17146 2025-04-08 22:53:20 +08:00
parent 5c62b01b6c
commit 2a706e94d3
2 changed files with 65 additions and 60 deletions

View file

@ -17,37 +17,39 @@ import org.jetbrains.annotations.NotNull;
@EventBusSubscriber(bus = EventBusSubscriber.Bus.GAME) @EventBusSubscriber(bus = EventBusSubscriber.Bus.GAME)
public class Hammer extends SwordItem { public class Hammer extends SwordItem {
public static final Tier TIER = new Tier() {
public int getUses() {
return 400;
}
public float getSpeed() {
return 4f;
}
public float getAttackDamageBonus() {
return 8f;
}
@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 Hammer() { public Hammer() {
super(new Tier() { super(TIER, new Properties().attributes(SwordItem.createAttributes(TIER, 3, -3.2f)).stacksTo(1));
public int getUses() {
return 400;
}
public float getSpeed() {
return 4f;
}
public float getAttackDamageBonus() {
return 8f;
}
@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

View file

@ -11,36 +11,39 @@ import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class Knife extends SwordItem { public class Knife extends SwordItem {
private static final Tier TIER = new Tier() {
public int getUses() {
return 1500;
}
public float getSpeed() {
return 7f;
}
public float getAttackDamageBonus() {
return 2.5f;
}
@Override
public @NotNull TagKey<Block> getIncorrectBlocksForDrops() {
return BlockTags.INCORRECT_FOR_IRON_TOOL;
}
public int getLevel() {
return 2;
}
public int getEnchantmentValue() {
return 2;
}
public @NotNull Ingredient getRepairIngredient() {
return Ingredient.of(new ItemStack(ModItems.STEEL_INGOT.get()));
}
};
public Knife() { public Knife() {
super(new Tier() { super(TIER, new Properties().attributes(SwordItem.createAttributes(TIER, 3, -1.8f)).stacksTo(1));
public int getUses() {
return 1500;
}
public float getSpeed() {
return 7f;
}
public float getAttackDamageBonus() {
return 2.5f;
}
@Override
public @NotNull TagKey<Block> getIncorrectBlocksForDrops() {
return BlockTags.INCORRECT_FOR_IRON_TOOL;
}
public int getLevel() {
return 2;
}
public int getEnchantmentValue() {
return 2;
}
public @NotNull Ingredient getRepairIngredient() {
return Ingredient.of(new ItemStack(ModItems.STEEL_INGOT.get()));
}
}, new Properties());
} }
} }