本文整理了Java中net.minecraft.world.World.getBiomeProvider()
方法的一些代码示例,展示了World.getBiomeProvider()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getBiomeProvider()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getBiomeProvider
暂无
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public @Nonnull BiomeProvider getBiomeProvider() {
return wrapped.getBiomeProvider();
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public BiomeProvider getBiomeProvider() {
return getActualWorld().getBiomeProvider();
}
代码示例来源:origin: gegy1000/Terrarium
public Biome[] provideBiomes(int chunkX, int chunkZ) {
return this.world.getBiomeProvider().getBiomes(this.biomeBuffer, chunkX << 4, chunkZ << 4, 16, 16);
}
代码示例来源:origin: McJtyMods/LostCities
@Override
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) {
int i = chunkX;
int j = chunkZ;
if (chunkX < 0) {
i = chunkX - 79;
}
if (chunkZ < 0) {
j = chunkZ - 79;
}
int k = i / 80;
int l = j / 80;
Random random = this.world.setRandomSeed(k, l, 10387319);
k = k * 80;
l = l * 80;
k = k + (random.nextInt(60) + random.nextInt(60)) / 2;
l = l + (random.nextInt(60) + random.nextInt(60)) / 2;
if (chunkX == k && chunkZ == l) {
boolean flag = this.world.getBiomeProvider().areBiomesViable(chunkX * 16 + 8, chunkZ * 16 + 8, 32, ALLOWED_BIOMES);
if (flag) {
return true;
}
}
return false;
}
代码示例来源:origin: McJtyMods/LostCities
public static BiomeInfo getBiomeInfo(LostCityChunkGenerator provider, ChunkCoord coord) {
if (!biomeInfoMap.containsKey(coord)) {
BiomeInfo info = new BiomeInfo();
int chunkX = coord.getChunkX();
int chunkZ = coord.getChunkZ();
info.biomesForBiomeCheck = provider.worldObj.getBiomeProvider().getBiomesForGeneration(info.biomesForBiomeCheck, (chunkX - 1) * 4 - 2, chunkZ * 4 - 2, 10, 10);
biomeInfoMap.put(coord, info);
}
return biomeInfoMap.get(coord);
}
代码示例来源:origin: jabelar/ExampleMod-1.12
@Override
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ)
{
int unadjustedX = chunkX;
int unadjustedZ = chunkZ;
if (chunkX < 0)
{
chunkX -= averageSpacing - 1;
}
if (chunkZ < 0)
{
chunkZ -= averageSpacing - 1;
}
// randomize relative positions of village candidate sites
int candidateX = chunkX / averageSpacing;
int candidateZ = chunkZ / averageSpacing;
Random random = world.setRandomSeed(candidateX, candidateZ, 10387312);
candidateX = candidateX * averageSpacing;
candidateZ = candidateZ * averageSpacing;
candidateX = candidateX + random.nextInt(averageSpacing - 8);
candidateZ = candidateZ + random.nextInt(averageSpacing - 8);
if (unadjustedX == candidateX && unadjustedZ == candidateZ)
{
// DEBUG
System.out.println("Is biome viable for village = "+world.getBiomeProvider().areBiomesViable(unadjustedX * 16 + 8, unadjustedZ * 16 + 8, 0, VILLAGE_SPAWN_BIOMES));
return world.getBiomeProvider().areBiomesViable(unadjustedX * 16 + 8, unadjustedZ * 16 + 8, 0, VILLAGE_SPAWN_BIOMES);
}
return false;
}
代码示例来源:origin: MCTCP/TerrainControl
BiomeProvider biomeProvider = this.world.getBiomeProvider();
if (biomeProvider.getBiome(new BlockPos(k * 16 + 8, 64, l * 16 + 8), (Biome) null) != Biomes.DEEP_OCEAN)
boolean flag = this.world.getBiomeProvider().areBiomesViable(k * 16 + 8, l * 16 + 8, 29, this.monumentSpawnBiomes);
代码示例来源:origin: Vazkii/Quark
private static BlockPos spiralOutwardsLookingForBiome(World world, Biome biomeToFind, double startX, double startZ, int maxDist, int sampleSpace) {
if(maxDist <= 0 || sampleSpace <= 0)
throw new IllegalArgumentException("maxDist and sampleSpace must be positive");
BiomeProvider chunkManager = world.getBiomeProvider();
double a = sampleSpace / Math.sqrt(Math.PI);
double b = 2 * Math.sqrt(Math.PI);
double dist = 0;
String biomeName = FMLCommonHandler.instance().getSide() == Side.CLIENT ? biomeToFind.getBiomeName() : "biome";
for (int n = 0; dist < maxDist; ++n) {
double rootN = Math.sqrt(n);
dist = a * rootN;
double x = startX + (dist * Math.sin(b * rootN));
double z = startZ + (dist * Math.cos(b * rootN));
// chunkManager.genBiomes is the first layer returned from initializeAllBiomeGenerators()
// chunkManager.biomeIndexLayer is the second layer returned from initializeAllBiomeGenerators(), it's zoomed twice from genBiomes (>> 2) this one is actual size
// chunkManager.getBiomeGenAt uses biomeIndexLayer to get the biome
Biome[] biomesAtSample = chunkManager.getBiomes(null, (int) x, (int) z, 1, 1, false);
if (biomesAtSample[0] == biomeToFind)
return new BlockPos((int) x, 0, (int) z);
}
return null;
}
代码示例来源:origin: MCTCP/TerrainControl
@Override
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored)
{
this.world = worldIn;
BiomeProvider biomeprovider = worldIn.getBiomeProvider();
return biomeprovider.isFixedBiome() && biomeprovider.getFixedBiome() != Biomes.ROOFED_FOREST ? null : findNearestStructurePosBySpacing(worldIn, this, pos, maxDistance, minDistance, 10387319, true, 100, findUnexplored);
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public Start(World worldIn, Random rand, int x, int z, int size) {
super(x, z);
List<SnowVillagePieces.PieceWeight> list = SnowVillagePieces.getStructureVillageWeightedPieceList(rand, size);
SnowVillagePieces.Start structurevillagepieces$start = new SnowVillagePieces.Start(worldIn.getBiomeProvider(), 0, rand, (x << 4) + 2, (z << 4) + 2, list, size);
this.components.add(structurevillagepieces$start);
structurevillagepieces$start.buildComponent(structurevillagepieces$start, this.components, rand);
List<StructureComponent> list1 = structurevillagepieces$start.pendingRoads;
List<StructureComponent> list2 = structurevillagepieces$start.pendingHouses;
while (!list1.isEmpty() || !list2.isEmpty()) {
if (list1.isEmpty()) {
int i = rand.nextInt(list2.size());
StructureComponent structurecomponent = (StructureComponent) list2.remove(i);
structurecomponent.buildComponent(structurevillagepieces$start, this.components, rand);
} else {
int j = rand.nextInt(list1.size());
StructureComponent structurecomponent2 = (StructureComponent) list1.remove(j);
structurecomponent2.buildComponent(structurevillagepieces$start, this.components, rand);
}
}
this.updateBoundingBox();
int k = 0;
for (StructureComponent structurecomponent1 : this.components) {
if (!(structurecomponent1 instanceof StructureVillagePieces.Road)) {
++k;
}
}
this.hasMoreThanTwoComponents = k > 2;
}
代码示例来源:origin: TeamLapen/Vampirism
private static ChunkPos isBiomeAt(World world, int x, int z, List<Biome> biomes) {
BlockPos pos = world.getBiomeProvider().findBiomePosition(x, z, 32, biomes, new Random());
if (pos != null) {
return new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4);
}
return null;
}
代码示例来源:origin: MCTCP/TerrainControl
Biome biomeAtPosition = this.world.getBiomeProvider().getBiome(
new BlockPos(var3 * 16 + 8, 0, var4 * 16 + 8));
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public Start(World worldIn, Random rand, int x, int z, int size) {
super(x, z);
List<PixieVillagePieces.PieceWeight> list = PixieVillagePieces.getStructureVillageWeightedPieceList(rand, size);
PixieVillagePieces.Start structurevillagepieces$start = new PixieVillagePieces.Start(worldIn.getBiomeProvider(), 0, rand, (x << 4) + 2, (z << 4) + 2, list, size);
this.components.add(structurevillagepieces$start);
structurevillagepieces$start.buildComponent(structurevillagepieces$start, this.components, rand);
List<StructureComponent> list1 = structurevillagepieces$start.pendingRoads;
List<StructureComponent> list2 = structurevillagepieces$start.pendingHouses;
while (!list1.isEmpty() || !list2.isEmpty()) {
if (list1.isEmpty()) {
int i = rand.nextInt(list2.size());
StructureComponent structurecomponent = (StructureComponent) list2.remove(i);
structurecomponent.buildComponent(structurevillagepieces$start, this.components, rand);
} else {
int j = rand.nextInt(list1.size());
StructureComponent structurecomponent2 = (StructureComponent) list1.remove(j);
structurecomponent2.buildComponent(structurevillagepieces$start, this.components, rand);
}
}
this.updateBoundingBox();
int k = 0;
for (StructureComponent structurecomponent1 : this.components) {
if (!(structurecomponent1 instanceof StructureVillagePieces.Road)) {
++k;
}
}
this.hasMoreThanTwoComponents = k > 2;
}
代码示例来源:origin: McJtyMods/LostCities
@Override
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
this.world = worldIn;
BiomeProvider biomeprovider = worldIn.getBiomeProvider();
return biomeprovider.isFixedBiome() && biomeprovider.getFixedBiome() != Biomes.ROOFED_FOREST ? null : findNearestStructurePosBySpacing(worldIn, this, pos, 80, 20, 10387319, true, 100, findUnexplored);
}
代码示例来源:origin: gegy1000/Terrarium
@Override
public final void composeDecoration(IChunkGenerator generator, World world, RegionGenerationHandler regionHandler, int chunkX, int chunkZ) {
int globalX = chunkX << 4;
int globalZ = chunkZ << 4;
this.randomMap.initPosSeed(globalX, globalZ);
this.random.setSeed(this.randomMap.next());
Biome biome = world.getChunk(chunkX, chunkZ).getBiome(DECORATION_CENTER, world.getBiomeProvider());
this.composeDecoration(generator, world, chunkX, chunkZ, biome);
}
代码示例来源:origin: GregTechCE/GregTech
public CachedGridEntry(World world, int gridX, int gridZ) {
this.gridX = gridX;
this.gridZ = gridZ;
long gridRandomSeed = Objects.hash(gridX, gridZ) ^ world.getSeed();
this.gridRandom = new XSTR(gridRandomSeed);
int gridSizeX = WorldGeneratorImpl.GRID_SIZE_X * 16;
int gridSizeZ = WorldGeneratorImpl.GRID_SIZE_Z * 16;
BlockPos blockPos = new BlockPos(gridX * gridSizeX + gridSizeX / 2, world.getActualHeight(), gridZ * gridSizeZ + gridSizeZ / 2);
Biome currentBiome = world.getBiomeProvider().getBiome(blockPos);
this.cachedDepositMap = new ArrayList<>(WorldGenRegistry.INSTANCE.getCachedBiomeVeins(world.provider, currentBiome));
this.maxHeight = world.getActualHeight();
this.generatedVeins = triggerVeinsGeneration();
}
代码示例来源:origin: Glitchfiend/ToughAsNails
@Override
public void fillWithRain(World worldIn, BlockPos pos)
{
if (worldIn.rand.nextInt(2) == 0)
{
float f = worldIn.getBiome(pos).getTemperature(pos);
if (worldIn.getBiomeProvider().getTemperatureAtHeight(f, pos.getY()) >= 0.15F)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (((Integer)iblockstate.getValue(LEVEL)).intValue() < 3)
{
worldIn.setBlockState(pos, iblockstate.cycleProperty(LEVEL), 2);
}
}
}
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
@Override
@Nonnull
public Chunk provideChunk(int x, int z) {
rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
ChunkPrimer chunkprimer = new ChunkPrimer();
biomesForGeneration = this.world.getBiomeProvider().getBiomes(biomesForGeneration, x * 16, z * 16, 16, 16);
season = HFApi.calendar.getDate(world).getSeason();
if (season == null) season = Season.SPRING;
setBlocksInChunk(x, z, chunkprimer);
Chunk chunk = new Chunk(world, chunkprimer, x, z);
byte[] abyte = chunk.getBiomeArray();
for (int i = 0; i < abyte.length; ++i) {
abyte[i] = (byte) Biome.getIdForBiome(biomesForGeneration[i]);
}
chunk.generateSkylightMap();
return chunk;
}
代码示例来源:origin: McJtyMods/ModTutorials
@Override
public Chunk generateChunk(int x, int z) {
ChunkPrimer chunkprimer = new ChunkPrimer();
// Setup biomes for terraingen
this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomesForGeneration, x * 4 - 2, z * 4 - 2, 10, 10);
terraingen.setBiomesForGeneration(biomesForGeneration);
terraingen.generate(x, z, chunkprimer);
// Setup biomes again for actual biome decoration
this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16);
// This will replace stone with the biome specific stones
terraingen.replaceBiomeBlocks(x, z, chunkprimer, this, biomesForGeneration);
// Generate caves
this.caveGenerator.generate(this.worldObj, x, z, chunkprimer);
Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
byte[] biomeArray = chunk.getBiomeArray();
for (int i = 0; i < biomeArray.length; ++i) {
biomeArray[i] = (byte)Biome.getIdForBiome(this.biomesForGeneration[i]);
}
chunk.generateSkylightMap();
return chunk;
}
代码示例来源:origin: vadis365/TheErebus
@Override
public Chunk generateChunk(int x, int z) {
rand.setSeed(x * 341873128712L + z * 132897987541L);
ChunkPrimer chunkprimer = new ChunkPrimer();
biomesForGeneration = worldObj.getBiomeProvider().getBiomes(biomesForGeneration, x * 16, z * 16, 16, 16);
generateTerrain(x, z, chunkprimer);
replaceBlocksForBiome(x, z, biomesForGeneration, chunkprimer);
caveGenerator.generate(worldObj, x, z, chunkprimer);
ravineGenerator.generate(worldObj, x, z, chunkprimer);
Chunk chunk = new Chunk(worldObj, chunkprimer, x, z);
byte[] biomeArrayReference = chunk.getBiomeArray();
for (int a = 0; a < biomeArrayReference.length; ++a)
biomeArrayReference[a] = (byte) Biome.getIdForBiome(biomesForGeneration[a]);
chunk.generateSkylightMap();
chunk.resetRelightChecks();
return chunk;
}
内容来源于网络,如有侵权,请联系作者删除!