當前位置: 首頁>>代碼示例>>Java>>正文


Java NBTUtil.func_181123_a方法代碼示例

本文整理匯總了Java中net.minecraft.nbt.NBTUtil.func_181123_a方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTUtil.func_181123_a方法的具體用法?Java NBTUtil.func_181123_a怎麽用?Java NBTUtil.func_181123_a使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.nbt.NBTUtil的用法示例。


在下文中一共展示了NBTUtil.func_181123_a方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processCommand

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 1)
    {
        throw new WrongUsageException("commands.testfor.usage", new Object[0]);
    }
    else
    {
        Entity entity = func_175768_b(sender, args[0]);
        NBTTagCompound nbttagcompound = null;

        if (args.length >= 2)
        {
            try
            {
                nbttagcompound = JsonToNBT.getTagFromJson(buildString(args, 1));
            }
            catch (NBTException nbtexception)
            {
                throw new CommandException("commands.testfor.tagError", new Object[] {nbtexception.getMessage()});
            }
        }

        if (nbttagcompound != null)
        {
            NBTTagCompound nbttagcompound1 = new NBTTagCompound();
            entity.writeToNBT(nbttagcompound1);

            if (!NBTUtil.func_181123_a(nbttagcompound, nbttagcompound1, true))
            {
                throw new CommandException("commands.testfor.failure", new Object[] {entity.getName()});
            }
        }

        notifyOperators(sender, this, "commands.testfor.success", new Object[] {entity.getName()});
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:41,代碼來源:CommandTestFor.java

示例2: func_181078_a

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
private boolean func_181078_a(ItemStack p_181078_1_, ItemStack p_181078_2_)
{
    return ItemStack.areItemsEqual(p_181078_1_, p_181078_2_) && (!p_181078_2_.hasTagCompound() || p_181078_1_.hasTagCompound() && NBTUtil.func_181123_a(p_181078_2_.getTagCompound(), p_181078_1_.getTagCompound(), false));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:MerchantRecipeList.java

示例3: setPlayer

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
protected void setPlayer(ICommandSender p_147197_1_, String[] p_147197_2_, int p_147197_3_) throws CommandException
{
    String s = p_147197_2_[p_147197_3_ - 1];
    int i = p_147197_3_;
    String s1 = getEntityName(p_147197_1_, p_147197_2_[p_147197_3_++]);

    if (s1.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s1, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_147197_2_[p_147197_3_++], true);
        int j = s.equalsIgnoreCase("set") ? parseInt(p_147197_2_[p_147197_3_++]) : parseInt(p_147197_2_[p_147197_3_++], 0);

        if (p_147197_2_.length > p_147197_3_)
        {
            Entity entity = func_175768_b(p_147197_1_, p_147197_2_[i]);

            try
            {
                NBTTagCompound nbttagcompound = JsonToNBT.getTagFromJson(buildString(p_147197_2_, p_147197_3_));
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                entity.writeToNBT(nbttagcompound1);

                if (!NBTUtil.func_181123_a(nbttagcompound, nbttagcompound1, true))
                {
                    throw new CommandException("commands.scoreboard.players.set.tagMismatch", new Object[] {s1});
                }
            }
            catch (NBTException nbtexception)
            {
                throw new CommandException("commands.scoreboard.players.set.tagError", new Object[] {nbtexception.getMessage()});
            }
        }

        Scoreboard scoreboard = this.getScoreboard();
        Score score = scoreboard.getValueFromObjective(s1, scoreobjective);

        if (s.equalsIgnoreCase("set"))
        {
            score.setScorePoints(j);
        }
        else if (s.equalsIgnoreCase("add"))
        {
            score.increseScore(j);
        }
        else
        {
            score.decreaseScore(j);
        }

        notifyOperators(p_147197_1_, this, "commands.scoreboard.players.set.success", new Object[] {scoreobjective.getName(), s1, Integer.valueOf(score.getScorePoints())});
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:56,代碼來源:CommandScoreboard.java


注:本文中的net.minecraft.nbt.NBTUtil.func_181123_a方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。