MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / writeToNBTOptional

Method writeToNBTOptional

src/main/java/net/minecraft/entity/Entity.java:1642–1656  ·  view source on GitHub ↗

Either write this entity to the NBT tag given and return true, or return false without doing anything. If this returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their rider.

(NBTTagCompound tagCompund)

Source from the content-addressed store, hash-verified

1640 * rider.
1641 */
1642 public boolean writeToNBTOptional(NBTTagCompound tagCompund)
1643 {
1644 String s = this.getEntityString();
1645
1646 if (!this.isDead && s != null && this.riddenByEntity == null)
1647 {
1648 tagCompund.setString("id", s);
1649 this.writeToNBT(tagCompund);
1650 return true;
1651 }
1652 else
1653 {
1654 return false;
1655 }
1656 }
1657
1658 /**
1659 * Save the entity to NBT (calls an abstract helper method to write extra data)

Callers 3

spawnNewEntityMethod · 0.95
onItemUseMethod · 0.45
writeChunkToNBTMethod · 0.45

Calls 3

getEntityStringMethod · 0.95
writeToNBTMethod · 0.95
setStringMethod · 0.80

Tested by

no test coverage detected