Updates (and cleans up) entities and tile entities
()
| 1614 | * Updates (and cleans up) entities and tile entities |
| 1615 | */ |
| 1616 | public void updateEntities() |
| 1617 | { |
| 1618 | this.theProfiler.startSection("entities"); |
| 1619 | this.theProfiler.startSection("global"); |
| 1620 | |
| 1621 | for (int i = 0; i < this.weatherEffects.size(); ++i) |
| 1622 | { |
| 1623 | Entity entity = this.weatherEffects.get(i); |
| 1624 | |
| 1625 | try |
| 1626 | { |
| 1627 | ++entity.ticksExisted; |
| 1628 | entity.onUpdate(); |
| 1629 | } |
| 1630 | catch (Throwable throwable2) |
| 1631 | { |
| 1632 | CrashReport crashreport = CrashReport.makeCrashReport(throwable2, "Ticking entity"); |
| 1633 | CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being ticked"); |
| 1634 | |
| 1635 | if (entity == null) |
| 1636 | { |
| 1637 | crashreportcategory.addCrashSection("Entity", "~~NULL~~"); |
| 1638 | } |
| 1639 | else |
| 1640 | { |
| 1641 | entity.addEntityCrashInfo(crashreportcategory); |
| 1642 | } |
| 1643 | |
| 1644 | throw new ReportedException(crashreport); |
| 1645 | } |
| 1646 | |
| 1647 | if (entity.isDead) |
| 1648 | { |
| 1649 | this.weatherEffects.remove(i--); |
| 1650 | } |
| 1651 | } |
| 1652 | |
| 1653 | this.theProfiler.endStartSection("remove"); |
| 1654 | this.loadedEntityList.removeAll(this.unloadedEntityList); |
| 1655 | |
| 1656 | for (int k = 0; k < this.unloadedEntityList.size(); ++k) |
| 1657 | { |
| 1658 | Entity entity1 = this.unloadedEntityList.get(k); |
| 1659 | int j = entity1.chunkCoordX; |
| 1660 | int l1 = entity1.chunkCoordZ; |
| 1661 | |
| 1662 | if (entity1.addedToChunk && this.isChunkLoaded(j, l1, true)) |
| 1663 | { |
| 1664 | this.getChunkFromChunkCoords(j, l1).removeEntity(entity1); |
| 1665 | } |
| 1666 | } |
| 1667 | |
| 1668 | for (int l = 0; l < this.unloadedEntityList.size(); ++l) |
| 1669 | { |
| 1670 | this.onEntityRemoved(this.unloadedEntityList.get(l)); |
| 1671 | } |
| 1672 | |
| 1673 | this.unloadedEntityList.clear(); |
no test coverage detected