net.minecraft.world.World.getBiomeProvider()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(11.8k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中net.minecraft.world.World.getBiomeProvider()方法的一些代码示例,展示了World.getBiomeProvider()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getBiomeProvider()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getBiomeProvider

World.getBiomeProvider介绍

暂无

代码示例

代码示例来源:origin: SleepyTrousers/EnderIO

  1. @Override
  2. public @Nonnull BiomeProvider getBiomeProvider() {
  3. return wrapped.getBiomeProvider();
  4. }

代码示例来源:origin: amadornes/MCMultiPart

  1. @Override
  2. public BiomeProvider getBiomeProvider() {
  3. return getActualWorld().getBiomeProvider();
  4. }

代码示例来源:origin: gegy1000/Terrarium

  1. public Biome[] provideBiomes(int chunkX, int chunkZ) {
  2. return this.world.getBiomeProvider().getBiomes(this.biomeBuffer, chunkX << 4, chunkZ << 4, 16, 16);
  3. }

代码示例来源:origin: McJtyMods/LostCities

  1. @Override
  2. protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) {
  3. int i = chunkX;
  4. int j = chunkZ;
  5. if (chunkX < 0) {
  6. i = chunkX - 79;
  7. }
  8. if (chunkZ < 0) {
  9. j = chunkZ - 79;
  10. }
  11. int k = i / 80;
  12. int l = j / 80;
  13. Random random = this.world.setRandomSeed(k, l, 10387319);
  14. k = k * 80;
  15. l = l * 80;
  16. k = k + (random.nextInt(60) + random.nextInt(60)) / 2;
  17. l = l + (random.nextInt(60) + random.nextInt(60)) / 2;
  18. if (chunkX == k && chunkZ == l) {
  19. boolean flag = this.world.getBiomeProvider().areBiomesViable(chunkX * 16 + 8, chunkZ * 16 + 8, 32, ALLOWED_BIOMES);
  20. if (flag) {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }

代码示例来源:origin: McJtyMods/LostCities

  1. public static BiomeInfo getBiomeInfo(LostCityChunkGenerator provider, ChunkCoord coord) {
  2. if (!biomeInfoMap.containsKey(coord)) {
  3. BiomeInfo info = new BiomeInfo();
  4. int chunkX = coord.getChunkX();
  5. int chunkZ = coord.getChunkZ();
  6. info.biomesForBiomeCheck = provider.worldObj.getBiomeProvider().getBiomesForGeneration(info.biomesForBiomeCheck, (chunkX - 1) * 4 - 2, chunkZ * 4 - 2, 10, 10);
  7. biomeInfoMap.put(coord, info);
  8. }
  9. return biomeInfoMap.get(coord);
  10. }

代码示例来源:origin: jabelar/ExampleMod-1.12

  1. @Override
  2. protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ)
  3. {
  4. int unadjustedX = chunkX;
  5. int unadjustedZ = chunkZ;
  6. if (chunkX < 0)
  7. {
  8. chunkX -= averageSpacing - 1;
  9. }
  10. if (chunkZ < 0)
  11. {
  12. chunkZ -= averageSpacing - 1;
  13. }
  14. // randomize relative positions of village candidate sites
  15. int candidateX = chunkX / averageSpacing;
  16. int candidateZ = chunkZ / averageSpacing;
  17. Random random = world.setRandomSeed(candidateX, candidateZ, 10387312);
  18. candidateX = candidateX * averageSpacing;
  19. candidateZ = candidateZ * averageSpacing;
  20. candidateX = candidateX + random.nextInt(averageSpacing - 8);
  21. candidateZ = candidateZ + random.nextInt(averageSpacing - 8);
  22. if (unadjustedX == candidateX && unadjustedZ == candidateZ)
  23. {
  24. // DEBUG
  25. System.out.println("Is biome viable for village = "+world.getBiomeProvider().areBiomesViable(unadjustedX * 16 + 8, unadjustedZ * 16 + 8, 0, VILLAGE_SPAWN_BIOMES));
  26. return world.getBiomeProvider().areBiomesViable(unadjustedX * 16 + 8, unadjustedZ * 16 + 8, 0, VILLAGE_SPAWN_BIOMES);
  27. }
  28. return false;
  29. }

代码示例来源:origin: MCTCP/TerrainControl

  1. BiomeProvider biomeProvider = this.world.getBiomeProvider();
  2. if (biomeProvider.getBiome(new BlockPos(k * 16 + 8, 64, l * 16 + 8), (Biome) null) != Biomes.DEEP_OCEAN)
  3. boolean flag = this.world.getBiomeProvider().areBiomesViable(k * 16 + 8, l * 16 + 8, 29, this.monumentSpawnBiomes);

代码示例来源:origin: Vazkii/Quark

  1. private static BlockPos spiralOutwardsLookingForBiome(World world, Biome biomeToFind, double startX, double startZ, int maxDist, int sampleSpace) {
  2. if(maxDist <= 0 || sampleSpace <= 0)
  3. throw new IllegalArgumentException("maxDist and sampleSpace must be positive");
  4. BiomeProvider chunkManager = world.getBiomeProvider();
  5. double a = sampleSpace / Math.sqrt(Math.PI);
  6. double b = 2 * Math.sqrt(Math.PI);
  7. double dist = 0;
  8. String biomeName = FMLCommonHandler.instance().getSide() == Side.CLIENT ? biomeToFind.getBiomeName() : "biome";
  9. for (int n = 0; dist < maxDist; ++n) {
  10. double rootN = Math.sqrt(n);
  11. dist = a * rootN;
  12. double x = startX + (dist * Math.sin(b * rootN));
  13. double z = startZ + (dist * Math.cos(b * rootN));
  14. // chunkManager.genBiomes is the first layer returned from initializeAllBiomeGenerators()
  15. // chunkManager.biomeIndexLayer is the second layer returned from initializeAllBiomeGenerators(), it's zoomed twice from genBiomes (>> 2) this one is actual size
  16. // chunkManager.getBiomeGenAt uses biomeIndexLayer to get the biome
  17. Biome[] biomesAtSample = chunkManager.getBiomes(null, (int) x, (int) z, 1, 1, false);
  18. if (biomesAtSample[0] == biomeToFind)
  19. return new BlockPos((int) x, 0, (int) z);
  20. }
  21. return null;
  22. }

代码示例来源:origin: MCTCP/TerrainControl

  1. @Override
  2. public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored)
  3. {
  4. this.world = worldIn;
  5. BiomeProvider biomeprovider = worldIn.getBiomeProvider();
  6. return biomeprovider.isFixedBiome() && biomeprovider.getFixedBiome() != Biomes.ROOFED_FOREST ? null : findNearestStructurePosBySpacing(worldIn, this, pos, maxDistance, minDistance, 10387319, true, 100, findUnexplored);
  7. }

代码示例来源:origin: Alex-the-666/Ice_and_Fire

  1. public Start(World worldIn, Random rand, int x, int z, int size) {
  2. super(x, z);
  3. List<SnowVillagePieces.PieceWeight> list = SnowVillagePieces.getStructureVillageWeightedPieceList(rand, size);
  4. SnowVillagePieces.Start structurevillagepieces$start = new SnowVillagePieces.Start(worldIn.getBiomeProvider(), 0, rand, (x << 4) + 2, (z << 4) + 2, list, size);
  5. this.components.add(structurevillagepieces$start);
  6. structurevillagepieces$start.buildComponent(structurevillagepieces$start, this.components, rand);
  7. List<StructureComponent> list1 = structurevillagepieces$start.pendingRoads;
  8. List<StructureComponent> list2 = structurevillagepieces$start.pendingHouses;
  9. while (!list1.isEmpty() || !list2.isEmpty()) {
  10. if (list1.isEmpty()) {
  11. int i = rand.nextInt(list2.size());
  12. StructureComponent structurecomponent = (StructureComponent) list2.remove(i);
  13. structurecomponent.buildComponent(structurevillagepieces$start, this.components, rand);
  14. } else {
  15. int j = rand.nextInt(list1.size());
  16. StructureComponent structurecomponent2 = (StructureComponent) list1.remove(j);
  17. structurecomponent2.buildComponent(structurevillagepieces$start, this.components, rand);
  18. }
  19. }
  20. this.updateBoundingBox();
  21. int k = 0;
  22. for (StructureComponent structurecomponent1 : this.components) {
  23. if (!(structurecomponent1 instanceof StructureVillagePieces.Road)) {
  24. ++k;
  25. }
  26. }
  27. this.hasMoreThanTwoComponents = k > 2;
  28. }

代码示例来源:origin: TeamLapen/Vampirism

  1. private static ChunkPos isBiomeAt(World world, int x, int z, List<Biome> biomes) {
  2. BlockPos pos = world.getBiomeProvider().findBiomePosition(x, z, 32, biomes, new Random());
  3. if (pos != null) {
  4. return new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4);
  5. }
  6. return null;
  7. }

代码示例来源:origin: MCTCP/TerrainControl

  1. Biome biomeAtPosition = this.world.getBiomeProvider().getBiome(
  2. new BlockPos(var3 * 16 + 8, 0, var4 * 16 + 8));

代码示例来源:origin: Alex-the-666/Ice_and_Fire

  1. public Start(World worldIn, Random rand, int x, int z, int size) {
  2. super(x, z);
  3. List<PixieVillagePieces.PieceWeight> list = PixieVillagePieces.getStructureVillageWeightedPieceList(rand, size);
  4. PixieVillagePieces.Start structurevillagepieces$start = new PixieVillagePieces.Start(worldIn.getBiomeProvider(), 0, rand, (x << 4) + 2, (z << 4) + 2, list, size);
  5. this.components.add(structurevillagepieces$start);
  6. structurevillagepieces$start.buildComponent(structurevillagepieces$start, this.components, rand);
  7. List<StructureComponent> list1 = structurevillagepieces$start.pendingRoads;
  8. List<StructureComponent> list2 = structurevillagepieces$start.pendingHouses;
  9. while (!list1.isEmpty() || !list2.isEmpty()) {
  10. if (list1.isEmpty()) {
  11. int i = rand.nextInt(list2.size());
  12. StructureComponent structurecomponent = (StructureComponent) list2.remove(i);
  13. structurecomponent.buildComponent(structurevillagepieces$start, this.components, rand);
  14. } else {
  15. int j = rand.nextInt(list1.size());
  16. StructureComponent structurecomponent2 = (StructureComponent) list1.remove(j);
  17. structurecomponent2.buildComponent(structurevillagepieces$start, this.components, rand);
  18. }
  19. }
  20. this.updateBoundingBox();
  21. int k = 0;
  22. for (StructureComponent structurecomponent1 : this.components) {
  23. if (!(structurecomponent1 instanceof StructureVillagePieces.Road)) {
  24. ++k;
  25. }
  26. }
  27. this.hasMoreThanTwoComponents = k > 2;
  28. }

代码示例来源:origin: McJtyMods/LostCities

  1. @Override
  2. public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
  3. this.world = worldIn;
  4. BiomeProvider biomeprovider = worldIn.getBiomeProvider();
  5. return biomeprovider.isFixedBiome() && biomeprovider.getFixedBiome() != Biomes.ROOFED_FOREST ? null : findNearestStructurePosBySpacing(worldIn, this, pos, 80, 20, 10387319, true, 100, findUnexplored);
  6. }

代码示例来源:origin: gegy1000/Terrarium

  1. @Override
  2. public final void composeDecoration(IChunkGenerator generator, World world, RegionGenerationHandler regionHandler, int chunkX, int chunkZ) {
  3. int globalX = chunkX << 4;
  4. int globalZ = chunkZ << 4;
  5. this.randomMap.initPosSeed(globalX, globalZ);
  6. this.random.setSeed(this.randomMap.next());
  7. Biome biome = world.getChunk(chunkX, chunkZ).getBiome(DECORATION_CENTER, world.getBiomeProvider());
  8. this.composeDecoration(generator, world, chunkX, chunkZ, biome);
  9. }

代码示例来源:origin: GregTechCE/GregTech

  1. public CachedGridEntry(World world, int gridX, int gridZ) {
  2. this.gridX = gridX;
  3. this.gridZ = gridZ;
  4. long gridRandomSeed = Objects.hash(gridX, gridZ) ^ world.getSeed();
  5. this.gridRandom = new XSTR(gridRandomSeed);
  6. int gridSizeX = WorldGeneratorImpl.GRID_SIZE_X * 16;
  7. int gridSizeZ = WorldGeneratorImpl.GRID_SIZE_Z * 16;
  8. BlockPos blockPos = new BlockPos(gridX * gridSizeX + gridSizeX / 2, world.getActualHeight(), gridZ * gridSizeZ + gridSizeZ / 2);
  9. Biome currentBiome = world.getBiomeProvider().getBiome(blockPos);
  10. this.cachedDepositMap = new ArrayList<>(WorldGenRegistry.INSTANCE.getCachedBiomeVeins(world.provider, currentBiome));
  11. this.maxHeight = world.getActualHeight();
  12. this.generatedVeins = triggerVeinsGeneration();
  13. }

代码示例来源:origin: Glitchfiend/ToughAsNails

  1. @Override
  2. public void fillWithRain(World worldIn, BlockPos pos)
  3. {
  4. if (worldIn.rand.nextInt(2) == 0)
  5. {
  6. float f = worldIn.getBiome(pos).getTemperature(pos);
  7. if (worldIn.getBiomeProvider().getTemperatureAtHeight(f, pos.getY()) >= 0.15F)
  8. {
  9. IBlockState iblockstate = worldIn.getBlockState(pos);
  10. if (((Integer)iblockstate.getValue(LEVEL)).intValue() < 3)
  11. {
  12. worldIn.setBlockState(pos, iblockstate.cycleProperty(LEVEL), 2);
  13. }
  14. }
  15. }
  16. }

代码示例来源:origin: PenguinSquad/Harvest-Festival

  1. @Override
  2. @Nonnull
  3. public Chunk provideChunk(int x, int z) {
  4. rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
  5. ChunkPrimer chunkprimer = new ChunkPrimer();
  6. biomesForGeneration = this.world.getBiomeProvider().getBiomes(biomesForGeneration, x * 16, z * 16, 16, 16);
  7. season = HFApi.calendar.getDate(world).getSeason();
  8. if (season == null) season = Season.SPRING;
  9. setBlocksInChunk(x, z, chunkprimer);
  10. Chunk chunk = new Chunk(world, chunkprimer, x, z);
  11. byte[] abyte = chunk.getBiomeArray();
  12. for (int i = 0; i < abyte.length; ++i) {
  13. abyte[i] = (byte) Biome.getIdForBiome(biomesForGeneration[i]);
  14. }
  15. chunk.generateSkylightMap();
  16. return chunk;
  17. }

代码示例来源:origin: McJtyMods/ModTutorials

  1. @Override
  2. public Chunk generateChunk(int x, int z) {
  3. ChunkPrimer chunkprimer = new ChunkPrimer();
  4. // Setup biomes for terraingen
  5. this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomesForGeneration, x * 4 - 2, z * 4 - 2, 10, 10);
  6. terraingen.setBiomesForGeneration(biomesForGeneration);
  7. terraingen.generate(x, z, chunkprimer);
  8. // Setup biomes again for actual biome decoration
  9. this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16);
  10. // This will replace stone with the biome specific stones
  11. terraingen.replaceBiomeBlocks(x, z, chunkprimer, this, biomesForGeneration);
  12. // Generate caves
  13. this.caveGenerator.generate(this.worldObj, x, z, chunkprimer);
  14. Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
  15. byte[] biomeArray = chunk.getBiomeArray();
  16. for (int i = 0; i < biomeArray.length; ++i) {
  17. biomeArray[i] = (byte)Biome.getIdForBiome(this.biomesForGeneration[i]);
  18. }
  19. chunk.generateSkylightMap();
  20. return chunk;
  21. }

代码示例来源:origin: vadis365/TheErebus

  1. @Override
  2. public Chunk generateChunk(int x, int z) {
  3. rand.setSeed(x * 341873128712L + z * 132897987541L);
  4. ChunkPrimer chunkprimer = new ChunkPrimer();
  5. biomesForGeneration = worldObj.getBiomeProvider().getBiomes(biomesForGeneration, x * 16, z * 16, 16, 16);
  6. generateTerrain(x, z, chunkprimer);
  7. replaceBlocksForBiome(x, z, biomesForGeneration, chunkprimer);
  8. caveGenerator.generate(worldObj, x, z, chunkprimer);
  9. ravineGenerator.generate(worldObj, x, z, chunkprimer);
  10. Chunk chunk = new Chunk(worldObj, chunkprimer, x, z);
  11. byte[] biomeArrayReference = chunk.getBiomeArray();
  12. for (int a = 0; a < biomeArrayReference.length; ++a)
  13. biomeArrayReference[a] = (byte) Biome.getIdForBiome(biomesForGeneration[a]);
  14. chunk.generateSkylightMap();
  15. chunk.resetRelightChecks();
  16. return chunk;
  17. }

相关文章

World类方法