public void addChunk(Chunk chunk) { add(LongHash.toLong(chunk.getX(), chunk.getZ())); }
protected void g() { super.g(); int i = 0; int j = 0; // CraftBukkit start // Iterator iterator = this.chunkTickList.iterator(); for (long chunkCoord : this.chunkTickList.popAll()) { int chunkX = LongHash.msw(chunkCoord); int chunkZ = LongHash.lsw(chunkCoord); // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); int k = chunkX * 16; int l = chunkZ * 16; this.methodProfiler.a("getChunk"); Chunk chunk = this.getChunkAt(chunkX, chunkZ); // CraftBukkit end this.a(k, l, chunk); this.methodProfiler.c("tickChunk"); chunk.k(); this.methodProfiler.c("thunder"); int i1; int j1; int k1; int l1; if (this.random.nextInt(100000) == 0 && this.Q() && this.P()) { this.k = this.k * 3 + 1013904223; i1 = this.k >> 2; j1 = k + (i1 & 15); k1 = l + (i1 >> 8 & 15); l1 = this.h(j1, k1); if (this.isRainingAt(j1, l1, k1)) { this.strikeLightning(new EntityLightning(this, (double) j1, (double) l1, (double) k1)); } } this.methodProfiler.c("iceandsnow"); int i2; if (this.random.nextInt(16) == 0) { this.k = this.k * 3 + 1013904223; i1 = this.k >> 2; j1 = i1 & 15; k1 = i1 >> 8 & 15; l1 = this.h(j1 + k, k1 + l); if (this.y(j1 + k, l1 - 1, k1 + l)) { // CraftBukkit start BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1 - 1, k1 + l).getState(); blockState.setTypeId(Block.ICE.id); BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState); this.getServer().getPluginManager().callEvent(iceBlockForm); if (!iceBlockForm.isCancelled()) { blockState.update(true); } // CraftBukkit end } if (this.Q() && this.z(j1 + k, l1, k1 + l)) { // CraftBukkit start BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1, k1 + l).getState(); blockState.setTypeId(Block.SNOW.id); BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState); this.getServer().getPluginManager().callEvent(snow); if (!snow.isCancelled()) { blockState.update(true); } // CraftBukkit end } if (this.Q()) { BiomeBase biomebase = this.getBiome(j1 + k, k1 + l); if (biomebase.d()) { i2 = this.getTypeId(j1 + k, l1 - 1, k1 + l); if (i2 != 0) { Block.byId[i2].g(this, j1 + k, l1 - 1, k1 + l); } } } } this.methodProfiler.c("tickTiles"); ChunkSection[] achunksection = chunk.i(); j1 = achunksection.length; for (k1 = 0; k1 < j1; ++k1) { ChunkSection chunksection = achunksection[k1]; if (chunksection != null && chunksection.shouldTick()) { for (int j2 = 0; j2 < 3; ++j2) { this.k = this.k * 3 + 1013904223; i2 = this.k >> 2; int k2 = i2 & 15; int l2 = i2 >> 8 & 15; int i3 = i2 >> 16 & 15; int j3 = chunksection.getTypeId(k2, i3, l2); ++j; Block block = Block.byId[j3]; if (block != null && block.isTicking()) { ++i; block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random); } } } } this.methodProfiler.b(); } }