Skip to content

Commit

Permalink
Propelling: Tweak velocity calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo56958 committed Dec 11, 2024
1 parent fff1ce2 commit c105464
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,15 @@ public void onElytraSneak(final PlayerToggleSneakEvent event) {

final int level = modManager.getModLevel(elytra, this);
final Location loc = player.getLocation();
final Vector dir = loc.getDirection().normalize();
final Vector dir = loc.getDirection().normalize().multiply(1 + speedPerLevel * level);

if (dir.dot(player.getVelocity()) <= 0) {
player.setVelocity(dir);
} else {
player.setVelocity(player.getVelocity().add(dir));
}


player.setVelocity(dir.multiply(1 + speedPerLevel * level).add(player.getVelocity().multiply(0.1f)));

if (particles && loc.getWorld() != null)
loc.getWorld().spawnParticle(Particle.CLOUD, loc, 30, 0.5F, 0.5F, 0.5F, 0.0F);
Expand Down

0 comments on commit c105464

Please sign in to comment.