ModItemTier Enum

mail@pastecode.io avatar
unknown
plain_text
2 years ago
3.4 kB
8
Indexable
Never
public enum ModItemTier implements IItemTier {

    //Tier 0 - Wooden [0, 59, 2.0F, 0.0F, 15].
    BONE (0.7F, 0, 59, 2.0F, 1.0F, 15, ()-> Ingredient.fromItems(Items.BONE)),
    FLINT (0.85F, 0, 59, 2.0F, 1.0F, 15, ()-> Ingredient.fromItems(Items.FLINT)),
    
    //Tier 1 - Stone [1, 131, 4.0F, 1.0F, 5]
    TIN (0.7F, 1, 131, 4.0F, 2.0F, 10, ()-> Ingredient.fromItems(ModItems.TIN_INGOT.get())),
    LEAD (0.8F, 1, 131, 4.0F, 2.0F, 10, ()-> Ingredient.fromItems(ModItems.LEAD_INGOT.get())),
    ZINC (0.9F, 1, 131, 4.0F, 2.0F, 10, ()-> Ingredient.fromItems(ModItems.ZINC_INGOT.get())),
    SILVER (1.1F, 1, 131, 4.0F, 2.0F, 10, ()-> Ingredient.fromItems(ModItems.SILVER_INGOT.get())),
    ALUMINUM (1.2F, 1, 131, 4.0F, 2.0F, 10, ()-> Ingredient.fromItems(ModItems.ALUMINUM_INGOT.get())),
    
    //Tier 2 - Iron [2, 250, 6.0F, 2.0F, 14].
    COPPER (0.775F, 2, 250, 6.0F, 3.0F, 5, ()-> Ingredient.fromItems(ModItems.COPPER_INGOT.get())),
    NICKEL (0.850F, 2, 250, 6.0F, 3.0F, 5, ()-> Ingredient.fromItems(ModItems.NICKEL_INGOT.get())),
    PLATINUM (0.925F, 2, 250, 6.0F, 3.0F, 5, ()-> Ingredient.fromItems(ModItems.PLATINUM_INGOT.get())),
    BRASS (1.075F, 2, 250, 6.0F, 3.0F, 5, ()-> Ingredient.fromItems(ModItems.BRASS_INGOT.get())),
    BRONZE (1.15F, 2, 250, 6.0F, 3.0F, 5, ()-> Ingredient.fromItems(ModItems.BRONZE_INGOT.get())),
    
    //Tier 3 - Diamond [3, 1561, 8.0F, 3.0F, 10]
    OSMIUM (0.85F, 3, 1561, 8.0F, 4.0F, 10, ()-> Ingredient.fromItems(ModItems.OSMIUM_INGOT.get())),
    COBALT (0.925F, 3, 1561, 8.0F, 4.0F, 10, ()-> Ingredient.fromItems(ModItems.COBALT_INGOT.get())),
    TUNGSTEN (1.075F, 3, 1561, 8.0F, 4.0F, 10, ()-> Ingredient.fromItems(ModItems.TUNGSTEN_INGOT.get())),
    STEEL (1.15F, 3, 1561, 8.0F, 4.0F, 10, ()-> Ingredient.fromItems(ModItems.STEEL_INGOT.get())),
    REINFORCED_STEEL (1.225F, 3, 1561, 8.0F, 4.0F, 10, ()-> Ingredient.fromItems(ModItems.REINFORCED_STEEL_INGOT.get())),
    
    //Tier 4 - Netherite [4, 2031, 9.0F, 4.0F, 15]
    TITANIUM (0.9F, 4, 2031, 9.0F, 5.0F, 15, ()-> Ingredient.fromItems(ModItems.TITANIUM_INGOT.get())),
    CHROMIUM (1.1F, 4, 2031, 9.0F, 5.0F, 15, ()-> Ingredient.fromItems(ModItems.CHROMIUM_INGOT.get()));

    private final int harvestLevel;
    private final int maxUses;
    private final float efficiency;
    private final float attackDamage;
    private final int enchantability;
    private final LazyValue<Ingredient> repairMaterial;

    private ModItemTier(float materialHardness, int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Supplier<Ingredient> repairMaterialIn) {
        this.harvestLevel = harvestLevelIn;
        this.maxUses = (int) (maxUsesIn*materialHardness);
        this.efficiency = efficiencyIn*materialHardness;
        this.attackDamage = attackDamageIn*materialHardness;
        this.enchantability = (int) (enchantabilityIn*materialHardness);
        this.repairMaterial = new LazyValue<>(repairMaterialIn);
    }
    
    public int getMaxUses() {return this.maxUses;}
    public float getEfficiency() {return this.efficiency;}
    public float getAttackDamage() {return this.attackDamage;}
    public int getHarvestLevel() {return this.harvestLevel;}
    public int getEnchantability() {return this.enchantability;}
    public Ingredient getRepairMaterial() {return this.repairMaterial.getValue();}
}