mojira.dev

The bug

When you are in spectator mode, if you spin the mouse wheel too fast, you cannot move anymore, until you change gamemode again. You can teleport, and you can move your head, but you can't fly anywhere.

Comments 9

I managed to recreate it once by spam clicking the mouse wheel button and spinning it as fast as I could, but then I couldnt recreate it anymore(also, pressing the mouse wheel button makes you move again)

Using Ubuntu 17.04

In Minecraft 1.12, if you scroll wheel down, it decreases your fly speed as intended. If you scroll up, it increases your fly speed as intended. If you switch gamemodes it resets your fly speed. If you go back to spectator mode, you will have the reset fly speed, not the previous.

As @unknown has already said, I think this behavior is inteded. (also see Spectator#Flight)

The new flight speed is calculated based in the current flight speed plus Mouse.getEventDWheel() (which is 120 or –120 depending on if the wheel was spinned forwards or backwards.) multiplied by 0.005. -> current flight speed + (–/+120) * 0.005.

The code for calculating and setting the new flight speed in the method net.minecraft.client.Minecraft.runTickMouse() looks like this:

float f = MathHelper.clamp(this.player.capabilities.getFlySpeed() + (float)Math.getEventDWheel() * 0.005F, 0.0F, 0.2F);
this.player.capabilities.setFlySpeed(f);

If it is not intended that the player stops moving completely when scrolling down too far, a simple solution would be to set the minimum value of the Math.clamp() function to something higher than 0.0F. (for example 0.01F)

MathHelper.clamp(this.player.capabilities.getFlySpeed() + (float)Math.getEventDWheel() * 0.005F, 0.01F, 0.2F);

MC 1.12.1 should be marked as a affected here.

Confirmed for 1.13.1.

I also agree with @unknown and @unknown, this is most likely intended, if not setting the value of Math.clamp() to something higher than 0.0F like @unknown said above, would be a good solution for this.

Can confirm in 20w48a.

Can confirm in 1.17.1 Release Candidate 1.

Dedin Dedon

(Unassigned)

Confirmed

(Unassigned)

Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 1.13.1, 20w29a, 1.16.4, 20w48a, 1.17.1 Release Candidate 1, 1.17.1, 1.21

Retrieved