Skip to content

Commit

Permalink
Merge pull request #14 from Erdragh/fix/hover-issue-13
Browse files Browse the repository at this point in the history
Fix sneak+jump ascending in hover mode
  • Loading branch information
Erdragh authored Oct 11, 2023
2 parents 655997c + 737e33f commit 364f623
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
Expand Down Expand Up @@ -68,20 +67,22 @@ public void appendTooltip(ItemStack stack, net.minecraft.world.World world, List

@Override
public void hover(PlayerEntity player, ItemStack stack) {
if (ModKeyBindings.jumpKeyDown(player)) {
var up = ModKeyBindings.jumpKeyDown(player) && !player.isInSneakingPose();
var down = !ModKeyBindings.jumpKeyDown(player) && player.isInSneakingPose();
double speed;
if (up) {
super.hover(player, stack);
return;
} else if (down) {
speed = -AdAstra.CONFIG.spaceSuit.jetSuitUpwardsSpeed;
} else {
double speed;
if (player.isInSneakingPose()) {
speed = -AdAstra.CONFIG.spaceSuit.jetSuitUpwardsSpeed;
} else {
speed = -player.getVelocity().getY() / HOVER_SINK_SPEED;
}
if (!player.isOnGround()) {
hover(player, stack, speed);
} else {
stack.getOrCreateNbt().putBoolean("spawn_particles", false);
}
speed = -player.getVelocity().getY() / HOVER_SINK_SPEED;
}

if (!player.isOnGround()) {
hover(player, stack, speed);
} else {
stack.getOrCreateNbt().putBoolean("spawn_particles", false);
}
}

Expand Down

0 comments on commit 364f623

Please sign in to comment.