本文整理汇总了Java中net.minecraft.world.GameType.parseGameTypeWithDefault方法的典型用法代码示例。如果您正苦于以下问题:Java GameType.parseGameTypeWithDefault方法的具体用法?Java GameType.parseGameTypeWithDefault怎么用?Java GameType.parseGameTypeWithDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.GameType
的用法示例。
在下文中一共展示了GameType.parseGameTypeWithDefault方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGamemodePredicates
import net.minecraft.world.GameType; //导入方法依赖的package包/类
private static List<Predicate<Entity>> getGamemodePredicates(Map<String, String> params)
{
List<Predicate<Entity>> list = Lists.<Predicate<Entity>>newArrayList();
String s = getArgument(params, field_190846_t);
if (s == null)
{
return list;
}
else
{
final boolean flag = s.startsWith("!");
if (flag)
{
s = s.substring(1);
}
GameType gametype;
try
{
int i = Integer.parseInt(s);
gametype = GameType.parseGameTypeWithDefault(i, GameType.NOT_SET);
}
catch (Throwable var6)
{
gametype = GameType.parseGameTypeWithDefault(s, GameType.NOT_SET);
}
final GameType type = gametype;
list.add(new Predicate<Entity>()
{
public boolean apply(@Nullable Entity p_apply_1_)
{
if (!(p_apply_1_ instanceof EntityPlayerMP))
{
return false;
}
else
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)p_apply_1_;
GameType gametype1 = entityplayermp.interactionManager.getGameType();
return flag ? gametype1 != type : gametype1 == type;
}
}
});
return list;
}
}
示例2: getGameModeFromCommand
import net.minecraft.world.GameType; //导入方法依赖的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;
}
示例3: getGamemodePredicates
import net.minecraft.world.GameType; //导入方法依赖的package包/类
private static List<Predicate<Entity>> getGamemodePredicates(Map<String, String> params)
{
List<Predicate<Entity>> list = Lists.<Predicate<Entity>>newArrayList();
String s = getArgument(params, "m");
if (s == null)
{
return list;
}
else
{
final boolean flag = s.startsWith("!");
if (flag)
{
s = s.substring(1);
}
GameType gametype;
try
{
int i = Integer.parseInt(s);
gametype = GameType.parseGameTypeWithDefault(i, GameType.NOT_SET);
}
catch (Throwable var6)
{
gametype = GameType.parseGameTypeWithDefault(s, GameType.NOT_SET);
}
final GameType type = gametype;
list.add(new Predicate<Entity>()
{
public boolean apply(@Nullable Entity p_apply_1_)
{
if (!(p_apply_1_ instanceof EntityPlayerMP))
{
return false;
}
else
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)p_apply_1_;
GameType gametype1 = entityplayermp.interactionManager.getGameType();
return flag ? gametype1 != type : gametype1 == type;
}
}
});
return list;
}
}