net.minecraft.world.WorldEntitySpawner Java Examples
The following examples show how to use
net.minecraft.world.WorldEntitySpawner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorldOverlayRenderer.java From NotEnoughItems with MIT License | 6 votes |
private static int getSpawnMode(Chunk chunk, int x, int y, int z) { World world = chunk.getWorld(); BlockPos pos = new BlockPos(x, y, z); if (!WorldEntitySpawner.canCreatureTypeSpawnAtLocation(SpawnPlacementType.ON_GROUND, world, pos) || chunk.getLightFor(EnumSkyBlock.BLOCK, pos) >= 8) { return 0; } c.set(x + 0.2, y + 0.01, z + 0.2, x + 0.8, y + 1.8, z + 0.8); AxisAlignedBB aabb = c.aabb(); if (!world.checkNoEntityCollision(aabb) || !world.getEntitiesWithinAABBExcludingEntity(null, aabb).isEmpty() || world.containsAnyLiquid(aabb)) { return 0; } if (chunk.getLightFor(EnumSkyBlock.SKY, pos) >= 8) { return 1; } return 2; }
Example #2
Source File: ChunkProviderTofu.java From TofuCraftReload with MIT License | 5 votes |
@Override public void populate(int x, int z) { BlockFalling.fallInstantly = true; BlockPos blockpos = new BlockPos(x * 16, 0, z * 16); Biome biome = this.world.getBiome(blockpos.add(16, 0, 16)); rand.setSeed(world.getSeed()); long xSeed = rand.nextLong() / 2L * 2L + 1L; long zSeed = rand.nextLong() / 2L * 2L + 1L; rand.setSeed(chunkX * xSeed + chunkZ * zSeed ^ world.getSeed()); int i = x * 16; int j = z * 16; if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(this.world, this.rand, diamondGen, blockpos, OreGenEvent.GenerateMinable.EventType.CUSTOM)) for (int l1 = 0; l1 < 12; ++l1) { this.diamondGen.generate(this.world, this.rand, blockpos.add(this.rand.nextInt(16), this.rand.nextInt(30), this.rand.nextInt(16))); } ChunkPos chunkpos = new ChunkPos(x, z); if (mapFeaturesEnabled) { this.mineshaft.generateStructure(this.world, this.rand, chunkpos); this.villageGenerator.generateStructure(this.world, this.rand, chunkpos); this.tofuCastle.generateStructure(this.world, this.rand, chunkpos); } biome.decorate(world, rand, blockpos); if (net.minecraftforge.event.terraingen.TerrainGen.populate(this, this.world, this.rand, x, z, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) WorldEntitySpawner.performWorldGenSpawning(this.world, biome, i + 8, j + 8, 16, 16, this.rand); net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.world, this.rand, x, z, false); BlockFalling.fallInstantly = false; }