Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.magistuarmory.item.ModItemTier Maven / Gradle / Ivy
package com.magistuarmory.item;
import dev.architectury.platform.Platform;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.crafting.Ingredient;
import java.util.function.Supplier;
public class ModItemTier implements Tier
{
private final String name;
private final float attackDamageBonus;
private final int enchantmentValue;
private final int level;
private final Supplier repairIngredient;
private final float speed;
private final int uses;
private final float density;
public static ModItemTier WOOD = new ModItemTier("wood", Tiers.WOOD, 0);
public static ModItemTier STONE = new ModItemTier("stone", Tiers.STONE, 1);
public static ModItemTier IRON = new ModItemTier("iron", Tiers.IRON, 2);
public static ModItemTier DIAMOND = new ModItemTier("diamond", Tiers.DIAMOND, 3);
public static ModItemTier GOLD = new ModItemTier("gold", Tiers.GOLD, 4);
public static ModItemTier NETHERITE = new ModItemTier("netherite", Tiers.NETHERITE, 5);
public static ModItemTier COPPER = new ModItemTier("copper", 1, 150, 0.7F, 0.0F, 10, Platform.isForge() ? "forge:ingots/copper" : "c:copper_ingots", 1);
public static ModItemTier SILVER = new ModItemTier("silver", 2, 230, 5.5F, 1.0F, 18, Platform.isForge() ? "forge:ingots/silver" : "c:silver_ingots", 2);
public static ModItemTier STEEL = new ModItemTier("steel", 2, 400, 6.0F, 2.5F, 14, Platform.isForge() ? "forge:ingots/steel" : "c:steel_ingots", 2);
public static ModItemTier TIN = new ModItemTier("tin", 2, 130, 6.0F, 0.0F, 20, Platform.isForge() ? "forge:ingots/tin" : "c:tin_ingots", 2);
public static ModItemTier BRONZE = new ModItemTier("bronze", 2, 200, 6.0F, 2.0F, 15, Platform.isForge() ? "forge:ingots/bronze" : "c:bronze_ingots", 2);
public ModItemTier(String name, Tier tier, float density)
{
this.name = name;
this.level = tier.m_6604_();
this.uses = tier.m_6609_();
this.speed = tier.m_6624_();
this.attackDamageBonus = tier.m_6631_();
this.enchantmentValue = tier.m_6601_();
this.repairIngredient = tier::m_6282_;
this.density = density;
}
public ModItemTier(String name, int level, int uses, float speed, float attack, int enchantment, String repairitemtag, float density)
{
this.name = name;
this.level = level;
this.uses = uses;
this.speed = speed;
this.attackDamageBonus = attack;
this.enchantmentValue = enchantment;
this.repairIngredient = () -> Ingredient.m_204132_(TagKey.m_203882_(Registry.f_122904_, new ResourceLocation(repairitemtag)));
this.density = density;
}
@Override
public float m_6631_()
{
return attackDamageBonus;
}
@Override
public int m_6601_()
{
return enchantmentValue;
}
@Override
public int m_6604_()
{
return level;
}
@Override
public Ingredient m_6282_()
{
return repairIngredient.get();
}
@Override
public float m_6624_()
{
return speed;
}
@Override
public int m_6609_()
{
return uses;
}
public String getMaterialName()
{
return name;
}
public float getDensity()
{
return density;
}
}