/*
 * This file is part of Sponge, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.common.registry.type.entity;

import net.minecraft.world.GameType;
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
import org.spongepowered.api.registry.util.RegisterCatalog;
import org.spongepowered.common.registry.type.MinecraftEnumBasedCatalogTypeModule;

@RegisterCatalog(GameModes.class)
public final class GameModeRegistryModule extends MinecraftEnumBasedCatalogTypeModule<GameType, GameMode> {

    @Override
    protected GameType[] getValues() {
        return GameType.values();
    }

    @Override
    protected void generateInitialMap() {
        for (GameType enumType: getValues()) {
            this.catalogTypeMap.put(enumAs(enumType).getId(), enumAs(enumType));
        }
    }

    public static GameType toGameType(GameMode gamemode) {
        for (GameType gameType : GameType.values()) {
            if (gameType.getName().equalsIgnoreCase(gamemode.getId())) {
                return gameType;
            }
        }
        return GameType.SURVIVAL;
    }

}

@@ -2184,24 +2184,45 @@
     if (
+((GameMode) (Object) 
 gameType
 .getName
@@ -2217,16 +2217,15 @@
 Type
+)
 .get
-Name
+Id
 ().e
@@ -2233,18 +2233,8 @@
 uals
-IgnoreCase
 (gam

Fix GameMode not updating