ConstructionWand/src/main/java/thetadev/constructionwand/items/wand/ItemWandBasic.java
Mrbysco fc20293906 Port to 1.18.2
Convert item registering to DeferredRegister as vanilla freezes the registry which instantiating them outside of the RegistryEvent or DeferredRegister will result in an error.
2022-03-15 03:15:54 +01:00

32 lines
893 B
Java

package thetadev.constructionwand.items.wand;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Tier;
import thetadev.constructionwand.basics.ConfigServer;
import javax.annotation.Nonnull;
public class ItemWandBasic extends ItemWand
{
private final Tier tier;
public ItemWandBasic(Properties properties, Tier tier) {
super(properties.durability(tier.getUses()));
this.tier = tier;
}
@Override
public int getMaxDamage(ItemStack stack) {
return ConfigServer.getWandProperties(this).getDurability();
}
@Override
public int remainingDurability(ItemStack stack) {
return stack.getMaxDamage() - stack.getDamageValue();
}
@Override
public boolean isValidRepairItem(@Nonnull ItemStack toRepair, @Nonnull ItemStack repair) {
return this.tier.getRepairIngredient().test(repair);
}
}