Search in sources :

Example 1 with BiomeProvider

use of net.minecraft.world.biome.provider.BiomeProvider in project ChocolateQuestRepoured by TeamChocoQuest.

the class DummyWorld method createSpawnPositionCQR.

private void createSpawnPositionCQR(WorldSettings settings) {
    if (!this.provider.canRespawnHere()) {
        this.worldInfo.setSpawn(BlockPos.ORIGIN.up(this.provider.getAverageGroundLevel()));
    } else {
        this.findingSpawnPoint = true;
        BiomeProvider biomeprovider = this.provider.getBiomeProvider();
        List<Biome> list = biomeprovider.getBiomesToSpawnIn();
        Random random = new Random(this.getSeed());
        BlockPos blockpos = biomeprovider.findBiomePosition(0, 0, 256, list, random);
        int i = 8;
        int j = this.provider.getAverageGroundLevel();
        int k = 8;
        if (blockpos != null) {
            i = blockpos.getX();
            k = blockpos.getZ();
        }
        int l = 0;
        while (!this.canCoordinateBeSpawn(i, k)) {
            i += random.nextInt(64) - random.nextInt(64);
            k += random.nextInt(64) - random.nextInt(64);
            ++l;
            if (l == 1000) {
                break;
            }
        }
        this.worldInfo.setSpawn(new BlockPos(i, j, k));
        this.findingSpawnPoint = false;
    }
}
Also used : BiomeProvider(net.minecraft.world.biome.provider.BiomeProvider) Biome(net.minecraft.world.biome.Biome) Random(java.util.Random) BlockPos(net.minecraft.util.math.BlockPos)

Example 2 with BiomeProvider

use of net.minecraft.world.biome.provider.BiomeProvider in project Magma-1.16.x by magmafoundation.

the class CraftChunk method getEmptyChunkSnapshot.

public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) {
    BiomeContainer biome = null;
    if (includeBiome || includeBiomeTempRain) {
        BiomeProvider wcm = world.getHandle().getChunkSource().getGenerator().getBiomeSource();
        biome = new BiomeContainer(world.getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), new ChunkPos(x, z), wcm);
    }
    /* Fill with empty data */
    int hSection = world.getMaxHeight() >> 4;
    PalettedContainer[] blockIDs = new PalettedContainer[hSection];
    byte[][] skyLight = new byte[hSection][];
    byte[][] emitLight = new byte[hSection][];
    boolean[] empty = new boolean[hSection];
    for (int i = 0; i < hSection; i++) {
        blockIDs[i] = emptyBlockIDs;
        skyLight[i] = emptyLight;
        emitLight[i] = emptyLight;
        empty[i] = true;
    }
    return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, skyLight, emitLight, empty, new Heightmap(null, Heightmap.Type.MOTION_BLOCKING), biome);
}
Also used : BiomeProvider(net.minecraft.world.biome.provider.BiomeProvider) Heightmap(net.minecraft.world.gen.Heightmap) ChunkPos(net.minecraft.util.math.ChunkPos) BiomeContainer(net.minecraft.world.biome.BiomeContainer) PalettedContainer(net.minecraft.util.palette.PalettedContainer)

Example 3 with BiomeProvider

use of net.minecraft.world.biome.provider.BiomeProvider in project LoliServer by Loli-Server.

the class CraftChunk method getEmptyChunkSnapshot.

public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) {
    BiomeContainer biome = null;
    if (includeBiome || includeBiomeTempRain) {
        BiomeProvider wcm = world.getHandle().getChunkSource().getGenerator().getBiomeSource();
        biome = new BiomeContainer(world.getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), new ChunkPos(x, z), wcm);
    }
    /* Fill with empty data */
    int hSection = world.getMaxHeight() >> 4;
    PalettedContainer[] blockIDs = new PalettedContainer[hSection];
    byte[][] skyLight = new byte[hSection][];
    byte[][] emitLight = new byte[hSection][];
    boolean[] empty = new boolean[hSection];
    for (int i = 0; i < hSection; i++) {
        blockIDs[i] = emptyBlockIDs;
        skyLight[i] = emptyLight;
        emitLight[i] = emptyLight;
        empty[i] = true;
    }
    return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, skyLight, emitLight, empty, new Heightmap(null, Heightmap.Type.MOTION_BLOCKING), biome);
}
Also used : BiomeProvider(net.minecraft.world.biome.provider.BiomeProvider) Heightmap(net.minecraft.world.gen.Heightmap) ChunkPos(net.minecraft.util.math.ChunkPos) BiomeContainer(net.minecraft.world.biome.BiomeContainer) PalettedContainer(net.minecraft.util.palette.PalettedContainer)

Aggregations

BiomeProvider (net.minecraft.world.biome.provider.BiomeProvider)3 ChunkPos (net.minecraft.util.math.ChunkPos)2 PalettedContainer (net.minecraft.util.palette.PalettedContainer)2 BiomeContainer (net.minecraft.world.biome.BiomeContainer)2 Heightmap (net.minecraft.world.gen.Heightmap)2 Random (java.util.Random)1 BlockPos (net.minecraft.util.math.BlockPos)1 Biome (net.minecraft.world.biome.Biome)1