Add ItemStack context to Enchantment#getDamageBonus (#8635)

This commit is contained in:
Take Weiland authored and GitHub committed 2022-06-01 09:19:18 -07:00
1 parent 03c43cf3da
commit 4285c931e7
3 files changed
+49 -1

No files matched your search

@@ -0,0 +1,31 @@
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.common.extensions;
import net.minecraft.world.entity.MobType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
public interface IForgeEnchantment
{
private Enchantment self()
{
return (Enchantment) this;
}
/**
* ItemStack aware version of {@link Enchantment#getDamageBonus(int, MobType)}
* @param level the level of the enchantment
* @param mobType the mob type being attacked
* @param enchantedItem the item used for the attack
* @return the damage bonus
*/
@SuppressWarnings("deprecation")
default float getDamageBonus(int level, MobType mobType, ItemStack enchantedItem)
{
return self().getDamageBonus(level, mobType);
}
}