minecraft-src/net/minecraft/world/item/Tiers.java
2025-07-04 01:41:11 +03:00

71 lines
2.1 KiB
Java

package net.minecraft.world.item;
import com.google.common.base.Suppliers;
import java.util.function.Supplier;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.block.Block;
public enum Tiers implements Tier {
WOOD(BlockTags.INCORRECT_FOR_WOODEN_TOOL, 59, 2.0F, 0.0F, 15, () -> Ingredient.of(ItemTags.PLANKS)),
STONE(BlockTags.INCORRECT_FOR_STONE_TOOL, 131, 4.0F, 1.0F, 5, () -> Ingredient.of(ItemTags.STONE_TOOL_MATERIALS)),
IRON(BlockTags.INCORRECT_FOR_IRON_TOOL, 250, 6.0F, 2.0F, 14, () -> Ingredient.of(Items.IRON_INGOT)),
DIAMOND(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 1561, 8.0F, 3.0F, 10, () -> Ingredient.of(Items.DIAMOND)),
GOLD(BlockTags.INCORRECT_FOR_GOLD_TOOL, 32, 12.0F, 0.0F, 22, () -> Ingredient.of(Items.GOLD_INGOT)),
NETHERITE(BlockTags.INCORRECT_FOR_NETHERITE_TOOL, 2031, 9.0F, 4.0F, 15, () -> Ingredient.of(Items.NETHERITE_INGOT));
private final TagKey<Block> incorrectBlocksForDrops;
private final int uses;
private final float speed;
private final float damage;
private final int enchantmentValue;
private final Supplier<Ingredient> repairIngredient;
private Tiers(
final TagKey<Block> incorrectBlockForDrops,
final int uses,
final float speed,
final float damage,
final int enchantmentValue,
final Supplier<Ingredient> repairIngredient
) {
this.incorrectBlocksForDrops = incorrectBlockForDrops;
this.uses = uses;
this.speed = speed;
this.damage = damage;
this.enchantmentValue = enchantmentValue;
this.repairIngredient = Suppliers.memoize(repairIngredient::get);
}
@Override
public int getUses() {
return this.uses;
}
@Override
public float getSpeed() {
return this.speed;
}
@Override
public float getAttackDamageBonus() {
return this.damage;
}
@Override
public TagKey<Block> getIncorrectBlocksForDrops() {
return this.incorrectBlocksForDrops;
}
@Override
public int getEnchantmentValue() {
return this.enchantmentValue;
}
@Override
public Ingredient getRepairIngredient() {
return (Ingredient)this.repairIngredient.get();
}
}