mojira.dev
MC-193343

Soul Speed effect remains after switching to spectator mode

The bug

If you stand on soul sand with the Soul Speed enchantment and switch to spectator mode you will keep the speed boost.

Code analysis

Code analysis by @unknown can be found in this comment.

Linked issues

MC-189612 When switching gamemode from survival to spectator using F3 + F4, the player's breathing does not reset. Resolved MC-51573 Blazes continue to follow/attack you in spectator mode Resolved MC-46766 Breaking particles, sounds, and block cracks can be created in spectator mode Open MC-69216 Switching to spectator mode while fishing keeps rod cast Resolved MC-81773 Bows, crossbows, and tridents drawn in survival/creative/adventure mode can be released in spectator mode Resolved

Attachments

Comments 14

Hi there!

I can confirm in release 1.16.1 and snapshot 20w30a.

Can confirm for 20w51a.

Can confirm in 21w03a.

Can confirm in 21w06a. Feel free to use the following command to make reproducing this much easier:

/give @s minecraft:netherite_boots{Enchantments:[{id:"soul_speed",lvl:3}]}

Can confirm in 21w08b. Video attached.

4 more comments

Can confirm in 1.18.2.

Code analysis

Tested in 1.18.2 with yarn mappings

 

net.minecraft.entity.LivingEntity

 

protected boolean shouldRemoveSoulSpeedBoost(BlockState landingState) {
   return !landingState.isAir() || this.isFallFlying();
}

This piece of code is responsible from removing the speed boost from an entity.

 

 

Suggested Fix

 

@Override
protected boolean shouldRemoveSoulSpeedBoost(BlockState landingState) {
   return super.shouldRemoveSoulSpeedBoost(landingState) || this.isSpectator();
}

Simply override the check in PlayerEntity check if the player is in spectator mode. If so, return true!

 

Can confirm in 1.19.2.

Can confirm in 1.19.3.

This looks to be fixed in 24w18a based off my inability to reproduce the issue anymore, despite being able to successfully in 1.20.6:

[media]

migrated

slicedlime

Confirmed

Items, Player

game-mode-switch, soul_speed, spectator

1.16.1, 20w30a, 1.16.3 Release Candidate 1, 1.16.3, 20w46a, , 1.19.2, 1.19.3, 1.19.4, 23w14a, 1.20.1

24w18a

Retrieved