Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-188400

Canceling of GameModeChange broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21.60.23 Preview, 1.21.60.21 Preview, 1.21.50.30 Preview, 1.21.50.29 Preview, 1.21.44 Hotfix, 1.21.51 Hotfix, 1.21.60.24 Preview
    • None
    • Unconfirmed
    • Multiple

      If you cancel a gamemodeChange Event with Script API, the game dosen't correctly cancel the gamemodeChange (probaply a client server gamemode desync)

      Steps to reproduce:

      • Make a behavior pack with the following Code for the ScriptAPI: 
        import {world} from "@minecraft/server";
        world.beforeEvents.playerGameModeChange.subscribe(eventData => {
         eventData.cancel = true
        })
      • Go into a world with this code applied
      • Change youor gamemode

      Observed result:
      The gamemode changes, but if you were previosly in creative and change it to surviaval your now in survival, but can instamine block and pickblock blocks that you don't have in the inventory or as another example if you change to spectator. Your in spectator, but the chunks reload constantly as if you were constantly switching from spectator to another gamemode

      Expected result:
      The gamemodeChange should just be canceld

      What could be the cause (Speculation):
      My speculation to why it is happening is that the server never accepts the gamemodeChange, but the client never becomes a packet that the gamemodeChange was canceled. This is probably why  then you change from creativ to survival mobs don't attack you, you can't damage yourself in any way. Even if you do 

      /kill @s
      

      the game tells, that it can't kill the player because he is in creative.

            Coolbep Coolbep
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: