本文整理匯總了Java中net.minecraft.world.WorldSettings.getGameTypeById方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldSettings.getGameTypeById方法的具體用法?Java WorldSettings.getGameTypeById怎麽用?Java WorldSettings.getGameTypeById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.world.WorldSettings
的用法示例。
在下文中一共展示了WorldSettings.getGameTypeById方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getGameModeFromCommand
import net.minecraft.world.WorldSettings; //導入方法依賴的package包/類
/**
* Gets the Game Mode specified in the command.
*/
protected WorldSettings.GameType getGameModeFromCommand(ICommandSender p_71539_1_, String p_71539_2_) throws CommandException, NumberInvalidException
{
return !p_71539_2_.equalsIgnoreCase(WorldSettings.GameType.SURVIVAL.getName()) && !p_71539_2_.equalsIgnoreCase("s") ? (!p_71539_2_.equalsIgnoreCase(WorldSettings.GameType.CREATIVE.getName()) && !p_71539_2_.equalsIgnoreCase("c") ? (!p_71539_2_.equalsIgnoreCase(WorldSettings.GameType.ADVENTURE.getName()) && !p_71539_2_.equalsIgnoreCase("a") ? (!p_71539_2_.equalsIgnoreCase(WorldSettings.GameType.SPECTATOR.getName()) && !p_71539_2_.equalsIgnoreCase("sp") ? WorldSettings.getGameTypeById(parseInt(p_71539_2_, 0, WorldSettings.GameType.values().length - 2)) : WorldSettings.GameType.SPECTATOR) : WorldSettings.GameType.ADVENTURE) : WorldSettings.GameType.CREATIVE) : WorldSettings.GameType.SURVIVAL;
}
示例2: getGameModeFromCommand
import net.minecraft.world.WorldSettings; //導入方法依賴的package包/類
/**
* Gets the Game Mode specified in the command.
*/
protected GameType getGameModeFromCommand(ICommandSender sender, String gameModeString) throws CommandException, NumberInvalidException
{
GameType gametype = GameType.parseGameTypeWithDefault(gameModeString, GameType.NOT_SET);
return gametype == GameType.NOT_SET ? WorldSettings.getGameTypeById(parseInt(gameModeString, 0, GameType.values().length - 2)) : gametype;
}