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

Method writeToNBT

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

Save the entity to NBT (calls an abstract helper method to write extra data)

(NBTTagCompound tagCompund)

Source from the content-addressed store, hash-verified

1659 * Save the entity to NBT (calls an abstract helper method to write extra data)
1660 */
1661 public void writeToNBT(NBTTagCompound tagCompund)
1662 {
1663 try
1664 {
1665 tagCompund.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY, this.posZ}));
1666 tagCompund.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
1667 tagCompund.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
1668 tagCompund.setFloat("FallDistance", this.fallDistance);
1669 tagCompund.setShort("Fire", (short)this.fire);
1670 tagCompund.setShort("Air", (short)this.getAir());
1671 tagCompund.setBoolean("OnGround", this.onGround);
1672 tagCompund.setInteger("Dimension", this.dimension);
1673 tagCompund.setBoolean("Invulnerable", this.invulnerable);
1674 tagCompund.setInteger("PortalCooldown", this.timeUntilPortal);
1675 tagCompund.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
1676 tagCompund.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
1677
1678 if (this.getCustomNameTag() != null && !this.getCustomNameTag().isEmpty())
1679 {
1680 tagCompund.setString("CustomName", this.getCustomNameTag());
1681 tagCompund.setBoolean("CustomNameVisible", this.getAlwaysRenderNameTag());
1682 }
1683
1684 this.cmdResultStats.writeStatsToNBT(tagCompund);
1685
1686 if (this.isSilent())
1687 {
1688 tagCompund.setBoolean("Silent", this.isSilent());
1689 }
1690
1691 this.writeEntityToNBT(tagCompund);
1692
1693 if (this.ridingEntity != null)
1694 {
1695 NBTTagCompound nbttagcompound = new NBTTagCompound();
1696
1697 if (this.ridingEntity.writeMountToNBT(nbttagcompound))
1698 {
1699 tagCompund.setTag("Riding", nbttagcompound);
1700 }
1701 }
1702 }
1703 catch (Throwable throwable)
1704 {
1705 CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Saving entity NBT");
1706 CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being saved");
1707 this.addEntityCrashInfo(crashreportcategory);
1708 throw new ReportedException(crashreport);
1709 }
1710 }
1711
1712 /**
1713 * Reads the entity from NBT (calls an abstract helper method to read specialized data)

Callers 8

processCommandMethod · 0.95
processCommandMethod · 0.95
setPlayerMethod · 0.95
writeMountToNBTMethod · 0.95
writeToNBTOptionalMethod · 0.95
func_181036_aMethod · 0.45
copyDataFromOldMethod · 0.45
writeEntityToNBTMethod · 0.45

Calls 15

newDoubleNBTListMethod · 0.95
newFloatNBTListMethod · 0.95
getAirMethod · 0.95
getUniqueIDMethod · 0.95
getCustomNameTagMethod · 0.95
isSilentMethod · 0.95
writeEntityToNBTMethod · 0.95
makeCrashReportMethod · 0.95
makeCategoryMethod · 0.95
addEntityCrashInfoMethod · 0.95
setTagMethod · 0.80

Tested by 1

processCommandMethod · 0.76