本文整理匯總了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()});
}
}
示例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));
}
示例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())});
}
}