Skip to content

Commit

Permalink
fix: Fix incorrect projective velocity
Browse files Browse the repository at this point in the history
misc: 一些调整
  • Loading branch information
MATRIX-feather committed Jan 29, 2024
1 parent ddc1745 commit c8af611
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/main/java/xiamomc/morph/skills/MorphSkill.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected <E extends Entity> E launchProjectile(Player player, EntityType fireba
try
{
fireBall = player.getWorld()
.spawnEntity(player.getEyeLocation(), fireball, CreatureSpawnEvent.SpawnReason.DEFAULT);
.spawnEntity(player.getEyeLocation(), fireball, CreatureSpawnEvent.SpawnReason.CUSTOM);
}
catch (Throwable t)
{
Expand All @@ -81,7 +81,12 @@ protected <E extends Entity> E launchProjectile(Player player, EntityType fireba
if (fireBall instanceof Projectile projectile)
projectile.setShooter(player);

fireBall.setVelocity(player.getEyeLocation().getDirection().normalize().multiply(1.4d * multiplier));
//It works for all previous MC versions, then starting from 1.20.3 we need to multiply 0.1 ...
//... right before we do any other things.
//
//Why?
var velocity = player.getEyeLocation().getDirection().normalize().multiply(0.1d);
fireBall.setVelocity(velocity.multiply(multiplier));

return (E) fireBall;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ protected void executeDelayedSkill(Player player, DisguiseState state, SkillAbil
//region 发射后...

if (entity instanceof ShulkerBullet bullet)
{
bullet.setTarget(target);
bullet.setShooter(player);
}

if (entity instanceof WitherSkull skull)
{
Expand Down

0 comments on commit c8af611

Please sign in to comment.