Search in sources :

Example 6 with BiomeContainer

use of net.minecraft.world.biome.BiomeContainer 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

BiomeContainer (net.minecraft.world.biome.BiomeContainer)6 PalettedContainer (net.minecraft.util.palette.PalettedContainer)4 Heightmap (net.minecraft.world.gen.Heightmap)4 ChunkSection (net.minecraft.world.chunk.ChunkSection)3 CompoundNBT (net.minecraft.nbt.CompoundNBT)2 NBTUtil (net.minecraft.nbt.NBTUtil)2 ChunkPos (net.minecraft.util.math.ChunkPos)2 BiomeProvider (net.minecraft.world.biome.provider.BiomeProvider)2 NibbleArray (net.minecraft.world.chunk.NibbleArray)2 WorldLightManager (net.minecraft.world.lighting.WorldLightManager)2 ServerWorld (net.minecraft.world.server.ServerWorld)2 World (org.bukkit.World)2 Block (net.minecraft.block.Block)1 ITileEntityProvider (net.minecraft.block.ITileEntityProvider)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 ChunkPrimer (net.minecraft.world.chunk.ChunkPrimer)1 IChunk (net.minecraft.world.chunk.IChunk)1 CraftBlock (org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock)1 ChunkData (org.bukkit.generator.ChunkGenerator.ChunkData)1