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;
}
}
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);
}
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);
}
Aggregations