| 1 | package net.minecraft.world.chunk;
|
| 2 |
|
| 3 | import com.google.common.base.Predicate;
|
| 4 | import com.google.common.collect.Maps;
|
| 5 | import com.google.common.collect.Queues;
|
| 6 | import java.util.Arrays;
|
| 7 | import java.util.List;
|
| 8 | import java.util.Map;
|
| 9 | import java.util.Random;
|
| 10 | import java.util.concurrent.Callable;
|
| 11 | import java.util.concurrent.ConcurrentLinkedQueue;
|
| 12 | import net.minecraft.block.Block;
|
| 13 | import net.minecraft.block.ITileEntityProvider;
|
| 14 | import net.minecraft.block.material.Material;
|
| 15 | import net.minecraft.block.state.IBlockState;
|
| 16 | import net.minecraft.crash.CrashReport;
|
| 17 | import net.minecraft.crash.CrashReportCategory;
|
| 18 | import net.minecraft.entity.Entity;
|
| 19 | import net.minecraft.init.Blocks;
|
| 20 | import net.minecraft.tileentity.TileEntity;
|
| 21 | import net.minecraft.util.AxisAlignedBB;
|
| 22 | import net.minecraft.util.BlockPos;
|
| 23 | import net.minecraft.util.ClassInheritanceMultiMap;
|
| 24 | import net.minecraft.util.EnumFacing;
|
| 25 | import net.minecraft.util.MathHelper;
|
| 26 | import net.minecraft.util.ReportedException;
|
| 27 | import net.minecraft.world.ChunkCoordIntPair;
|
| 28 | import net.minecraft.world.EnumSkyBlock;
|
| 29 | import net.minecraft.world.World;
|
| 30 | import net.minecraft.world.WorldType;
|
| 31 | import net.minecraft.world.biome.BiomeGenBase;
|
| 32 | import net.minecraft.world.biome.WorldChunkManager;
|
| 33 | import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
| 34 | import net.minecraft.world.gen.ChunkProviderDebug;
|
| 35 | import org.apache.logging.log4j.LogManager;
|
| 36 | import org.apache.logging.log4j.Logger;
|
| 37 |
|
| 38 | public class Chunk
|
| 39 | {
|
| 40 | private static final Logger logger = LogManager.getLogger();
|
| 41 |
|
| 42 | /**
|
| 43 | * Used to store block IDs, block MSBs, Sky-light maps, Block-light maps, and metadata. Each entry corresponds to a
|
| 44 | * logical segment of 16x16x16 blocks, stacked vertically.
|
| 45 | */
|
| 46 | private final ExtendedBlockStorage[] storageArrays;
|
| 47 |
|
| 48 | /**
|
| 49 | * Contains a 16x16 mapping on the X/Z plane of the biome ID to which each colum belongs.
|
| 50 | */
|
| 51 | private final byte[] blockBiomeArray;
|
| 52 |
|
| 53 | /**
|
| 54 | * A map, similar to heightMap, that tracks how far down precipitation can fall.
|
| 55 | */
|
| 56 | private final int[] precipitationHeightMap;
|
| 57 |
|
| 58 | /** Which columns need their skylightMaps updated. */
|
| 59 | private final boolean[] updateSkylightColumns;
|
| 60 |
|
| 61 | /** Whether or not this Chunk is currently loaded into the World */
|
| 62 | private boolean isChunkLoaded;
|
| 63 |
|
| 64 | /** Reference to the World object. */
|
| 65 | private final World worldObj;
|
| 66 | private final int[] heightMap;
|
| 67 |
|
| 68 | /** The x coordinate of the chunk. */
|
| 69 | public final int xPosition;
|
| 70 |
|
| 71 | /** The z coordinate of the chunk. */
|
| 72 | public final int zPosition;
|
| 73 | private boolean isGapLightingUpdated;
|
| 74 | private final Map<BlockPos, TileEntity> chunkTileEntityMap;
|
| 75 | private final ClassInheritanceMultiMap<Entity>[] entityLists;
|
| 76 |
|
| 77 | /** Boolean value indicating if the terrain is populated. */
|
| 78 | private boolean isTerrainPopulated;
|
| 79 | private boolean isLightPopulated;
|
| 80 | private boolean field_150815_m;
|
| 81 |
|
| 82 | /**
|
| 83 | * Set to true if the chunk has been modified and needs to be updated internally.
|
| 84 | */
|
| 85 | private boolean isModified;
|
| 86 |
|
| 87 | /**
|
| 88 | * Whether this Chunk has any Entities and thus requires saving on every tick
|
| 89 | */
|
| 90 | private boolean hasEntities;
|
| 91 |
|
| 92 | /** The time according to World.worldTime when this chunk was last saved */
|
| 93 | private long lastSaveTime;
|
| 94 |
|
| 95 | /** Lowest value in the heightmap. */
|
| 96 | private int heightMapMinimum;
|
| 97 |
|
| 98 | /** the cumulative number of ticks players have been in this chunk */
|
| 99 | private long inhabitedTime;
|
| 100 |
|
| 101 | /**
|
| 102 | * Contains the current round-robin relight check index, and is implied as the relight check location as well.
|
| 103 | */
|
| 104 | private int queuedLightChecks;
|
| 105 | private ConcurrentLinkedQueue<BlockPos> tileEntityPosQueue;
|
| 106 |
|
| 107 | public Chunk(World worldIn, int x, int z)
|
| 108 | {
|
| 109 | this.storageArrays = new ExtendedBlockStorage[16];
|
| 110 | this.blockBiomeArray = new byte[256];
|
| 111 | this.precipitationHeightMap = new int[256];
|
| 112 | this.updateSkylightColumns = new boolean[256];
|
| 113 | this.chunkTileEntityMap = Maps.<BlockPos, TileEntity>newHashMap();
|
| 114 | this.queuedLightChecks = 4096;
|
| 115 | this.tileEntityPosQueue = Queues.<BlockPos>newConcurrentLinkedQueue();
|
| 116 | this.entityLists = (ClassInheritanceMultiMap[])(new ClassInheritanceMultiMap[16]);
|
| 117 | this.worldObj = worldIn;
|
| 118 | this.xPosition = x;
|
| 119 | this.zPosition = z;
|
| 120 | this.heightMap = new int[256];
|
| 121 |
|
| 122 | for (int i = 0; i < this.entityLists.length; ++i)
|
| 123 | {
|
| 124 | this.entityLists[i] = new ClassInheritanceMultiMap(Entity.class);
|
| 125 | }
|
| 126 |
|
| 127 | Arrays.fill((int[])this.precipitationHeightMap, (int) - 999);
|
| 128 | Arrays.fill(this.blockBiomeArray, (byte) - 1);
|
| 129 | }
|
| 130 |
|
| 131 | public Chunk(World worldIn, ChunkPrimer primer, int x, int z)
|
| 132 | {
|
| 133 | this(worldIn, x, z);
|
| 134 | int i = 256;
|
| 135 | boolean flag = !worldIn.provider.getHasNoSky();
|
| 136 |
|
| 137 | for (int j = 0; j < 16; ++j)
|
| 138 | {
|
| 139 | for (int k = 0; k < 16; ++k)
|
| 140 | {
|
| 141 | for (int l = 0; l < i; ++l)
|
| 142 | {
|
| 143 | int i1 = j * i * 16 | k * i | l;
|
| 144 | IBlockState iblockstate = primer.getBlockState(i1);
|
| 145 |
|
| 146 | if (iblockstate.getBlock().getMaterial() != Material.air)
|
| 147 | {
|
| 148 | int j1 = l >> 4;
|
| 149 |
|
| 150 | if (this.storageArrays[j1] == null)
|
| 151 | {
|
| 152 | this.storageArrays[j1] = new ExtendedBlockStorage(j1 << 4, flag);
|
| 153 | }
|
| 154 |
|
| 155 | this.storageArrays[j1].set(j, l & 15, k, iblockstate);
|
| 156 | }
|
| 157 | }
|
| 158 | }
|
| 159 | }
|
| 160 | }
|
| 161 |
|
| 162 | /**
|
| 163 | * Checks whether the chunk is at the X/Z location specified
|
| 164 | */
|
| 165 | public boolean isAtLocation(int x, int z)
|
| 166 | {
|
| 167 | return x == this.xPosition && z == this.zPosition;
|
| 168 | }
|
| 169 |
|
| 170 | public int getHeight(BlockPos pos)
|
| 171 | {
|
| 172 | return this.getHeightValue(pos.getX() & 15, pos.getZ() & 15);
|
| 173 | }
|
| 174 |
|
| 175 | /**
|
| 176 | * Returns the value in the height map at this x, z coordinate in the chunk
|
| 177 | */
|
| 178 | public int getHeightValue(int x, int z)
|
| 179 | {
|
| 180 | return this.heightMap[z << 4 | x];
|
| 181 | }
|
| 182 |
|
| 183 | /**
|
| 184 | * Returns the topmost ExtendedBlockStorage instance for this Chunk that actually contains a block.
|
| 185 | */
|
| 186 | public int getTopFilledSegment()
|
| 187 | {
|
| 188 | for (int i = this.storageArrays.length - 1; i >= 0; --i)
|
| 189 | {
|
| 190 | if (this.storageArrays[i] != null)
|
| 191 | {
|
| 192 | return this.storageArrays[i].getYLocation();
|
| 193 | }
|
| 194 | }
|
| 195 |
|
| 196 | return 0;
|
| 197 | }
|
| 198 |
|
| 199 | /**
|
| 200 | * Returns the ExtendedBlockStorage array for this Chunk.
|
| 201 | */
|
| 202 | public ExtendedBlockStorage[] getBlockStorageArray()
|
| 203 | {
|
| 204 | return this.storageArrays;
|
| 205 | }
|
| 206 |
|
| 207 | /**
|
| 208 | * Generates the height map for a chunk from scratch
|
| 209 | */
|
| 210 | protected void generateHeightMap()
|
| 211 | {
|
| 212 | int i = this.getTopFilledSegment();
|
| 213 | this.heightMapMinimum = Integer.MAX_VALUE;
|
| 214 |
|
| 215 | for (int j = 0; j < 16; ++j)
|
| 216 | {
|
| 217 | for (int k = 0; k < 16; ++k)
|
| 218 | {
|
| 219 | this.precipitationHeightMap[j + (k << 4)] = -999;
|
| 220 |
|
| 221 | for (int l = i + 16; l > 0; --l)
|
| 222 | {
|
| 223 | Block block = this.getBlock0(j, l - 1, k);
|
| 224 |
|
| 225 | if (block.getLightOpacity() != 0)
|
| 226 | {
|
| 227 | this.heightMap[k << 4 | j] = l;
|
| 228 |
|
| 229 | if (l < this.heightMapMinimum)
|
| 230 | {
|
| 231 | this.heightMapMinimum = l;
|
| 232 | }
|
| 233 |
|
| 234 | break;
|
| 235 | }
|
| 236 | }
|
| 237 | }
|
| 238 | }
|
| 239 |
|
| 240 | this.isModified = true;
|
| 241 | }
|
| 242 |
|
| 243 | /**
|
| 244 | * Generates the initial skylight map for the chunk upon generation or load.
|
| 245 | */
|
| 246 | public void generateSkylightMap()
|
| 247 | {
|
| 248 | int i = this.getTopFilledSegment();
|
| 249 | this.heightMapMinimum = Integer.MAX_VALUE;
|
| 250 |
|
| 251 | for (int j = 0; j < 16; ++j)
|
| 252 | {
|
| 253 | for (int k = 0; k < 16; ++k)
|
| 254 | {
|
| 255 | this.precipitationHeightMap[j + (k << 4)] = -999;
|
| 256 |
|
| 257 | for (int l = i + 16; l > 0; --l)
|
| 258 | {
|
| 259 | if (this.getBlockLightOpacity(j, l - 1, k) != 0)
|
| 260 | {
|
| 261 | this.heightMap[k << 4 | j] = l;
|
| 262 |
|
| 263 | if (l < this.heightMapMinimum)
|
| 264 | {
|
| 265 | this.heightMapMinimum = l;
|
| 266 | }
|
| 267 |
|
| 268 | break;
|
| 269 | }
|
| 270 | }
|
| 271 |
|
| 272 | if (!this.worldObj.provider.getHasNoSky())
|
| 273 | {
|
| 274 | int k1 = 15;
|
| 275 | int i1 = i + 16 - 1;
|
| 276 |
|
| 277 | while (true)
|
| 278 | {
|
| 279 | int j1 = this.getBlockLightOpacity(j, i1, k);
|
| 280 |
|
| 281 | if (j1 == 0 && k1 != 15)
|
| 282 | {
|
| 283 | j1 = 1;
|
| 284 | }
|
| 285 |
|
| 286 | k1 -= j1;
|
| 287 |
|
| 288 | if (k1 > 0)
|
| 289 | {
|
| 290 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[i1 >> 4];
|
| 291 |
|
| 292 | if (extendedblockstorage != null)
|
| 293 | {
|
| 294 | extendedblockstorage.setExtSkylightValue(j, i1 & 15, k, k1);
|
| 295 | this.worldObj.notifyLightSet(new BlockPos((this.xPosition << 4) + j, i1, (this.zPosition << 4) + k));
|
| 296 | }
|
| 297 | }
|
| 298 |
|
| 299 | --i1;
|
| 300 |
|
| 301 | if (i1 <= 0 || k1 <= 0)
|
| 302 | {
|
| 303 | break;
|
| 304 | }
|
| 305 | }
|
| 306 | }
|
| 307 | }
|
| 308 | }
|
| 309 |
|
| 310 | this.isModified = true;
|
| 311 | }
|
| 312 |
|
| 313 | /**
|
| 314 | * Propagates a given sky-visible block's light value downward and upward to neighboring blocks as necessary.
|
| 315 | */
|
| 316 | private void propagateSkylightOcclusion(int x, int z)
|
| 317 | {
|
| 318 | this.updateSkylightColumns[x + z * 16] = true;
|
| 319 | this.isGapLightingUpdated = true;
|
| 320 | }
|
| 321 |
|
| 322 | private void recheckGaps(boolean p_150803_1_)
|
| 323 | {
|
| 324 | this.worldObj.theProfiler.startSection("recheckGaps");
|
| 325 |
|
| 326 | if (this.worldObj.isAreaLoaded(new BlockPos(this.xPosition * 16 + 8, 0, this.zPosition * 16 + 8), 16))
|
| 327 | {
|
| 328 | for (int i = 0; i < 16; ++i)
|
| 329 | {
|
| 330 | for (int j = 0; j < 16; ++j)
|
| 331 | {
|
| 332 | if (this.updateSkylightColumns[i + j * 16])
|
| 333 | {
|
| 334 | this.updateSkylightColumns[i + j * 16] = false;
|
| 335 | int k = this.getHeightValue(i, j);
|
| 336 | int l = this.xPosition * 16 + i;
|
| 337 | int i1 = this.zPosition * 16 + j;
|
| 338 | int j1 = Integer.MAX_VALUE;
|
| 339 |
|
| 340 | for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
|
| 341 | {
|
| 342 | j1 = Math.min(j1, this.worldObj.getChunksLowestHorizon(l + enumfacing.getFrontOffsetX(), i1 + enumfacing.getFrontOffsetZ()));
|
| 343 | }
|
| 344 |
|
| 345 | this.checkSkylightNeighborHeight(l, i1, j1);
|
| 346 |
|
| 347 | for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
|
| 348 | {
|
| 349 | this.checkSkylightNeighborHeight(l + enumfacing1.getFrontOffsetX(), i1 + enumfacing1.getFrontOffsetZ(), k);
|
| 350 | }
|
| 351 |
|
| 352 | if (p_150803_1_)
|
| 353 | {
|
| 354 | this.worldObj.theProfiler.endSection();
|
| 355 | return;
|
| 356 | }
|
| 357 | }
|
| 358 | }
|
| 359 | }
|
| 360 |
|
| 361 | this.isGapLightingUpdated = false;
|
| 362 | }
|
| 363 |
|
| 364 | this.worldObj.theProfiler.endSection();
|
| 365 | }
|
| 366 |
|
| 367 | /**
|
| 368 | * Checks the height of a block next to a sky-visible block and schedules a lighting update as necessary.
|
| 369 | */
|
| 370 | private void checkSkylightNeighborHeight(int x, int z, int maxValue)
|
| 371 | {
|
| 372 | int i = this.worldObj.getHeight(new BlockPos(x, 0, z)).getY();
|
| 373 |
|
| 374 | if (i > maxValue)
|
| 375 | {
|
| 376 | this.updateSkylightNeighborHeight(x, z, maxValue, i + 1);
|
| 377 | }
|
| 378 | else if (i < maxValue)
|
| 379 | {
|
| 380 | this.updateSkylightNeighborHeight(x, z, i, maxValue + 1);
|
| 381 | }
|
| 382 | }
|
| 383 |
|
| 384 | private void updateSkylightNeighborHeight(int x, int z, int startY, int endY)
|
| 385 | {
|
| 386 | if (endY > startY && this.worldObj.isAreaLoaded(new BlockPos(x, 0, z), 16))
|
| 387 | {
|
| 388 | for (int i = startY; i < endY; ++i)
|
| 389 | {
|
| 390 | this.worldObj.checkLightFor(EnumSkyBlock.SKY, new BlockPos(x, i, z));
|
| 391 | }
|
| 392 |
|
| 393 | this.isModified = true;
|
| 394 | }
|
| 395 | }
|
| 396 |
|
| 397 | /**
|
| 398 | * Initiates the recalculation of both the block-light and sky-light for a given block inside a chunk.
|
| 399 | */
|
| 400 | private void relightBlock(int x, int y, int z)
|
| 401 | {
|
| 402 | int i = this.heightMap[z << 4 | x] & 255;
|
| 403 | int j = i;
|
| 404 |
|
| 405 | if (y > i)
|
| 406 | {
|
| 407 | j = y;
|
| 408 | }
|
| 409 |
|
| 410 | while (j > 0 && this.getBlockLightOpacity(x, j - 1, z) == 0)
|
| 411 | {
|
| 412 | --j;
|
| 413 | }
|
| 414 |
|
| 415 | if (j != i)
|
| 416 | {
|
| 417 | this.worldObj.markBlocksDirtyVertical(x + this.xPosition * 16, z + this.zPosition * 16, j, i);
|
| 418 | this.heightMap[z << 4 | x] = j;
|
| 419 | int k = this.xPosition * 16 + x;
|
| 420 | int l = this.zPosition * 16 + z;
|
| 421 |
|
| 422 | if (!this.worldObj.provider.getHasNoSky())
|
| 423 | {
|
| 424 | if (j < i)
|
| 425 | {
|
| 426 | for (int j1 = j; j1 < i; ++j1)
|
| 427 | {
|
| 428 | ExtendedBlockStorage extendedblockstorage2 = this.storageArrays[j1 >> 4];
|
| 429 |
|
| 430 | if (extendedblockstorage2 != null)
|
| 431 | {
|
| 432 | extendedblockstorage2.setExtSkylightValue(x, j1 & 15, z, 15);
|
| 433 | this.worldObj.notifyLightSet(new BlockPos((this.xPosition << 4) + x, j1, (this.zPosition << 4) + z));
|
| 434 | }
|
| 435 | }
|
| 436 | }
|
| 437 | else
|
| 438 | {
|
| 439 | for (int i1 = i; i1 < j; ++i1)
|
| 440 | {
|
| 441 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[i1 >> 4];
|
| 442 |
|
| 443 | if (extendedblockstorage != null)
|
| 444 | {
|
| 445 | extendedblockstorage.setExtSkylightValue(x, i1 & 15, z, 0);
|
| 446 | this.worldObj.notifyLightSet(new BlockPos((this.xPosition << 4) + x, i1, (this.zPosition << 4) + z));
|
| 447 | }
|
| 448 | }
|
| 449 | }
|
| 450 |
|
| 451 | int k1 = 15;
|
| 452 |
|
| 453 | while (j > 0 && k1 > 0)
|
| 454 | {
|
| 455 | --j;
|
| 456 | int i2 = this.getBlockLightOpacity(x, j, z);
|
| 457 |
|
| 458 | if (i2 == 0)
|
| 459 | {
|
| 460 | i2 = 1;
|
| 461 | }
|
| 462 |
|
| 463 | k1 -= i2;
|
| 464 |
|
| 465 | if (k1 < 0)
|
| 466 | {
|
| 467 | k1 = 0;
|
| 468 | }
|
| 469 |
|
| 470 | ExtendedBlockStorage extendedblockstorage1 = this.storageArrays[j >> 4];
|
| 471 |
|
| 472 | if (extendedblockstorage1 != null)
|
| 473 | {
|
| 474 | extendedblockstorage1.setExtSkylightValue(x, j & 15, z, k1);
|
| 475 | }
|
| 476 | }
|
| 477 | }
|
| 478 |
|
| 479 | int l1 = this.heightMap[z << 4 | x];
|
| 480 | int j2 = i;
|
| 481 | int k2 = l1;
|
| 482 |
|
| 483 | if (l1 < i)
|
| 484 | {
|
| 485 | j2 = l1;
|
| 486 | k2 = i;
|
| 487 | }
|
| 488 |
|
| 489 | if (l1 < this.heightMapMinimum)
|
| 490 | {
|
| 491 | this.heightMapMinimum = l1;
|
| 492 | }
|
| 493 |
|
| 494 | if (!this.worldObj.provider.getHasNoSky())
|
| 495 | {
|
| 496 | for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
|
| 497 | {
|
| 498 | this.updateSkylightNeighborHeight(k + enumfacing.getFrontOffsetX(), l + enumfacing.getFrontOffsetZ(), j2, k2);
|
| 499 | }
|
| 500 |
|
| 501 | this.updateSkylightNeighborHeight(k, l, j2, k2);
|
| 502 | }
|
| 503 |
|
| 504 | this.isModified = true;
|
| 505 | }
|
| 506 | }
|
| 507 |
|
| 508 | public int getBlockLightOpacity(BlockPos pos)
|
| 509 | {
|
| 510 | return this.getBlock(pos).getLightOpacity();
|
| 511 | }
|
| 512 |
|
| 513 | private int getBlockLightOpacity(int x, int y, int z)
|
| 514 | {
|
| 515 | return this.getBlock0(x, y, z).getLightOpacity();
|
| 516 | }
|
| 517 |
|
| 518 | /**
|
| 519 | * Returns the block corresponding to the given coordinates inside a chunk.
|
| 520 | */
|
| 521 | private Block getBlock0(int x, int y, int z)
|
| 522 | {
|
| 523 | Block block = Blocks.air;
|
| 524 |
|
| 525 | if (y >= 0 && y >> 4 < this.storageArrays.length)
|
| 526 | {
|
| 527 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4];
|
| 528 |
|
| 529 | if (extendedblockstorage != null)
|
| 530 | {
|
| 531 | try
|
| 532 | {
|
| 533 | block = extendedblockstorage.getBlockByExtId(x, y & 15, z);
|
| 534 | }
|
| 535 | catch (Throwable throwable)
|
| 536 | {
|
| 537 | CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block");
|
| 538 | throw new ReportedException(crashreport);
|
| 539 | }
|
| 540 | }
|
| 541 | }
|
| 542 |
|
| 543 | return block;
|
| 544 | }
|
| 545 |
|
| 546 | public Block getBlock(final int x, final int y, final int z)
|
| 547 | {
|
| 548 | try
|
| 549 | {
|
| 550 | return this.getBlock0(x & 15, y, z & 15);
|
| 551 | }
|
| 552 | catch (ReportedException reportedexception)
|
| 553 | {
|
| 554 | CrashReportCategory crashreportcategory = reportedexception.getCrashReport().makeCategory("Block being got");
|
| 555 | crashreportcategory.addCrashSectionCallable("Location", new Callable<String>()
|
| 556 | {
|
| 557 | public String call() throws Exception
|
| 558 | {
|
| 559 | return CrashReportCategory.getCoordinateInfo(new BlockPos(Chunk.this.xPosition * 16 + x, y, Chunk.this.zPosition * 16 + z));
|
| 560 | }
|
| 561 | });
|
| 562 | throw reportedexception;
|
| 563 | }
|
| 564 | }
|
| 565 |
|
| 566 | public Block getBlock(final BlockPos pos)
|
| 567 | {
|
| 568 | try
|
| 569 | {
|
| 570 | return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15);
|
| 571 | }
|
| 572 | catch (ReportedException reportedexception)
|
| 573 | {
|
| 574 | CrashReportCategory crashreportcategory = reportedexception.getCrashReport().makeCategory("Block being got");
|
| 575 | crashreportcategory.addCrashSectionCallable("Location", new Callable<String>()
|
| 576 | {
|
| 577 | public String call() throws Exception
|
| 578 | {
|
| 579 | return CrashReportCategory.getCoordinateInfo(pos);
|
| 580 | }
|
| 581 | });
|
| 582 | throw reportedexception;
|
| 583 | }
|
| 584 | }
|
| 585 |
|
| 586 | public IBlockState getBlockState(final BlockPos pos)
|
| 587 | {
|
| 588 | if (this.worldObj.getWorldType() == WorldType.DEBUG_WORLD)
|
| 589 | {
|
| 590 | IBlockState iblockstate = null;
|
| 591 |
|
| 592 | if (pos.getY() == 60)
|
| 593 | {
|
| 594 | iblockstate = Blocks.barrier.getDefaultState();
|
| 595 | }
|
| 596 |
|
| 597 | if (pos.getY() == 70)
|
| 598 | {
|
| 599 | iblockstate = ChunkProviderDebug.func_177461_b(pos.getX(), pos.getZ());
|
| 600 | }
|
| 601 |
|
| 602 | return iblockstate == null ? Blocks.air.getDefaultState() : iblockstate;
|
| 603 | }
|
| 604 | else
|
| 605 | {
|
| 606 | try
|
| 607 | {
|
| 608 | if (pos.getY() >= 0 && pos.getY() >> 4 < this.storageArrays.length)
|
| 609 | {
|
| 610 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[pos.getY() >> 4];
|
| 611 |
|
| 612 | if (extendedblockstorage != null)
|
| 613 | {
|
| 614 | int j = pos.getX() & 15;
|
| 615 | int k = pos.getY() & 15;
|
| 616 | int i = pos.getZ() & 15;
|
| 617 | return extendedblockstorage.get(j, k, i);
|
| 618 | }
|
| 619 | }
|
| 620 |
|
| 621 | return Blocks.air.getDefaultState();
|
| 622 | }
|
| 623 | catch (Throwable throwable)
|
| 624 | {
|
| 625 | CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block state");
|
| 626 | CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being got");
|
| 627 | crashreportcategory.addCrashSectionCallable("Location", new Callable<String>()
|
| 628 | {
|
| 629 | public String call() throws Exception
|
| 630 | {
|
| 631 | return CrashReportCategory.getCoordinateInfo(pos);
|
| 632 | }
|
| 633 | });
|
| 634 | throw new ReportedException(crashreport);
|
| 635 | }
|
| 636 | }
|
| 637 | }
|
| 638 |
|
| 639 | /**
|
| 640 | * Return the metadata corresponding to the given coordinates inside a chunk.
|
| 641 | */
|
| 642 | private int getBlockMetadata(int x, int y, int z)
|
| 643 | {
|
| 644 | if (y >> 4 >= this.storageArrays.length)
|
| 645 | {
|
| 646 | return 0;
|
| 647 | }
|
| 648 | else
|
| 649 | {
|
| 650 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4];
|
| 651 | return extendedblockstorage != null ? extendedblockstorage.getExtBlockMetadata(x, y & 15, z) : 0;
|
| 652 | }
|
| 653 | }
|
| 654 |
|
| 655 | public int getBlockMetadata(BlockPos pos)
|
| 656 | {
|
| 657 | return this.getBlockMetadata(pos.getX() & 15, pos.getY(), pos.getZ() & 15);
|
| 658 | }
|
| 659 |
|
| 660 | public IBlockState setBlockState(BlockPos pos, IBlockState state)
|
| 661 | {
|
| 662 | int i = pos.getX() & 15;
|
| 663 | int j = pos.getY();
|
| 664 | int k = pos.getZ() & 15;
|
| 665 | int l = k << 4 | i;
|
| 666 |
|
| 667 | if (j >= this.precipitationHeightMap[l] - 1)
|
| 668 | {
|
| 669 | this.precipitationHeightMap[l] = -999;
|
| 670 | }
|
| 671 |
|
| 672 | int i1 = this.heightMap[l];
|
| 673 | IBlockState iblockstate = this.getBlockState(pos);
|
| 674 |
|
| 675 | if (iblockstate == state)
|
| 676 | {
|
| 677 | return null;
|
| 678 | }
|
| 679 | else
|
| 680 | {
|
| 681 | Block block = state.getBlock();
|
| 682 | Block block1 = iblockstate.getBlock();
|
| 683 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];
|
| 684 | boolean flag = false;
|
| 685 |
|
| 686 | if (extendedblockstorage == null)
|
| 687 | {
|
| 688 | if (block == Blocks.air)
|
| 689 | {
|
| 690 | return null;
|
| 691 | }
|
| 692 |
|
| 693 | extendedblockstorage = this.storageArrays[j >> 4] = new ExtendedBlockStorage(j >> 4 << 4, !this.worldObj.provider.getHasNoSky());
|
| 694 | flag = j >= i1;
|
| 695 | }
|
| 696 |
|
| 697 | extendedblockstorage.set(i, j & 15, k, state);
|
| 698 |
|
| 699 | if (block1 != block)
|
| 700 | {
|
| 701 | if (!this.worldObj.isRemote)
|
| 702 | {
|
| 703 | block1.breakBlock(this.worldObj, pos, iblockstate);
|
| 704 | }
|
| 705 | else if (block1 instanceof ITileEntityProvider)
|
| 706 | {
|
| 707 | this.worldObj.removeTileEntity(pos);
|
| 708 | }
|
| 709 | }
|
| 710 |
|
| 711 | if (extendedblockstorage.getBlockByExtId(i, j & 15, k) != block)
|
| 712 | {
|
| 713 | return null;
|
| 714 | }
|
| 715 | else
|
| 716 | {
|
| 717 | if (flag)
|
| 718 | {
|
| 719 | this.generateSkylightMap();
|
| 720 | }
|
| 721 | else
|
| 722 | {
|
| 723 | int j1 = block.getLightOpacity();
|
| 724 | int k1 = block1.getLightOpacity();
|
| 725 |
|
| 726 | if (j1 > 0)
|
| 727 | {
|
| 728 | if (j >= i1)
|
| 729 | {
|
| 730 | this.relightBlock(i, j + 1, k);
|
| 731 | }
|
| 732 | }
|
| 733 | else if (j == i1 - 1)
|
| 734 | {
|
| 735 | this.relightBlock(i, j, k);
|
| 736 | }
|
| 737 |
|
| 738 | if (j1 != k1 && (j1 < k1 || this.getLightFor(EnumSkyBlock.SKY, pos) > 0 || this.getLightFor(EnumSkyBlock.BLOCK, pos) > 0))
|
| 739 | {
|
| 740 | this.propagateSkylightOcclusion(i, k);
|
| 741 | }
|
| 742 | }
|
| 743 |
|
| 744 | if (block1 instanceof ITileEntityProvider)
|
| 745 | {
|
| 746 | TileEntity tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);
|
| 747 |
|
| 748 | if (tileentity != null)
|
| 749 | {
|
| 750 | tileentity.updateContainingBlockInfo();
|
| 751 | }
|
| 752 | }
|
| 753 |
|
| 754 | if (!this.worldObj.isRemote && block1 != block)
|
| 755 | {
|
| 756 | block.onBlockAdded(this.worldObj, pos, state);
|
| 757 | }
|
| 758 |
|
| 759 | if (block instanceof ITileEntityProvider)
|
| 760 | {
|
| 761 | TileEntity tileentity1 = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);
|
| 762 |
|
| 763 | if (tileentity1 == null)
|
| 764 | {
|
| 765 | tileentity1 = ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, block.getMetaFromState(state));
|
| 766 | this.worldObj.setTileEntity(pos, tileentity1);
|
| 767 | }
|
| 768 |
|
| 769 | if (tileentity1 != null)
|
| 770 | {
|
| 771 | tileentity1.updateContainingBlockInfo();
|
| 772 | }
|
| 773 | }
|
| 774 |
|
| 775 | this.isModified = true;
|
| 776 | return iblockstate;
|
| 777 | }
|
| 778 | }
|
| 779 | }
|
| 780 |
|
| 781 | public int getLightFor(EnumSkyBlock p_177413_1_, BlockPos pos)
|
| 782 | {
|
| 783 | int i = pos.getX() & 15;
|
| 784 | int j = pos.getY();
|
| 785 | int k = pos.getZ() & 15;
|
| 786 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];
|
| 787 | return extendedblockstorage == null ? (this.canSeeSky(pos) ? p_177413_1_.defaultLightValue : 0) : (p_177413_1_ == EnumSkyBlock.SKY ? (this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k)) : (p_177413_1_ == EnumSkyBlock.BLOCK ? extendedblockstorage.getExtBlocklightValue(i, j & 15, k) : p_177413_1_.defaultLightValue));
|
| 788 | }
|
| 789 |
|
| 790 | public void setLightFor(EnumSkyBlock p_177431_1_, BlockPos pos, int value)
|
| 791 | {
|
| 792 | int i = pos.getX() & 15;
|
| 793 | int j = pos.getY();
|
| 794 | int k = pos.getZ() & 15;
|
| 795 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];
|
| 796 |
|
| 797 | if (extendedblockstorage == null)
|
| 798 | {
|
| 799 | extendedblockstorage = this.storageArrays[j >> 4] = new ExtendedBlockStorage(j >> 4 << 4, !this.worldObj.provider.getHasNoSky());
|
| 800 | this.generateSkylightMap();
|
| 801 | }
|
| 802 |
|
| 803 | this.isModified = true;
|
| 804 |
|
| 805 | if (p_177431_1_ == EnumSkyBlock.SKY)
|
| 806 | {
|
| 807 | if (!this.worldObj.provider.getHasNoSky())
|
| 808 | {
|
| 809 | extendedblockstorage.setExtSkylightValue(i, j & 15, k, value);
|
| 810 | }
|
| 811 | }
|
| 812 | else if (p_177431_1_ == EnumSkyBlock.BLOCK)
|
| 813 | {
|
| 814 | extendedblockstorage.setExtBlocklightValue(i, j & 15, k, value);
|
| 815 | }
|
| 816 | }
|
| 817 |
|
| 818 | public int getLightSubtracted(BlockPos pos, int amount)
|
| 819 | {
|
| 820 | int i = pos.getX() & 15;
|
| 821 | int j = pos.getY();
|
| 822 | int k = pos.getZ() & 15;
|
| 823 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];
|
| 824 |
|
| 825 | if (extendedblockstorage == null)
|
| 826 | {
|
| 827 | return !this.worldObj.provider.getHasNoSky() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
|
| 828 | }
|
| 829 | else
|
| 830 | {
|
| 831 | int l = this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
|
| 832 | l = l - amount;
|
| 833 | int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);
|
| 834 |
|
| 835 | if (i1 > l)
|
| 836 | {
|
| 837 | l = i1;
|
| 838 | }
|
| 839 |
|
| 840 | return l;
|
| 841 | }
|
| 842 | }
|
| 843 |
|
| 844 | /**
|
| 845 | * Adds an entity to the chunk. Args: entity
|
| 846 | */
|
| 847 | public void addEntity(Entity entityIn)
|
| 848 | {
|
| 849 | this.hasEntities = true;
|
| 850 | int i = MathHelper.floor_double(entityIn.posX / 16.0D);
|
| 851 | int j = MathHelper.floor_double(entityIn.posZ / 16.0D);
|
| 852 |
|
| 853 | if (i != this.xPosition || j != this.zPosition)
|
| 854 | {
|
| 855 | logger.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.xPosition + ", " + this.zPosition + "), " + entityIn, new Object[] {entityIn});
|
| 856 | entityIn.setDead();
|
| 857 | }
|
| 858 |
|
| 859 | int k = MathHelper.floor_double(entityIn.posY / 16.0D);
|
| 860 |
|
| 861 | if (k < 0)
|
| 862 | {
|
| 863 | k = 0;
|
| 864 | }
|
| 865 |
|
| 866 | if (k >= this.entityLists.length)
|
| 867 | {
|
| 868 | k = this.entityLists.length - 1;
|
| 869 | }
|
| 870 |
|
| 871 | entityIn.addedToChunk = true;
|
| 872 | entityIn.chunkCoordX = this.xPosition;
|
| 873 | entityIn.chunkCoordY = k;
|
| 874 | entityIn.chunkCoordZ = this.zPosition;
|
| 875 | this.entityLists[k].add(entityIn);
|
| 876 | }
|
| 877 |
|
| 878 | /**
|
| 879 | * removes entity using its y chunk coordinate as its index
|
| 880 | */
|
| 881 | public void removeEntity(Entity entityIn)
|
| 882 | {
|
| 883 | this.removeEntityAtIndex(entityIn, entityIn.chunkCoordY);
|
| 884 | }
|
| 885 |
|
| 886 | /**
|
| 887 | * Removes entity at the specified index from the entity array.
|
| 888 | */
|
| 889 | public void removeEntityAtIndex(Entity entityIn, int p_76608_2_)
|
| 890 | {
|
| 891 | if (p_76608_2_ < 0)
|
| 892 | {
|
| 893 | p_76608_2_ = 0;
|
| 894 | }
|
| 895 |
|
| 896 | if (p_76608_2_ >= this.entityLists.length)
|
| 897 | {
|
| 898 | p_76608_2_ = this.entityLists.length - 1;
|
| 899 | }
|
| 900 |
|
| 901 | this.entityLists[p_76608_2_].remove(entityIn);
|
| 902 | }
|
| 903 |
|
| 904 | public boolean canSeeSky(BlockPos pos)
|
| 905 | {
|
| 906 | int i = pos.getX() & 15;
|
| 907 | int j = pos.getY();
|
| 908 | int k = pos.getZ() & 15;
|
| 909 | return j >= this.heightMap[k << 4 | i];
|
| 910 | }
|
| 911 |
|
| 912 | private TileEntity createNewTileEntity(BlockPos pos)
|
| 913 | {
|
| 914 | Block block = this.getBlock(pos);
|
| 915 | return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos));
|
| 916 | }
|
| 917 |
|
| 918 | public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_)
|
| 919 | {
|
| 920 | TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos);
|
| 921 |
|
| 922 | if (tileentity == null)
|
| 923 | {
|
| 924 | if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE)
|
| 925 | {
|
| 926 | tileentity = this.createNewTileEntity(pos);
|
| 927 | this.worldObj.setTileEntity(pos, tileentity);
|
| 928 | }
|
| 929 | else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED)
|
| 930 | {
|
| 931 | this.tileEntityPosQueue.add(pos);
|
| 932 | }
|
| 933 | }
|
| 934 | else if (tileentity.isInvalid())
|
| 935 | {
|
| 936 | this.chunkTileEntityMap.remove(pos);
|
| 937 | return null;
|
| 938 | }
|
| 939 |
|
| 940 | return tileentity;
|
| 941 | }
|
| 942 |
|
| 943 | public void addTileEntity(TileEntity tileEntityIn)
|
| 944 | {
|
| 945 | this.addTileEntity(tileEntityIn.getPos(), tileEntityIn);
|
| 946 |
|
| 947 | if (this.isChunkLoaded)
|
| 948 | {
|
| 949 | this.worldObj.addTileEntity(tileEntityIn);
|
| 950 | }
|
| 951 | }
|
| 952 |
|
| 953 | public void addTileEntity(BlockPos pos, TileEntity tileEntityIn)
|
| 954 | {
|
| 955 | tileEntityIn.setWorldObj(this.worldObj);
|
| 956 | tileEntityIn.setPos(pos);
|
| 957 |
|
| 958 | if (this.getBlock(pos) instanceof ITileEntityProvider)
|
| 959 | {
|
| 960 | if (this.chunkTileEntityMap.containsKey(pos))
|
| 961 | {
|
| 962 | ((TileEntity)this.chunkTileEntityMap.get(pos)).invalidate();
|
| 963 | }
|
| 964 |
|
| 965 | tileEntityIn.validate();
|
| 966 | this.chunkTileEntityMap.put(pos, tileEntityIn);
|
| 967 | }
|
| 968 | }
|
| 969 |
|
| 970 | public void removeTileEntity(BlockPos pos)
|
| 971 | {
|
| 972 | if (this.isChunkLoaded)
|
| 973 | {
|
| 974 | TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.remove(pos);
|
| 975 |
|
| 976 | if (tileentity != null)
|
| 977 | {
|
| 978 | tileentity.invalidate();
|
| 979 | }
|
| 980 | }
|
| 981 | }
|
| 982 |
|
| 983 | /**
|
| 984 | * Called when this Chunk is loaded by the ChunkProvider
|
| 985 | */
|
| 986 | public void onChunkLoad()
|
| 987 | {
|
| 988 | this.isChunkLoaded = true;
|
| 989 | this.worldObj.addTileEntities(this.chunkTileEntityMap.values());
|
| 990 |
|
| 991 | for (int i = 0; i < this.entityLists.length; ++i)
|
| 992 | {
|
| 993 | for (Entity entity : this.entityLists[i])
|
| 994 | {
|
| 995 | entity.onChunkLoad();
|
| 996 | }
|
| 997 |
|
| 998 | this.worldObj.loadEntities(this.entityLists[i]);
|
| 999 | }
|
| 1000 | }
|
| 1001 |
|
| 1002 | /**
|
| 1003 | * Called when this Chunk is unloaded by the ChunkProvider
|
| 1004 | */
|
| 1005 | public void onChunkUnload()
|
| 1006 | {
|
| 1007 | this.isChunkLoaded = false;
|
| 1008 |
|
| 1009 | for (TileEntity tileentity : this.chunkTileEntityMap.values())
|
| 1010 | {
|
| 1011 | this.worldObj.markTileEntityForRemoval(tileentity);
|
| 1012 | }
|
| 1013 |
|
| 1014 | for (int i = 0; i < this.entityLists.length; ++i)
|
| 1015 | {
|
| 1016 | this.worldObj.unloadEntities(this.entityLists[i]);
|
| 1017 | }
|
| 1018 | }
|
| 1019 |
|
| 1020 | /**
|
| 1021 | * Sets the isModified flag for this Chunk
|
| 1022 | */
|
| 1023 | public void setChunkModified()
|
| 1024 | {
|
| 1025 | this.isModified = true;
|
| 1026 | }
|
| 1027 |
|
| 1028 | /**
|
| 1029 | * Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity.
|
| 1030 | */
|
| 1031 | public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List<Entity> listToFill, Predicate <? super Entity > p_177414_4_)
|
| 1032 | {
|
| 1033 | int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D);
|
| 1034 | int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D);
|
| 1035 | i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1);
|
| 1036 | j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1);
|
| 1037 |
|
| 1038 | for (int k = i; k <= j; ++k)
|
| 1039 | {
|
| 1040 | if (!this.entityLists[k].isEmpty())
|
| 1041 | {
|
| 1042 | for (Entity entity : this.entityLists[k])
|
| 1043 | {
|
| 1044 | if (entity.getEntityBoundingBox().intersectsWith(aabb) && entity != entityIn)
|
| 1045 | {
|
| 1046 | if (p_177414_4_ == null || p_177414_4_.apply(entity))
|
| 1047 | {
|
| 1048 | listToFill.add(entity);
|
| 1049 | }
|
| 1050 |
|
| 1051 | Entity[] aentity = entity.getParts();
|
| 1052 |
|
| 1053 | if (aentity != null)
|
| 1054 | {
|
| 1055 | for (int l = 0; l < aentity.length; ++l)
|
| 1056 | {
|
| 1057 | entity = aentity[l];
|
| 1058 |
|
| 1059 | if (entity != entityIn && entity.getEntityBoundingBox().intersectsWith(aabb) && (p_177414_4_ == null || p_177414_4_.apply(entity)))
|
| 1060 | {
|
| 1061 | listToFill.add(entity);
|
| 1062 | }
|
| 1063 | }
|
| 1064 | }
|
| 1065 | }
|
| 1066 | }
|
| 1067 | }
|
| 1068 | }
|
| 1069 | }
|
| 1070 |
|
| 1071 | public <T extends Entity> void getEntitiesOfTypeWithinAAAB(Class <? extends T > entityClass, AxisAlignedBB aabb, List<T> listToFill, Predicate <? super T > p_177430_4_)
|
| 1072 | {
|
| 1073 | int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D);
|
| 1074 | int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D);
|
| 1075 | i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1);
|
| 1076 | j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1);
|
| 1077 |
|
| 1078 | for (int k = i; k <= j; ++k)
|
| 1079 | {
|
| 1080 | for (T t : this.entityLists[k].getByClass(entityClass))
|
| 1081 | {
|
| 1082 | if (t.getEntityBoundingBox().intersectsWith(aabb) && (p_177430_4_ == null || p_177430_4_.apply(t)))
|
| 1083 | {
|
| 1084 | listToFill.add(t);
|
| 1085 | }
|
| 1086 | }
|
| 1087 | }
|
| 1088 | }
|
| 1089 |
|
| 1090 | /**
|
| 1091 | * Returns true if this Chunk needs to be saved
|
| 1092 | */
|
| 1093 | public boolean needsSaving(boolean p_76601_1_)
|
| 1094 | {
|
| 1095 | if (p_76601_1_)
|
| 1096 | {
|
| 1097 | if (this.hasEntities && this.worldObj.getTotalWorldTime() != this.lastSaveTime || this.isModified)
|
| 1098 | {
|
| 1099 | return true;
|
| 1100 | }
|
| 1101 | }
|
| 1102 | else if (this.hasEntities && this.worldObj.getTotalWorldTime() >= this.lastSaveTime + 600L)
|
| 1103 | {
|
| 1104 | return true;
|
| 1105 | }
|
| 1106 |
|
| 1107 | return this.isModified;
|
| 1108 | }
|
| 1109 |
|
| 1110 | public Random getRandomWithSeed(long seed)
|
| 1111 | {
|
| 1112 | return new Random(this.worldObj.getSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ seed);
|
| 1113 | }
|
| 1114 |
|
| 1115 | public boolean isEmpty()
|
| 1116 | {
|
| 1117 | return false;
|
| 1118 | }
|
| 1119 |
|
| 1120 | public void populateChunk(IChunkProvider p_76624_1_, IChunkProvider p_76624_2_, int x, int z)
|
| 1121 | {
|
| 1122 | boolean flag = p_76624_1_.chunkExists(x, z - 1);
|
| 1123 | boolean flag1 = p_76624_1_.chunkExists(x + 1, z);
|
| 1124 | boolean flag2 = p_76624_1_.chunkExists(x, z + 1);
|
| 1125 | boolean flag3 = p_76624_1_.chunkExists(x - 1, z);
|
| 1126 | boolean flag4 = p_76624_1_.chunkExists(x - 1, z - 1);
|
| 1127 | boolean flag5 = p_76624_1_.chunkExists(x + 1, z + 1);
|
| 1128 | boolean flag6 = p_76624_1_.chunkExists(x - 1, z + 1);
|
| 1129 | boolean flag7 = p_76624_1_.chunkExists(x + 1, z - 1);
|
| 1130 |
|
| 1131 | if (flag1 && flag2 && flag5)
|
| 1132 | {
|
| 1133 | if (!this.isTerrainPopulated)
|
| 1134 | {
|
| 1135 | p_76624_1_.populate(p_76624_2_, x, z);
|
| 1136 | }
|
| 1137 | else
|
| 1138 | {
|
| 1139 | p_76624_1_.populateChunk(p_76624_2_, this, x, z);
|
| 1140 | }
|
| 1141 | }
|
| 1142 |
|
| 1143 | if (flag3 && flag2 && flag6)
|
| 1144 | {
|
| 1145 | Chunk chunk = p_76624_1_.provideChunk(x - 1, z);
|
| 1146 |
|
| 1147 | if (!chunk.isTerrainPopulated)
|
| 1148 | {
|
| 1149 | p_76624_1_.populate(p_76624_2_, x - 1, z);
|
| 1150 | }
|
| 1151 | else
|
| 1152 | {
|
| 1153 | p_76624_1_.populateChunk(p_76624_2_, chunk, x - 1, z);
|
| 1154 | }
|
| 1155 | }
|
| 1156 |
|
| 1157 | if (flag && flag1 && flag7)
|
| 1158 | {
|
| 1159 | Chunk chunk1 = p_76624_1_.provideChunk(x, z - 1);
|
| 1160 |
|
| 1161 | if (!chunk1.isTerrainPopulated)
|
| 1162 | {
|
| 1163 | p_76624_1_.populate(p_76624_2_, x, z - 1);
|
| 1164 | }
|
| 1165 | else
|
| 1166 | {
|
| 1167 | p_76624_1_.populateChunk(p_76624_2_, chunk1, x, z - 1);
|
| 1168 | }
|
| 1169 | }
|
| 1170 |
|
| 1171 | if (flag4 && flag && flag3)
|
| 1172 | {
|
| 1173 | Chunk chunk2 = p_76624_1_.provideChunk(x - 1, z - 1);
|
| 1174 |
|
| 1175 | if (!chunk2.isTerrainPopulated)
|
| 1176 | {
|
| 1177 | p_76624_1_.populate(p_76624_2_, x - 1, z - 1);
|
| 1178 | }
|
| 1179 | else
|
| 1180 | {
|
| 1181 | p_76624_1_.populateChunk(p_76624_2_, chunk2, x - 1, z - 1);
|
| 1182 | }
|
| 1183 | }
|
| 1184 | }
|
| 1185 |
|
| 1186 | public BlockPos getPrecipitationHeight(BlockPos pos)
|
| 1187 | {
|
| 1188 | int i = pos.getX() & 15;
|
| 1189 | int j = pos.getZ() & 15;
|
| 1190 | int k = i | j << 4;
|
| 1191 | BlockPos blockpos = new BlockPos(pos.getX(), this.precipitationHeightMap[k], pos.getZ());
|
| 1192 |
|
| 1193 | if (blockpos.getY() == -999)
|
| 1194 | {
|
| 1195 | int l = this.getTopFilledSegment() + 15;
|
| 1196 | blockpos = new BlockPos(pos.getX(), l, pos.getZ());
|
| 1197 | int i1 = -1;
|
| 1198 |
|
| 1199 | while (blockpos.getY() > 0 && i1 == -1)
|
| 1200 | {
|
| 1201 | Block block = this.getBlock(blockpos);
|
| 1202 | Material material = block.getMaterial();
|
| 1203 |
|
| 1204 | if (!material.blocksMovement() && !material.isLiquid())
|
| 1205 | {
|
| 1206 | blockpos = blockpos.down();
|
| 1207 | }
|
| 1208 | else
|
| 1209 | {
|
| 1210 | i1 = blockpos.getY() + 1;
|
| 1211 | }
|
| 1212 | }
|
| 1213 |
|
| 1214 | this.precipitationHeightMap[k] = i1;
|
| 1215 | }
|
| 1216 |
|
| 1217 | return new BlockPos(pos.getX(), this.precipitationHeightMap[k], pos.getZ());
|
| 1218 | }
|
| 1219 |
|
| 1220 | public void func_150804_b(boolean p_150804_1_)
|
| 1221 | {
|
| 1222 | if (this.isGapLightingUpdated && !this.worldObj.provider.getHasNoSky() && !p_150804_1_)
|
| 1223 | {
|
| 1224 | this.recheckGaps(this.worldObj.isRemote);
|
| 1225 | }
|
| 1226 |
|
| 1227 | this.field_150815_m = true;
|
| 1228 |
|
| 1229 | if (!this.isLightPopulated && this.isTerrainPopulated)
|
| 1230 | {
|
| 1231 | this.func_150809_p();
|
| 1232 | }
|
| 1233 |
|
| 1234 | while (!this.tileEntityPosQueue.isEmpty())
|
| 1235 | {
|
| 1236 | BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll();
|
| 1237 |
|
| 1238 | if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity())
|
| 1239 | {
|
| 1240 | TileEntity tileentity = this.createNewTileEntity(blockpos);
|
| 1241 | this.worldObj.setTileEntity(blockpos, tileentity);
|
| 1242 | this.worldObj.markBlockRangeForRenderUpdate(blockpos, blockpos);
|
| 1243 | }
|
| 1244 | }
|
| 1245 | }
|
| 1246 |
|
| 1247 | public boolean isPopulated()
|
| 1248 | {
|
| 1249 | return this.field_150815_m && this.isTerrainPopulated && this.isLightPopulated;
|
| 1250 | }
|
| 1251 |
|
| 1252 | /**
|
| 1253 | * Gets a ChunkCoordIntPair representing the Chunk's position.
|
| 1254 | */
|
| 1255 | public ChunkCoordIntPair getChunkCoordIntPair()
|
| 1256 | {
|
| 1257 | return new ChunkCoordIntPair(this.xPosition, this.zPosition);
|
| 1258 | }
|
| 1259 |
|
| 1260 | /**
|
| 1261 | * Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty
|
| 1262 | * (true) or not (false).
|
| 1263 | */
|
| 1264 | public boolean getAreLevelsEmpty(int startY, int endY)
|
| 1265 | {
|
| 1266 | if (startY < 0)
|
| 1267 | {
|
| 1268 | startY = 0;
|
| 1269 | }
|
| 1270 |
|
| 1271 | if (endY >= 256)
|
| 1272 | {
|
| 1273 | endY = 255;
|
| 1274 | }
|
| 1275 |
|
| 1276 | for (int i = startY; i <= endY; i += 16)
|
| 1277 | {
|
| 1278 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[i >> 4];
|
| 1279 |
|
| 1280 | if (extendedblockstorage != null && !extendedblockstorage.isEmpty())
|
| 1281 | {
|
| 1282 | return false;
|
| 1283 | }
|
| 1284 | }
|
| 1285 |
|
| 1286 | return true;
|
| 1287 | }
|
| 1288 |
|
| 1289 | public void setStorageArrays(ExtendedBlockStorage[] newStorageArrays)
|
| 1290 | {
|
| 1291 | if (this.storageArrays.length != newStorageArrays.length)
|
| 1292 | {
|
| 1293 | logger.warn("Could not set level chunk sections, array length is " + newStorageArrays.length + " instead of " + this.storageArrays.length);
|
| 1294 | }
|
| 1295 | else
|
| 1296 | {
|
| 1297 | for (int i = 0; i < this.storageArrays.length; ++i)
|
| 1298 | {
|
| 1299 | this.storageArrays[i] = newStorageArrays[i];
|
| 1300 | }
|
| 1301 | }
|
| 1302 | }
|
| 1303 |
|
| 1304 | /**
|
| 1305 | * Initialize this chunk with new binary data.
|
| 1306 | */
|
| 1307 | public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_)
|
| 1308 | {
|
| 1309 | int i = 0;
|
| 1310 | boolean flag = !this.worldObj.provider.getHasNoSky();
|
| 1311 |
|
| 1312 | for (int j = 0; j < this.storageArrays.length; ++j)
|
| 1313 | {
|
| 1314 | if ((p_177439_2_ & 1 << j) != 0)
|
| 1315 | {
|
| 1316 | if (this.storageArrays[j] == null)
|
| 1317 | {
|
| 1318 | this.storageArrays[j] = new ExtendedBlockStorage(j << 4, flag);
|
| 1319 | }
|
| 1320 |
|
| 1321 | char[] achar = this.storageArrays[j].getData();
|
| 1322 |
|
| 1323 | for (int k = 0; k < achar.length; ++k)
|
| 1324 | {
|
| 1325 | achar[k] = (char)((p_177439_1_[i + 1] & 255) << 8 | p_177439_1_[i] & 255);
|
| 1326 | i += 2;
|
| 1327 | }
|
| 1328 | }
|
| 1329 | else if (p_177439_3_ && this.storageArrays[j] != null)
|
| 1330 | {
|
| 1331 | this.storageArrays[j] = null;
|
| 1332 | }
|
| 1333 | }
|
| 1334 |
|
| 1335 | for (int l = 0; l < this.storageArrays.length; ++l)
|
| 1336 | {
|
| 1337 | if ((p_177439_2_ & 1 << l) != 0 && this.storageArrays[l] != null)
|
| 1338 | {
|
| 1339 | NibbleArray nibblearray = this.storageArrays[l].getBlocklightArray();
|
| 1340 | System.arraycopy(p_177439_1_, i, nibblearray.getData(), 0, nibblearray.getData().length);
|
| 1341 | i += nibblearray.getData().length;
|
| 1342 | }
|
| 1343 | }
|
| 1344 |
|
| 1345 | if (flag)
|
| 1346 | {
|
| 1347 | for (int i1 = 0; i1 < this.storageArrays.length; ++i1)
|
| 1348 | {
|
| 1349 | if ((p_177439_2_ & 1 << i1) != 0 && this.storageArrays[i1] != null)
|
| 1350 | {
|
| 1351 | NibbleArray nibblearray1 = this.storageArrays[i1].getSkylightArray();
|
| 1352 | System.arraycopy(p_177439_1_, i, nibblearray1.getData(), 0, nibblearray1.getData().length);
|
| 1353 | i += nibblearray1.getData().length;
|
| 1354 | }
|
| 1355 | }
|
| 1356 | }
|
| 1357 |
|
| 1358 | if (p_177439_3_)
|
| 1359 | {
|
| 1360 | System.arraycopy(p_177439_1_, i, this.blockBiomeArray, 0, this.blockBiomeArray.length);
|
| 1361 | int k1 = i + this.blockBiomeArray.length;
|
| 1362 | }
|
| 1363 |
|
| 1364 | for (int j1 = 0; j1 < this.storageArrays.length; ++j1)
|
| 1365 | {
|
| 1366 | if (this.storageArrays[j1] != null && (p_177439_2_ & 1 << j1) != 0)
|
| 1367 | {
|
| 1368 | this.storageArrays[j1].removeInvalidBlocks();
|
| 1369 | }
|
| 1370 | }
|
| 1371 |
|
| 1372 | this.isLightPopulated = true;
|
| 1373 | this.isTerrainPopulated = true;
|
| 1374 | this.generateHeightMap();
|
| 1375 |
|
| 1376 | for (TileEntity tileentity : this.chunkTileEntityMap.values())
|
| 1377 | {
|
| 1378 | tileentity.updateContainingBlockInfo();
|
| 1379 | }
|
| 1380 | }
|
| 1381 |
|
| 1382 | public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager)
|
| 1383 | {
|
| 1384 | int i = pos.getX() & 15;
|
| 1385 | int j = pos.getZ() & 15;
|
| 1386 | int k = this.blockBiomeArray[j << 4 | i] & 255;
|
| 1387 |
|
| 1388 | if (k == 255)
|
| 1389 | {
|
| 1390 | BiomeGenBase biomegenbase = chunkManager.getBiomeGenerator(pos, BiomeGenBase.plains);
|
| 1391 | k = biomegenbase.biomeID;
|
| 1392 | this.blockBiomeArray[j << 4 | i] = (byte)(k & 255);
|
| 1393 | }
|
| 1394 |
|
| 1395 | BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(k);
|
| 1396 | return biomegenbase1 == null ? BiomeGenBase.plains : biomegenbase1;
|
| 1397 | }
|
| 1398 |
|
| 1399 | /**
|
| 1400 | * Returns an array containing a 16x16 mapping on the X/Z of block positions in this Chunk to biome IDs.
|
| 1401 | */
|
| 1402 | public byte[] getBiomeArray()
|
| 1403 | {
|
| 1404 | return this.blockBiomeArray;
|
| 1405 | }
|
| 1406 |
|
| 1407 | /**
|
| 1408 | * Accepts a 256-entry array that contains a 16x16 mapping on the X/Z plane of block positions in this Chunk to
|
| 1409 | * biome IDs.
|
| 1410 | */
|
| 1411 | public void setBiomeArray(byte[] biomeArray)
|
| 1412 | {
|
| 1413 | if (this.blockBiomeArray.length != biomeArray.length)
|
| 1414 | {
|
| 1415 | logger.warn("Could not set level chunk biomes, array length is " + biomeArray.length + " instead of " + this.blockBiomeArray.length);
|
| 1416 | }
|
| 1417 | else
|
| 1418 | {
|
| 1419 | for (int i = 0; i < this.blockBiomeArray.length; ++i)
|
| 1420 | {
|
| 1421 | this.blockBiomeArray[i] = biomeArray[i];
|
| 1422 | }
|
| 1423 | }
|
| 1424 | }
|
| 1425 |
|
| 1426 | /**
|
| 1427 | * Resets the relight check index to 0 for this Chunk.
|
| 1428 | */
|
| 1429 | public void resetRelightChecks()
|
| 1430 | {
|
| 1431 | this.queuedLightChecks = 0;
|
| 1432 | }
|
| 1433 |
|
| 1434 | /**
|
| 1435 | * Called once-per-chunk-per-tick, and advances the round-robin relight check index by up to 8 blocks at a time. In
|
| 1436 | * a worst-case scenario, can potentially take up to 25.6 seconds, calculated via (4096/8)/20, to re-check all
|
| 1437 | * blocks in a chunk, which may explain lagging light updates on initial world generation.
|
| 1438 | */
|
| 1439 | public void enqueueRelightChecks()
|
| 1440 | {
|
| 1441 | BlockPos blockpos = new BlockPos(this.xPosition << 4, 0, this.zPosition << 4);
|
| 1442 |
|
| 1443 | for (int i = 0; i < 8; ++i)
|
| 1444 | {
|
| 1445 | if (this.queuedLightChecks >= 4096)
|
| 1446 | {
|
| 1447 | return;
|
| 1448 | }
|
| 1449 |
|
| 1450 | int j = this.queuedLightChecks % 16;
|
| 1451 | int k = this.queuedLightChecks / 16 % 16;
|
| 1452 | int l = this.queuedLightChecks / 256;
|
| 1453 | ++this.queuedLightChecks;
|
| 1454 |
|
| 1455 | for (int i1 = 0; i1 < 16; ++i1)
|
| 1456 | {
|
| 1457 | BlockPos blockpos1 = blockpos.add(k, (j << 4) + i1, l);
|
| 1458 | boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15;
|
| 1459 |
|
| 1460 | if (this.storageArrays[j] == null && flag || this.storageArrays[j] != null && this.storageArrays[j].getBlockByExtId(k, i1, l).getMaterial() == Material.air)
|
| 1461 | {
|
| 1462 | for (EnumFacing enumfacing : EnumFacing.values())
|
| 1463 | {
|
| 1464 | BlockPos blockpos2 = blockpos1.offset(enumfacing);
|
| 1465 |
|
| 1466 | if (this.worldObj.getBlockState(blockpos2).getBlock().getLightValue() > 0)
|
| 1467 | {
|
| 1468 | this.worldObj.checkLight(blockpos2);
|
| 1469 | }
|
| 1470 | }
|
| 1471 |
|
| 1472 | this.worldObj.checkLight(blockpos1);
|
| 1473 | }
|
| 1474 | }
|
| 1475 | }
|
| 1476 | }
|
| 1477 |
|
| 1478 | public void func_150809_p()
|
| 1479 | {
|
| 1480 | this.isTerrainPopulated = true;
|
| 1481 | this.isLightPopulated = true;
|
| 1482 | BlockPos blockpos = new BlockPos(this.xPosition << 4, 0, this.zPosition << 4);
|
| 1483 |
|
| 1484 | if (!this.worldObj.provider.getHasNoSky())
|
| 1485 | {
|
| 1486 | if (this.worldObj.isAreaLoaded(blockpos.add(-1, 0, -1), blockpos.add(16, this.worldObj.getSeaLevel(), 16)))
|
| 1487 | {
|
| 1488 | label92:
|
| 1489 |
|
| 1490 | for (int i = 0; i < 16; ++i)
|
| 1491 | {
|
| 1492 | for (int j = 0; j < 16; ++j)
|
| 1493 | {
|
| 1494 | if (!this.func_150811_f(i, j))
|
| 1495 | {
|
| 1496 | this.isLightPopulated = false;
|
| 1497 | break label92;
|
| 1498 | }
|
| 1499 | }
|
| 1500 | }
|
| 1501 |
|
| 1502 | if (this.isLightPopulated)
|
| 1503 | {
|
| 1504 | for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
|
| 1505 | {
|
| 1506 | int k = enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE ? 16 : 1;
|
| 1507 | this.worldObj.getChunkFromBlockCoords(blockpos.offset(enumfacing, k)).func_180700_a(enumfacing.getOpposite());
|
| 1508 | }
|
| 1509 |
|
| 1510 | this.func_177441_y();
|
| 1511 | }
|
| 1512 | }
|
| 1513 | else
|
| 1514 | {
|
| 1515 | this.isLightPopulated = false;
|
| 1516 | }
|
| 1517 | }
|
| 1518 | }
|
| 1519 |
|
| 1520 | private void func_177441_y()
|
| 1521 | {
|
| 1522 | for (int i = 0; i < this.updateSkylightColumns.length; ++i)
|
| 1523 | {
|
| 1524 | this.updateSkylightColumns[i] = true;
|
| 1525 | }
|
| 1526 |
|
| 1527 | this.recheckGaps(false);
|
| 1528 | }
|
| 1529 |
|
| 1530 | private void func_180700_a(EnumFacing facing)
|
| 1531 | {
|
| 1532 | if (this.isTerrainPopulated)
|
| 1533 | {
|
| 1534 | if (facing == EnumFacing.EAST)
|
| 1535 | {
|
| 1536 | for (int i = 0; i < 16; ++i)
|
| 1537 | {
|
| 1538 | this.func_150811_f(15, i);
|
| 1539 | }
|
| 1540 | }
|
| 1541 | else if (facing == EnumFacing.WEST)
|
| 1542 | {
|
| 1543 | for (int j = 0; j < 16; ++j)
|
| 1544 | {
|
| 1545 | this.func_150811_f(0, j);
|
| 1546 | }
|
| 1547 | }
|
| 1548 | else if (facing == EnumFacing.SOUTH)
|
| 1549 | {
|
| 1550 | for (int k = 0; k < 16; ++k)
|
| 1551 | {
|
| 1552 | this.func_150811_f(k, 15);
|
| 1553 | }
|
| 1554 | }
|
| 1555 | else if (facing == EnumFacing.NORTH)
|
| 1556 | {
|
| 1557 | for (int l = 0; l < 16; ++l)
|
| 1558 | {
|
| 1559 | this.func_150811_f(l, 0);
|
| 1560 | }
|
| 1561 | }
|
| 1562 | }
|
| 1563 | }
|
| 1564 |
|
| 1565 | private boolean func_150811_f(int x, int z)
|
| 1566 | {
|
| 1567 | int i = this.getTopFilledSegment();
|
| 1568 | boolean flag = false;
|
| 1569 | boolean flag1 = false;
|
| 1570 | BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos((this.xPosition << 4) + x, 0, (this.zPosition << 4) + z);
|
| 1571 |
|
| 1572 | for (int j = i + 16 - 1; j > this.worldObj.getSeaLevel() || j > 0 && !flag1; --j)
|
| 1573 | {
|
| 1574 | blockpos$mutableblockpos.set(blockpos$mutableblockpos.getX(), j, blockpos$mutableblockpos.getZ());
|
| 1575 | int k = this.getBlockLightOpacity(blockpos$mutableblockpos);
|
| 1576 |
|
| 1577 | if (k == 255 && blockpos$mutableblockpos.getY() < this.worldObj.getSeaLevel())
|
| 1578 | {
|
| 1579 | flag1 = true;
|
| 1580 | }
|
| 1581 |
|
| 1582 | if (!flag && k > 0)
|
| 1583 | {
|
| 1584 | flag = true;
|
| 1585 | }
|
| 1586 | else if (flag && k == 0 && !this.worldObj.checkLight(blockpos$mutableblockpos))
|
| 1587 | {
|
| 1588 | return false;
|
| 1589 | }
|
| 1590 | }
|
| 1591 |
|
| 1592 | for (int l = blockpos$mutableblockpos.getY(); l > 0; --l)
|
| 1593 | {
|
| 1594 | blockpos$mutableblockpos.set(blockpos$mutableblockpos.getX(), l, blockpos$mutableblockpos.getZ());
|
| 1595 |
|
| 1596 | if (this.getBlock(blockpos$mutableblockpos).getLightValue() > 0)
|
| 1597 | {
|
| 1598 | this.worldObj.checkLight(blockpos$mutableblockpos);
|
| 1599 | }
|
| 1600 | }
|
| 1601 |
|
| 1602 | return true;
|
| 1603 | }
|
| 1604 |
|
| 1605 | public boolean isLoaded()
|
| 1606 | {
|
| 1607 | return this.isChunkLoaded;
|
| 1608 | }
|
| 1609 |
|
| 1610 | public void setChunkLoaded(boolean loaded)
|
| 1611 | {
|
| 1612 | this.isChunkLoaded = loaded;
|
| 1613 | }
|
| 1614 |
|
| 1615 | public World getWorld()
|
| 1616 | {
|
| 1617 | return this.worldObj;
|
| 1618 | }
|
| 1619 |
|
| 1620 | public int[] getHeightMap()
|
| 1621 | {
|
| 1622 | return this.heightMap;
|
| 1623 | }
|
| 1624 |
|
| 1625 | public void setHeightMap(int[] newHeightMap)
|
| 1626 | {
|
| 1627 | if (this.heightMap.length != newHeightMap.length)
|
| 1628 | {
|
| 1629 | logger.warn("Could not set level chunk heightmap, array length is " + newHeightMap.length + " instead of " + this.heightMap.length);
|
| 1630 | }
|
| 1631 | else
|
| 1632 | {
|
| 1633 | for (int i = 0; i < this.heightMap.length; ++i)
|
| 1634 | {
|
| 1635 | this.heightMap[i] = newHeightMap[i];
|
| 1636 | }
|
| 1637 | }
|
| 1638 | }
|
| 1639 |
|
| 1640 | public Map<BlockPos, TileEntity> getTileEntityMap()
|
| 1641 | {
|
| 1642 | return this.chunkTileEntityMap;
|
| 1643 | }
|
| 1644 |
|
| 1645 | public ClassInheritanceMultiMap<Entity>[] getEntityLists()
|
| 1646 | {
|
| 1647 | return this.entityLists;
|
| 1648 | }
|
| 1649 |
|
| 1650 | public boolean isTerrainPopulated()
|
| 1651 | {
|
| 1652 | return this.isTerrainPopulated;
|
| 1653 | }
|
| 1654 |
|
| 1655 | public void setTerrainPopulated(boolean terrainPopulated)
|
| 1656 | {
|
| 1657 | this.isTerrainPopulated = terrainPopulated;
|
| 1658 | }
|
| 1659 |
|
| 1660 | public boolean isLightPopulated()
|
| 1661 | {
|
| 1662 | return this.isLightPopulated;
|
| 1663 | }
|
| 1664 |
|
| 1665 | public void setLightPopulated(boolean lightPopulated)
|
| 1666 | {
|
| 1667 | this.isLightPopulated = lightPopulated;
|
| 1668 | }
|
| 1669 |
|
| 1670 | public void setModified(boolean modified)
|
| 1671 | {
|
| 1672 | this.isModified = modified;
|
| 1673 | }
|
| 1674 |
|
| 1675 | public void setHasEntities(boolean hasEntitiesIn)
|
| 1676 | {
|
| 1677 | this.hasEntities = hasEntitiesIn;
|
| 1678 | }
|
| 1679 |
|
| 1680 | public void setLastSaveTime(long saveTime)
|
| 1681 | {
|
| 1682 | this.lastSaveTime = saveTime;
|
| 1683 | }
|
| 1684 |
|
| 1685 | public int getLowestHeight()
|
| 1686 | {
|
| 1687 | return this.heightMapMinimum;
|
| 1688 | }
|
| 1689 |
|
| 1690 | public long getInhabitedTime()
|
| 1691 | {
|
| 1692 | return this.inhabitedTime;
|
| 1693 | }
|
| 1694 |
|
| 1695 | public void setInhabitedTime(long newInhabitedTime)
|
| 1696 | {
|
| 1697 | this.inhabitedTime = newInhabitedTime;
|
| 1698 | }
|
| 1699 |
|
| 1700 | public static enum EnumCreateEntityType
|
| 1701 | {
|
| 1702 | IMMEDIATE,
|
| 1703 | QUEUED,
|
| 1704 | CHECK;
|
| 1705 | }
|
| 1706 | }
|
| 1707 |
|