Pocky-l / HexTale

MIT License
0 stars 0 forks source link

Removing Jetpack in spectator mode disables flight #2

Closed Sul4urx closed 7 months ago

Sul4urx commented 9 months ago

``When wearing a hex jetpack, switching to spectator mode and removing the hex jetpack with commands, the player cannot fly anymore and will fall through blocks and then eventually into the void, and then dies.

*This bug has not been tested, but I can confirm this bug by looking through the codes of this mod.

To fix this bug, you can go to src/main/java/com/pocky/hextale/common/items/armor/HexJetpackItem.java Then, go to line 79 and change the following code from:

if (s2.is(ModItems.HEX_JETPACK.get())) {
                player.getAbilities().mayfly = true;
            } else {
                if (!player.isCreative()) {
                    player.getAbilities().mayfly = false;
                }
            }

to

if (s2.is(ModItems.HEX_JETPACK.get())) {
                player.getAbilities().mayfly = true;
            } else {
                if (!player.isCreative() && !player.isSpectator()) {
                    player.getAbilities().mayfly = false;
                }
            }
Pocky-l commented 7 months ago

@Sul4urx I fixed it, thx for report