Fixed MI bows dealing 3x damage in 1.21

This commit is contained in:
Jules 2024-07-31 14:42:17 -07:00
parent bd75a6883a
commit e97e7a6ccd
2 changed files with 10 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import net.Indyuce.mmoitems.api.interaction.projectile.ArrowParticles;
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
import net.Indyuce.mmoitems.api.player.PlayerData;
import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
@ -247,7 +248,7 @@ public class ItemUse implements Listener {
final ProjectileMetadata proj = ProjectileMetadata.create(playerData.getMMOPlayerData(), bowSlot, ProjectileType.ARROW, event.getProjectile());
proj.setSourceItem(item);
proj.setCustomDamage(true);
proj.setDamageMultiplier(event.getForce());
proj.setDamageMultiplier(MMOUtils.getForce(event));
if (item.hasTag("MMOITEMS_ARROW_PARTICLES"))
new ArrowParticles((AbstractArrow) event.getProjectile(), item);
final AbstractArrow arrow = (AbstractArrow) event.getProjectile();

View File

@ -7,6 +7,7 @@ import io.lumine.mythic.lib.api.item.ItemTag;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
import io.lumine.mythic.lib.skill.trigger.TriggerType;
import io.lumine.mythic.lib.util.annotation.BackwardsCompatibility;
import io.lumine.mythic.lib.version.VPotionEffectType;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.Type;
@ -18,6 +19,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
@ -36,6 +38,12 @@ public class MMOUtils {
return particle.getDataType() == Particle.DustOptions.class;
}
@BackwardsCompatibility(version = "1.21")
public static double getForce(@NotNull EntityShootBowEvent event) {
final double force = event.getForce();
return MythicLib.plugin.getVersion().isUnder(1, 21) ? force : force / 3;
}
/**
* Optimized Soulbound check based on the fact that the
* compressed item Soulbound data contains only one UUID,