Fixes 1405, though that error should only happen if you fire something insanely far away from the spawn or idk (Causing some X co-ordinate to be infinity)

This commit is contained in:
Gunging 2021-04-09 01:52:59 -05:00
parent cdda1b6179
commit 5eeaba43c7
2 changed files with 15 additions and 7 deletions

View File

@ -10,6 +10,7 @@ import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
import net.Indyuce.mmoitems.api.player.PlayerData;
import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.stat.Enchants;
import net.Indyuce.mmoitems.stat.GemUpgradeScaling;
import net.Indyuce.mmoitems.stat.data.GemSocketsData;
import net.Indyuce.mmoitems.stat.data.GemstoneData;
@ -81,6 +82,11 @@ public class GemStone extends UseItem {
if (called.isCancelled())
return new ApplyResult(ResultType.NONE);
/*
* To not clear enchantments put by players
*/
Enchants.separateEnchantments(targetMMO);
/*
* Gem stone can be successfully applied. apply stats then abilities and
* permanent effects. also REGISTER gem stone in the item gem stone

View File

@ -72,12 +72,14 @@ public class Staff extends UntargetedWeapon {
return;
double power = MMOItems.plugin.getConfig().getDouble("item-ability.staff.power");
Vector vec = target.getLocation().toVector().subtract(getPlayer().getLocation().toVector()).setY(0).normalize().multiply(1.75 * power)
.setY(.65 * power);
target.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation().add(0, 1, 0), 0);
target.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, target.getLocation().add(0, 1, 0), 16, 0, 0, 0, .1);
target.setVelocity(vec);
target.playEffect(EntityEffect.HURT);
target.getWorld().playSound(target.getLocation(), Sound.BLOCK_ANVIL_LAND, 1, 2);
try {
Vector vec = target.getLocation().toVector().subtract(getPlayer().getLocation().toVector()).setY(0).normalize().multiply(1.75 * power).setY(.65 * power);
target.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation().add(0, 1, 0), 0);
target.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, target.getLocation().add(0, 1, 0), 16, 0, 0, 0, .1);
target.setVelocity(vec);
target.playEffect(EntityEffect.HURT);
target.getWorld().playSound(target.getLocation(), Sound.BLOCK_ANVIL_LAND, 1, 2);
} catch (IllegalArgumentException ignored) {}
}
}