/entitydata outputs success message on invalid NBT tags
When trying to change an invalid tag of an entity via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
/entitydata @e[type=!Player,c=1] {SomeInvalidTag:1}
However, executing
/entitydata @e[type=!Player,c=1] {}
afterwards will show that the tag wasn't actually applied (because entities aren't capable of actually storing it).
Solution
NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); // The following lines were changed NBTTagCompound nbttagcompound3 = new NBTTagCompound(); entity.writeToNBT(nbttagcompound3); if(nbttagcompound3.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound3.toString()}); } notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound3.toString()}); }
Environment
Windows 7 Home Premium
Java 1.8.0_25 64bit
Created Issue:
/entitydata outputs success message on failure
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Environment
Windows 7 Home Premium
Java 1.8.0_25 64bit
/entitydata outputs success message onfailure/entitydata outputs success message on invalid NBT tags
relates to
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Cause
Unable to find source-code formatter for language: title:net.minecraft.command.commandentitydata.processcommand(icommandsender, string[]). Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Cause
Unable to find source-code formatter for language: title:net.minecraft.command.commandentitydata.processcommand(icommandsender, string[]). Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yamlWhen trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Cause
{ NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch (NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if (nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()}); }
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Cause
{ NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch (NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if (nbttagcompound.equals(nbttagcompound1)) {throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()});}else{entity.readFromNBT(nbttagcompound);notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()});}When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Cause
{ NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch (NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if (nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()}); } }
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Cause
{NBTTagCompound nbttagcompound = new NBTTagCompound();entity.writeToNBT(nbttagcompound);NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy();NBTTagCompound nbttagcompound2;try{nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText());}catch(NBTException nbtexception){throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()});}nbttagcompound2.removeTag("UUIDMost");nbttagcompound2.removeTag("UUIDLeast");nbttagcompound.merge(nbttagcompound2);if(nbttagcompound.equals(nbttagcompound1)){throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()});}else{entity.readFromNBT(nbttagcompound);notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()});}}When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Cause
NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()}); }
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Cause
NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); }else{ entity.readFromNBT(nbttagcompound);notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()}); }When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Solution
Just add the commented out lines.NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); //entity.writeToNBT(nbttagcompound); //if(nbttagcompound.equals(nbttagcompound1)) { // throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); //} notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()}); }
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Solution
Just add the commented out lines.NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); //entity.writeToNBT(nbttagcompound); //if(nbttagcompound.equals(nbttagcompound1)) { // throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); //} notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()}); }
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Solution
Just add the commented out lines.NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); // The following lines were changed NBTTagCompound nbttagcompound3 = new NBTTagCompound(); entity.writeToNBT(nbttagcompound3); if(nbttagcompound3.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound3.toString()}); } notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound3.toString()}); }
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Solution
Just add the commented out lines.NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); // The following lines were changed NBTTagCompound nbttagcompound3 = new NBTTagCompound(); entity.writeToNBT(nbttagcompound3); if(nbttagcompound3.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound3.toString()}); } notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound3.toString()}); }
When trying to change an invalid tag of an entity (e.g. the 'Fuse' tag for a painting) via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because paintings aren't capable of storing a 'Fuse' tag).
Solution
net.minecraft.command.CommandEntityData.processCommand(ICommandSender, String[])NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); // The following lines were changed NBTTagCompound nbttagcompound3 = new NBTTagCompound(); entity.writeToNBT(nbttagcompound3); if(nbttagcompound3.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound3.toString()}); } notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound3.toString()}); }
When trying to change an invalid tag of an entity
(e.g. the 'Fuse' tag for a painting)via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
However, executing/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because
paintings aren't capable ofstoring a 'Fuse' tag).Solution
net.minecraft.command.CommandEntityData.processCommand(ICommandSender, String[])NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); // The following lines were changed NBTTagCompound nbttagcompound3 = new NBTTagCompound(); entity.writeToNBT(nbttagcompound3); if(nbttagcompound3.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound3.toString()}); } notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound3.toString()}); }When trying to change an invalid tag of an entity via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
/entitydata @e[type=Painting,c=1] {SomeInvalidTag:1}However, executing
/entitydata @e[type=Painting,c=1] {}afterwards will show that the tag wasn't actually applied (because entities aren't capable of actually storing it).
Solution
net.minecraft.command.CommandEntityData.processCommand(ICommandSender, String[])NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); // The following lines were changed NBTTagCompound nbttagcompound3 = new NBTTagCompound(); entity.writeToNBT(nbttagcompound3); if(nbttagcompound3.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound3.toString()}); } notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound3.toString()}); }
When trying to change an invalid tag of an entity via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
/entitydata @e[type=Painting,c=1] {SomeInvalidTag:1}However, executing
/entitydata @e[type=Painting,c=1] {}
afterwards will show that the tag wasn't actually applied (because entities aren't capable of actually storing it).Solution
net.minecraft.command.CommandEntityData.processCommand(ICommandSender, String[])NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); // The following lines were changed NBTTagCompound nbttagcompound3 = new NBTTagCompound(); entity.writeToNBT(nbttagcompound3); if(nbttagcompound3.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound3.toString()}); } notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound3.toString()}); }When trying to change an invalid tag of an entity via the /entitydata command, it won't output an error message, but instead display the alleged new NBT data, including the invalid tag.
/entitydata @e[type=!Player,c=1] {SomeInvalidTag:1}However, executing
/entitydata @e[type=!Player,c=1] {}afterwards will show that the tag wasn't actually applied (because entities aren't capable of actually storing it).
Solution
net.minecraft.command.CommandEntityData.processCommand(ICommandSender, String[])NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.writeToNBT(nbttagcompound); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.copy(); NBTTagCompound nbttagcompound2; try { nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); } catch(NBTException nbtexception) { throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); } nbttagcompound2.removeTag("UUIDMost"); nbttagcompound2.removeTag("UUIDLeast"); nbttagcompound.merge(nbttagcompound2); if(nbttagcompound.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); } else { entity.readFromNBT(nbttagcompound); // The following lines were changed NBTTagCompound nbttagcompound3 = new NBTTagCompound(); entity.writeToNBT(nbttagcompound3); if(nbttagcompound3.equals(nbttagcompound1)) { throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound3.toString()}); } notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound3.toString()}); }
A comment with security level 'global-moderators' was removed.
A comment with security level 'global-moderators' was removed.
Created MC-80956, which might be associated with this one.



Stil valid for current snapshot 15w51b.
This is explicitly not done for performance reasons.