• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NumberInvalidException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.command.NumberInvalidException的典型用法代码示例。如果您正苦于以下问题:Java NumberInvalidException类的具体用法?Java NumberInvalidException怎么用?Java NumberInvalidException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NumberInvalidException类属于net.minecraft.command包,在下文中一共展示了NumberInvalidException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processCommand

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
@Overwrite
@Override
public void processCommand(ICommandSender sender, String[] args)
        throws WrongUsageException, NumberInvalidException {
    if (args.length < 1 || args.length > 2) {
        throw new WrongUsageException(USAGE);
    }

    final CatalogRegistryModule<Weather> module = SpongeImpl.getGame().getRegistry()
            .getRegistryModuleFor(Weather.class);
    final IMixinWeatherRegistryModule module0 = (IMixinWeatherRegistryModule) module;
    final IMixinWeather weather = (IMixinWeather) module0.findWeather(args[0]);
    if (weather == null) {
        throw new WrongUsageException(USAGE);
    }

    World world = (World) sender.getEntityWorld();
    if (args.length > 1) {
        world.forecast(weather, parseInt(args[1], 1, 1000000) * 20);
    } else {
        world.forecast(weather);
    }

    notifyOperators(sender, this, weather.getCommandMessage());
}
 
开发者ID:Cybermaxke,项目名称:Weathers,代码行数:26,代码来源:MixinCommandWeather.java


示例2: execute

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
	if (params.length > 0) {
		MinecraftServer server = sender.getServer();
		GameProfile profile = server.getPlayerProfileCache().getGameProfileForUsername(params[0]);
		int permLevel = server.getOpPermissionLevel();
		
           if (profile == null)
               throw new CommandException("command.op.playerNotFound", sender, params[0]);
           
           if (params.length > 1) {
           	try {permLevel = parseInt(params[1], 0, server.getOpPermissionLevel());}
           	catch (NumberInvalidException nie) {throw new CommandException(nie);}
           }
           
           server.getPlayerList().getOppedPlayers().addEntry(new UserListOpsEntry(profile, permLevel, server.getPlayerList().bypassesPlayerLimit(profile)));
           sendPlayerPermissionLevel(server.getPlayerList().getPlayerByUUID(profile.getId()), permLevel);
           notifyCommandListener(sender.getMinecraftISender(), this, "commands.op.success", params[0]);
       }
	else throw new CommandException("command.generic.invalidUsage", sender, this.getCommandName());
	
	return null;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:24,代码来源:CommandOp.java


示例3: func_71515_b

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public void func_71515_b(ICommandSender p_71515_1_, String[] p_71515_2_) {
   if(p_71515_2_.length >= 2) {
      EntityPlayerMP var3 = func_82359_c(p_71515_1_, p_71515_2_[0]);
      int var4 = func_71528_a(p_71515_1_, p_71515_2_[1], 1);
      int var5 = 1;
      int var6 = 0;
      if(Item.field_77698_e[var4] == null) {
         throw new NumberInvalidException("commands.give.notFound", new Object[]{Integer.valueOf(var4)});
      } else {
         if(p_71515_2_.length >= 3) {
            var5 = func_71532_a(p_71515_1_, p_71515_2_[2], 1, 64);
         }

         if(p_71515_2_.length >= 4) {
            var6 = func_71526_a(p_71515_1_, p_71515_2_[3]);
         }

         ItemStack var7 = new ItemStack(var4, var5, var6);
         EntityItem var8 = var3.func_71021_b(var7);
         var8.field_70293_c = 0;
         func_71522_a(p_71515_1_, "commands.give.success", new Object[]{Item.field_77698_e[var4].func_77653_i(var7), Integer.valueOf(var4), Integer.valueOf(var5), var3.func_70023_ak()});
      }
   } else {
      throw new WrongUsageException("commands.give.usage", new Object[0]);
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:27,代码来源:CommandGive.java


示例4: getLocation

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static Coord getLocation(ICommandContext context, List<String> args) throws NumberInvalidException, PlayerNotFoundException{
	ArgumentParser ap = new ArgumentParser(args);

	Coord pos = context.getPos();
	
	if(ap.match(0, "here") || ap.match(0, "nearby")){
		return new Coord((int) pos.getX(), 0, (int) pos.getZ());
	} else {
		try {
			int x = CommandBase.parseInt(ap.get(0));
			int z = CommandBase.parseInt(ap.get(1));
			return new Coord(x, 0, z);
		} catch (NumberInvalidException e) {
			context.sendMessage("Failure: Invalid Coords: X Z", MessageType.ERROR);
			throw(e);
		}
	}
}
 
开发者ID:Greymerk,项目名称:minecraft-roguelike,代码行数:19,代码来源:CommandRouteDungeon.java


示例5: execute

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	int color = 0x000000;
	int time = 40;
	String texture = null;
	
	List<EntityPlayerMP> players = Collections.emptyList();
	if(args.length > 0) {
		players = EntitySelector.matchEntities(sender, args[0], EntityPlayerMP.class);
		if(args.length > 1){
			try{
				color = Integer.parseInt(args[1]);
				if(args.length > 2){
					time = Integer.parseInt(args[2]);
				}
			}catch(NumberFormatException ex){
				throw new NumberInvalidException("Invalid integer!", new Object[0]);
			}
			
			if(args.length > 2) {
				String[] a = Arrays.copyOfRange(args, 3, args.length);
				StringBuilder b = new StringBuilder();
				for(String s : a)
					b.append(s).append(" ");
				texture = b.toString().trim();
			}
		}
	}else{
		throw new CommandException("Incorrect usage!", new Object[0]);
	}
	
	for(EntityPlayerMP player : players){
		TaleCraft.network.sendTo(new FadePacket(color, time, texture), player);
	}
	
}
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:37,代码来源:FadeCommand.java


示例6: handleRelativeNumber

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static double handleRelativeNumber(ICommandSender par1ICommandSender, double origin, String arg, int min, int max) {
	boolean relative = arg.startsWith("~");
	boolean random = arg.startsWith("?");
	if (random) relative = true;
	double d1 = relative ? origin : 0.0D;

	if (!relative || arg.length() > 1) {
		boolean flag1 = arg.contains(".");

		if (relative) {
			arg = arg.substring(1);
		}

		double d2 = parseDouble(par1ICommandSender, arg);
		if (random) {
			Random rand = new Random();
			d1 += (rand.nextDouble() * 2 - 1) * d2;
		} else {
			d1 += d2;
		}

		if (!flag1 && !relative) {
			d1 += 0.5D;
		}
	}

	if (min != 0 || max != 0) {
		if (d1 < min) { throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[] { Double.valueOf(d1), Integer.valueOf(min) }); }

		if (d1 > max) { throw new NumberInvalidException("commands.generic.double.tooBig", new Object[] { Double.valueOf(d1), Integer.valueOf(max) }); }
	}

	return d1;
}
 
开发者ID:XCompWiz,项目名称:LookingGlass,代码行数:35,代码来源:CommandBaseAdv.java


示例7: parseFloat

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static float parseFloat(ICommandSender par0ICommandSender, String par1Str) {
	try {
		return Float.parseFloat(par1Str);
	} catch (NumberFormatException numberformatexception) {
		throw new NumberInvalidException("commands.generic.num.invalid", new Object[] { par1Str });
	}
}
 
开发者ID:XCompWiz,项目名称:LookingGlass,代码行数:8,代码来源:CommandBaseAdv.java


示例8: processCommand

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
@Override
public boolean processCommand(ICommandSender sender, String[] parameters) throws CommandException {
    List list = this.getSortedPossibleCommands(sender);
    byte b0 = 7;
    int i = (list.size() - 1) / b0;
    boolean flag = false;
    int k;

    try {
        k = parameters.length == 0 ? 0 : net.minecraft.command.CommandBase.parseInt(parameters[0], 1, i + 1) - 1;
    } catch (NumberInvalidException numberinvalidexception) {
        Map map = this.getCommands();
        AbstractCommand icommand = (AbstractCommand) map.get(parameters[0]);

        if (icommand != null) {
            CommandManager.throwError(sender, icommand);
            return true;
        }

        if (MathHelper.parseIntWithDefault(parameters[0], -1) != -1) {
            throw numberinvalidexception;
        }

        throw new CommandNotFoundException();
    }

    int j = Math.min((k + 1) * b0, list.size());
    TextComponentTranslation chatcomponenttranslation1 = new TextComponentTranslation("crafting.commands.help.header", new Object[] { Integer.valueOf(k + 1), Integer.valueOf(i + 1) });
    chatcomponenttranslation1.getStyle().setColor(TextFormatting.DARK_GREEN);
    sender.addChatMessage(chatcomponenttranslation1);

    for (int l = k * b0; l < j; ++l) {
        AbstractCommand icommand1 = (AbstractCommand) list.get(l);
        TextComponentTranslation chatcomponenttranslation = new TextComponentTranslation(CommandManager.getUsage(icommand1), new Object[0]);
        chatcomponenttranslation.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/" + icommand1.getCommandName() + " "));
        sender.addChatMessage(chatcomponenttranslation);
    }

    return true;
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:41,代码来源:CommandHelp.java


示例9: parseInt

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static int parseInt(String number) {
    try {
        return Integer.parseInt(number);
    } catch (NumberFormatException numberformatexception) {
        throw new NumberInvalidException("commands.generic.num.invalid", number);
    }
}
 
开发者ID:NPException,项目名称:Dimensional-Pockets,代码行数:8,代码来源:CommandAbstract.java


示例10: parsePositionWithBounds

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
private double parsePositionWithBounds(ICommandSender commandSender, double currentPos, String stringDouble,
        int lowerLimit, int upperLimit) {
    boolean isRelativeCoords = stringDouble.startsWith("~");
    double targetPos = isRelativeCoords ? currentPos : 0.0D;

    if (!isRelativeCoords || stringDouble.length() > 1) {
        boolean hasDecimal = stringDouble.contains(".");

        if (isRelativeCoords) {
            stringDouble = stringDouble.substring(1);
        }

        targetPos += parseDouble(commandSender, stringDouble);

        if (!hasDecimal && !isRelativeCoords) {
            targetPos += 0.5D;
        }
    }

    if (lowerLimit != 0 || upperLimit != 0) {
        if (targetPos < (double) lowerLimit) {
            throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[] {
                    Double.valueOf(targetPos), Integer.valueOf(lowerLimit) });
        }

        if (targetPos > (double) upperLimit) {
            throw new NumberInvalidException("commands.generic.double.tooBig", new Object[] {
                    Double.valueOf(targetPos), Integer.valueOf(upperLimit) });
        }
    }
    return targetPos;
}
 
开发者ID:soultek101,项目名称:projectzulu1.7.10-pre-1.3a,代码行数:33,代码来源:CommandPlaySound.java


示例11: parsePositionWithBounds

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
private double parsePositionWithBounds(ICommandSender commandSender, double currentPos, String stringDouble, int lowerLimit, int upperLimit){
	boolean isRelativeCoords = stringDouble.startsWith("~");
	double targetPos = isRelativeCoords ? currentPos : 0.0D;

	if (!isRelativeCoords || stringDouble.length() > 1){
		boolean hasDecimal = stringDouble.contains(".");

		if (isRelativeCoords){
			stringDouble = stringDouble.substring(1);
		}

		targetPos += parseDouble(commandSender, stringDouble);

		if (!hasDecimal && !isRelativeCoords){
			targetPos += 0.5D;
		}
	}

	if (lowerLimit != 0 || upperLimit != 0){
		if (targetPos < (double)lowerLimit){
			throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[] {Double.valueOf(targetPos), Integer.valueOf(lowerLimit)});
		}

		if (targetPos > (double)upperLimit){
			throw new NumberInvalidException("commands.generic.double.tooBig", new Object[] {Double.valueOf(targetPos), Integer.valueOf(upperLimit)});
		}
	}
	return targetPos;
}
 
开发者ID:soultek101,项目名称:projectzulu1.7.10-pre-1.3a,代码行数:30,代码来源:CommandSpawnEntity.java


示例12: parsePositionWithBounds

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
private double parsePositionWithBounds(ICommandSender commandSender, double currentPos, String stringDouble,
        int lowerLimit, int upperLimit) {
    boolean isRelativeCoords = stringDouble.startsWith("~");
    double targetPos = isRelativeCoords ? currentPos : 0.0D;

    if (!isRelativeCoords || stringDouble.length() > 1) {
        boolean hasDecimal = stringDouble.contains(".");

        if (isRelativeCoords) {
            stringDouble = stringDouble.substring(1);
        }

        targetPos += parseDouble(commandSender, stringDouble);

        if (!hasDecimal && !isRelativeCoords) {
            targetPos += 0.5D;
        }
    }

    if (lowerLimit != 0 || upperLimit != 0) {
        if (targetPos < lowerLimit) {
            throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[] {
                    Double.valueOf(targetPos), Integer.valueOf(lowerLimit) });
        }

        if (targetPos > upperLimit) {
            throw new NumberInvalidException("commands.generic.double.tooBig", new Object[] {
                    Double.valueOf(targetPos), Integer.valueOf(upperLimit) });
        }
    }
    return targetPos;
}
 
开发者ID:soultek101,项目名称:projectzulu1.7.10-pre-1.3a,代码行数:33,代码来源:CommandPlaceBlock.java


示例13: execute

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {

    World world = sender.getEntityWorld();

    if (world.isRemote) {

    } else {
        if ((args.length == 0 || args.length > 2)) {
            throw new WrongUsageException(this.getUsage(sender), new Object[0]);
        } else {

            level = parseInt(args[0]) - 1;

            EntityPlayer entityplayer = args.length > 1 ? getPlayer(server, sender, args[1]) : getCommandSenderAsPlayer(sender);

            if (level < -1){
            	throw new NumberInvalidException("commands.generic.num.tooSmall", new Object[] {level+1,0});
            }
            if(level > 8) {
            	throw new NumberInvalidException("commands.generic.num.tooBig", new Object[] {level+1,9});
            }
            

            if (entityplayer != null) {

                AllomancyCapability cap = AllomancyCapability.forPlayer(entityplayer);
                cap.setAllomancyPower(level);

                Registry.network.sendTo(new AllomancyPowerPacket(level), (EntityPlayerMP) entityplayer);

                notifyCommandListener(sender, this, "commands.allomancy.success", new Object[] { entityplayer.getName(), names[(level + 1)]});

            } else {
                sender.sendMessage(new TextComponentString("Player not found"));
            }
        }
    }
}
 
开发者ID:legobmw99,项目名称:Allomancy,代码行数:40,代码来源:PowerCommand.java


示例14: func_71526_a

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static int func_71526_a(ICommandSender p_71526_0_, String p_71526_1_) {
   try {
      return Integer.parseInt(p_71526_1_);
   } catch (NumberFormatException var3) {
      throw new NumberInvalidException("commands.generic.num.invalid", new Object[]{p_71526_1_});
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:8,代码来源:CommandBase.java


示例15: func_71532_a

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static int func_71532_a(ICommandSender p_71532_0_, String p_71532_1_, int p_71532_2_, int p_71532_3_) {
   int var4 = func_71526_a(p_71532_0_, p_71532_1_);
   if(var4 < p_71532_2_) {
      throw new NumberInvalidException("commands.generic.num.tooSmall", new Object[]{Integer.valueOf(var4), Integer.valueOf(p_71532_2_)});
   } else if(var4 > p_71532_3_) {
      throw new NumberInvalidException("commands.generic.num.tooBig", new Object[]{Integer.valueOf(var4), Integer.valueOf(p_71532_3_)});
   } else {
      return var4;
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:11,代码来源:CommandBase.java


示例16: func_82363_b

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static double func_82363_b(ICommandSender p_82363_0_, String p_82363_1_) {
   try {
      double var2 = Double.parseDouble(p_82363_1_);
      if(!Doubles.isFinite(var2)) {
         throw new NumberInvalidException("commands.generic.double.invalid", new Object[]{p_82363_1_});
      } else {
         return var2;
      }
   } catch (NumberFormatException var4) {
      throw new NumberInvalidException("commands.generic.double.invalid", new Object[]{p_82363_1_});
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:13,代码来源:CommandBase.java


示例17: func_110661_a

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static double func_110661_a(ICommandSender p_110661_0_, String p_110661_1_, double p_110661_2_, double p_110661_4_) {
   double var6 = func_82363_b(p_110661_0_, p_110661_1_);
   if(var6 < p_110661_2_) {
      throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[]{Double.valueOf(var6), Double.valueOf(p_110661_2_)});
   } else if(var6 > p_110661_4_) {
      throw new NumberInvalidException("commands.generic.double.tooBig", new Object[]{Double.valueOf(var6), Double.valueOf(p_110661_4_)});
   } else {
      return var6;
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:11,代码来源:CommandBase.java


示例18: func_110665_a

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static double func_110665_a(ICommandSender p_110665_0_, double p_110665_1_, String p_110665_3_, int p_110665_4_, int p_110665_5_) {
   boolean var6 = p_110665_3_.startsWith("~");
   if(var6 && Double.isNaN(p_110665_1_)) {
      throw new NumberInvalidException("commands.generic.num.invalid", new Object[]{Double.valueOf(p_110665_1_)});
   } else {
      double var7 = var6?p_110665_1_:0.0D;
      if(!var6 || p_110665_3_.length() > 1) {
         boolean var9 = p_110665_3_.contains(".");
         if(var6) {
            p_110665_3_ = p_110665_3_.substring(1);
         }

         var7 += func_82363_b(p_110665_0_, p_110665_3_);
         if(!var9 && !var6) {
            var7 += 0.5D;
         }
      }

      if(p_110665_4_ != 0 || p_110665_5_ != 0) {
         if(var7 < (double)p_110665_4_) {
            throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[]{Double.valueOf(var7), Integer.valueOf(p_110665_4_)});
         }

         if(var7 > (double)p_110665_5_) {
            throw new NumberInvalidException("commands.generic.double.tooBig", new Object[]{Double.valueOf(var7), Integer.valueOf(p_110665_5_)});
         }
      }

      return var7;
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:32,代码来源:CommandBase.java


示例19: execute

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
@Override
public void execute(ICommandContext context, List<String> args) {
	
	ArgumentParser ap = new ArgumentParser(args);
	
	IWorldEditor editor = context.createEditor();
	Coord pos;
	if(!ap.hasEntry(0)){
		pos = context.getPos();
	} else {
		int x; int z;
		try {
			x = CommandBase.parseInt(ap.get(0));
			z = CommandBase.parseInt(ap.get(1));
		} catch (NumberInvalidException e) {
			context.sendMessage("Failure: Invalid Coords: X Z", MessageType.ERROR);
			return;
		}
		pos = new Coord(x, 0, z);
	}
	
	context.sendMessage("Biome Information for " + pos.toString(), MessageType.SPECIAL);
	
	Biome biome = editor.getInfo(pos).getBiome();
	context.sendMessage(biome.getBiomeName(), MessageType.SPECIAL);
	
	Set<BiomeDictionary.Type> biomeTypes = BiomeDictionary.getTypes(biome);
	String types = "";
	for(BiomeDictionary.Type type : biomeTypes){
		types += type.getName() + " ";
	}
	
	context.sendMessage(types, MessageType.SPECIAL);
	return;
}
 
开发者ID:Greymerk,项目名称:minecraft-roguelike,代码行数:36,代码来源:CommandRouteBiome.java


示例20: checkPositionWithBounds

import net.minecraft.command.NumberInvalidException; //导入依赖的package包/类
public static double checkPositionWithBounds(final ICommandSender sender, final double postion, String argPos, final int min, final int max)
{
    final boolean flag = argPos.startsWith("~");
    double d1 = flag ? postion : 0.0D;
    if (!flag || (argPos.length() > 1))
    {
        final boolean flag1 = argPos.contains(".");
        if (flag)
        {
            argPos = argPos.substring(1);
        }
        d1 += CommandBase.parseDouble(sender, argPos);
        if (!flag1 && !flag)
        {
            d1 += 0.5D;
        }
    }
    if ((min != 0) || (max != 0))
    {
        if (d1 < min)
        {
            if ((d1 < -30000000) && (d1 >= -300000000))
            {
                throw new NumberInvalidException("commands.generic.double.tooSmall", d1, max);
            }
        }
        if (d1 > max)
        {
            if ((d1 > 30000000) && (d1 <= 300000000))
            {
                throw new NumberInvalidException("commands.generic.double.tooBig", d1, max);
            }
        }
    }
    return d1;
}
 
开发者ID:CCM-Modding,项目名称:Nucleum-Omnium,代码行数:37,代码来源:CommandTpx.java



注:本文中的net.minecraft.command.NumberInvalidException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CheckType类代码示例发布时间:2022-05-21
下一篇:
Java Mode类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap