Runs a single tick for the world
()
| 164 | * Runs a single tick for the world |
| 165 | */ |
| 166 | public void tick() |
| 167 | { |
| 168 | super.tick(); |
| 169 | |
| 170 | if (this.getWorldInfo().isHardcoreModeEnabled() && this.getDifficulty() != EnumDifficulty.HARD) |
| 171 | { |
| 172 | this.getWorldInfo().setDifficulty(EnumDifficulty.HARD); |
| 173 | } |
| 174 | |
| 175 | this.provider.getWorldChunkManager().cleanupCache(); |
| 176 | |
| 177 | if (this.areAllPlayersAsleep()) |
| 178 | { |
| 179 | if (this.getGameRules().getGameRuleBooleanValue("doDaylightCycle")) |
| 180 | { |
| 181 | long i = this.worldInfo.getWorldTime() + 24000L; |
| 182 | this.worldInfo.setWorldTime(i - i % 24000L); |
| 183 | } |
| 184 | |
| 185 | this.wakeAllPlayers(); |
| 186 | } |
| 187 | |
| 188 | this.theProfiler.startSection("mobSpawner"); |
| 189 | |
| 190 | if (this.getGameRules().getGameRuleBooleanValue("doMobSpawning") && this.worldInfo.getTerrainType() != WorldType.DEBUG_WORLD) |
| 191 | { |
| 192 | this.mobSpawner.findChunksForSpawning(this, this.spawnHostileMobs, this.spawnPeacefulMobs, this.worldInfo.getWorldTotalTime() % 400L == 0L); |
| 193 | } |
| 194 | |
| 195 | this.theProfiler.endStartSection("chunkSource"); |
| 196 | this.chunkProvider.unloadQueuedChunks(); |
| 197 | int j = this.calculateSkylightSubtracted(1.0F); |
| 198 | |
| 199 | if (j != this.getSkylightSubtracted()) |
| 200 | { |
| 201 | this.setSkylightSubtracted(j); |
| 202 | } |
| 203 | |
| 204 | this.worldInfo.setWorldTotalTime(this.worldInfo.getWorldTotalTime() + 1L); |
| 205 | |
| 206 | if (this.getGameRules().getGameRuleBooleanValue("doDaylightCycle")) |
| 207 | { |
| 208 | this.worldInfo.setWorldTime(this.worldInfo.getWorldTime() + 1L); |
| 209 | } |
| 210 | |
| 211 | this.theProfiler.endStartSection("tickPending"); |
| 212 | this.tickUpdates(false); |
| 213 | this.theProfiler.endStartSection("tickBlocks"); |
| 214 | this.updateBlocks(); |
| 215 | this.theProfiler.endStartSection("chunkMap"); |
| 216 | this.thePlayerManager.updatePlayerInstances(); |
| 217 | this.theProfiler.endStartSection("village"); |
| 218 | this.villageCollectionObj.tick(); |
| 219 | this.villageSiege.tick(); |
| 220 | this.theProfiler.endStartSection("portalForcer"); |
| 221 | this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); |
| 222 | this.theProfiler.endSection(); |
| 223 | this.sendQueuedBlockEvents(); |
no test coverage detected