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

Method readFromNBT

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

Reads the entity from NBT (calls an abstract helper method to read specialized data)

(NBTTagCompound tagCompund)

Source from the content-addressed store, hash-verified

1713 * Reads the entity from NBT (calls an abstract helper method to read specialized data)
1714 */
1715 public void readFromNBT(NBTTagCompound tagCompund)
1716 {
1717 try
1718 {
1719 NBTTagList nbttaglist = tagCompund.getTagList("Pos", 6);
1720 NBTTagList nbttaglist1 = tagCompund.getTagList("Motion", 6);
1721 NBTTagList nbttaglist2 = tagCompund.getTagList("Rotation", 5);
1722 this.motionX = nbttaglist1.getDoubleAt(0);
1723 this.motionY = nbttaglist1.getDoubleAt(1);
1724 this.motionZ = nbttaglist1.getDoubleAt(2);
1725
1726 if (Math.abs(this.motionX) > 10.0D)
1727 {
1728 this.motionX = 0.0D;
1729 }
1730
1731 if (Math.abs(this.motionY) > 10.0D)
1732 {
1733 this.motionY = 0.0D;
1734 }
1735
1736 if (Math.abs(this.motionZ) > 10.0D)
1737 {
1738 this.motionZ = 0.0D;
1739 }
1740
1741 this.prevPosX = this.lastTickPosX = this.posX = nbttaglist.getDoubleAt(0);
1742 this.prevPosY = this.lastTickPosY = this.posY = nbttaglist.getDoubleAt(1);
1743 this.prevPosZ = this.lastTickPosZ = this.posZ = nbttaglist.getDoubleAt(2);
1744 this.prevRotationYaw = this.rotationYaw = nbttaglist2.getFloatAt(0);
1745 this.prevRotationPitch = this.rotationPitch = nbttaglist2.getFloatAt(1);
1746 this.setRotationYawHead(this.rotationYaw);
1747 this.func_181013_g(this.rotationYaw);
1748 this.fallDistance = tagCompund.getFloat("FallDistance");
1749 this.fire = tagCompund.getShort("Fire");
1750 this.setAir(tagCompund.getShort("Air"));
1751 this.onGround = tagCompund.getBoolean("OnGround");
1752 this.dimension = tagCompund.getInteger("Dimension");
1753 this.invulnerable = tagCompund.getBoolean("Invulnerable");
1754 this.timeUntilPortal = tagCompund.getInteger("PortalCooldown");
1755
1756 if (tagCompund.hasKey("UUIDMost", 4) && tagCompund.hasKey("UUIDLeast", 4))
1757 {
1758 this.entityUniqueID = new UUID(tagCompund.getLong("UUIDMost"), tagCompund.getLong("UUIDLeast"));
1759 }
1760 else if (tagCompund.hasKey("UUID", 8))
1761 {
1762 this.entityUniqueID = UUID.fromString(tagCompund.getString("UUID"));
1763 }
1764
1765 this.setPosition(this.posX, this.posY, this.posZ);
1766 this.setRotation(this.rotationYaw, this.rotationPitch);
1767
1768 if (tagCompund.hasKey("CustomName", 8) && !tagCompund.getString("CustomName").isEmpty())
1769 {
1770 this.setCustomNameTag(tagCompund.getString("CustomName"));
1771 }
1772

Callers 4

processCommandMethod · 0.95
spawnNewEntityMethod · 0.95
createEntityFromNBTMethod · 0.95
copyDataFromOldMethod · 0.95

Calls 15

getDoubleAtMethod · 0.95
getFloatAtMethod · 0.95
setRotationYawHeadMethod · 0.95
func_181013_gMethod · 0.95
setAirMethod · 0.95
setPositionMethod · 0.95
setRotationMethod · 0.95
setCustomNameTagMethod · 0.95
setSilentMethod · 0.95
readEntityFromNBTMethod · 0.95

Tested by

no test coverage detected