Ejemplo n.º 1
0
  public void processCommand(ICommandSender sender, String[] args) throws CommandException {
    if (args.length < 1) {
      throw new WrongUsageException("commands.testfor.usage", new Object[0]);
    } else {
      Entity var3 = func_175768_b(sender, args[0]);
      NBTTagCompound var4 = null;

      if (args.length >= 2) {
        try {
          var4 = JsonToNBT.func_180713_a(func_180529_a(args, 1));
        } catch (NBTException var6) {
          throw new CommandException("commands.testfor.tagError", new Object[] {var6.getMessage()});
        }
      }

      if (var4 != null) {
        NBTTagCompound var5 = new NBTTagCompound();
        var3.writeToNBT(var5);

        if (!CommandTestForBlock.func_175775_a(var4, var5, true)) {
          throw new CommandException("commands.testfor.failure", new Object[] {var3.getName()});
        }
      }

      notifyOperators(sender, this, "commands.testfor.success", new Object[] {var3.getName()});
    }
  }
Ejemplo n.º 2
0
  public ItemStack createVesselWithEntity(Entity ent) {

    String entityId = EntityList.getEntityString(ent);
    NBTTagCompound root = new NBTTagCompound();
    root.setString("id", entityId);
    ent.writeToNBT(root);

    ItemStack res = new ItemStack(this);
    res.stackTagCompound = root;

    setDisplayNameFromEntityNameTag(res, ent);
    return res;
  }