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

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

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

World.getBiome介绍

暂无

代码示例

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

  1. public IBlockState getStoneToPut(BlockPos coords) {
  2. Set<Type> types = BiomeDictionary.getTypes(supertile.getWorld().getBiome(coords));
  3. TIntArrayList values = new TIntArrayList();
  4. for(int i = 0; i < TYPES.length; i++) {
  5. int times = 1;
  6. if(types.contains(TYPES[i]))
  7. times = 12;
  8. for(int j = 0; j < times; j++)
  9. values.add(i);
  10. }
  11. int meta = values.get(supertile.getWorld().rand.nextInt(values.size()));
  12. BiomeStoneVariant variant = BiomeStoneVariant.values()[meta];
  13. return ModFluffBlocks.biomeStoneA.getDefaultState().withProperty(BotaniaStateProps.BIOMESTONE_VARIANT, variant);
  14. }

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

  1. @Override
  2. public int getDelayBetweenPassiveGeneration() {
  3. boolean rain = supertile.getWorld().getBiome(supertile.getPos()).getRainfall() > 0 && (supertile.getWorld().isRaining() || supertile.getWorld().isThundering());
  4. return rain ? 2 : 3;
  5. }

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

  1. if(event.getWorld().provider instanceof IFlowerlessWorld)
  2. flowers = ((IFlowerlessWorld) event.getWorld().provider).generateFlowers(event.getWorld());
  3. else if(event.getWorld().getBiome(pos) instanceof IFlowerlessBiome)
  4. flowers = ((IFlowerlessBiome) event.getWorld().getBiome(pos)).canGenerateFlowers(event.getWorld(), pos.getX(), pos.getZ());

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

  1. @Override
  2. public @Nonnull Biome getBiome(@Nonnull BlockPos pos) {
  3. return wrapped.getBiome(pos);
  4. }

代码示例来源:origin: ForestryMC/ForestryMC

  1. @Override
  2. public Biome getBiome() {
  3. BlockPos coords = getReferenceCoord();
  4. return world.getBiome(coords);
  5. }

代码示例来源:origin: ForestryMC/ForestryMC

  1. @Override
  2. public boolean isAcceptableFlower(IBlockState blockState, World world, BlockPos pos, String flowerType) {
  3. Biome biomeGenForCoords = world.getBiome(pos);
  4. return BiomeDictionary.hasType(biomeGenForCoords, BiomeDictionary.Type.END);
  5. }
  6. }

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

  1. @Override
  2. @Nonnull
  3. public List<Biome.SpawnListEntry> getPossibleCreatures(@Nonnull EnumCreatureType creatureType, @Nonnull BlockPos pos) {
  4. if (creatureType == EnumCreatureType.MONSTER) {
  5. return MONSTERS;
  6. } else return this.world.getBiome(pos).getSpawnableList(creatureType);
  7. }

代码示例来源:origin: ForestryMC/ForestryMC

  1. @Override
  2. public float getExactHumidity() {
  3. BlockPos coords = getCoordinates();
  4. return world.getBiome(coords).getRainfall();
  5. }

代码示例来源:origin: ForestryMC/ForestryMC

  1. @Override
  2. public float getExactTemperature() {
  3. BlockPos coords = getReferenceCoord();
  4. return world.getBiome(coords).getTemperature(coords);
  5. }

代码示例来源:origin: ForestryMC/ForestryMC

  1. @Override
  2. public EnumTemperature getTemperature() {
  3. BlockPos coords = getReferenceCoord();
  4. return EnumTemperature.getFromBiome(world.getBiome(coords), coords);
  5. }

代码示例来源:origin: ForestryMC/ForestryMC

  1. @Override
  2. public float getExactHumidity() {
  3. BlockPos coords = getReferenceCoord();
  4. return world.getBiome(coords).getRainfall();
  5. }

代码示例来源:origin: ForestryMC/ForestryMC

  1. @Override
  2. public float getExactTemperature() {
  3. BlockPos coords = getCoordinates();
  4. return world.getBiome(coords).getTemperature(coords);
  5. }

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

  1. @Override
  2. public boolean shouldGenerate(Random random, World world, BlockPos pos) {
  3. return world.getBiome(pos) == Biome.REGISTRY.getObject(new ResourceLocation("minecraft", "desert"));
  4. }
  5. }

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

  1. @Override
  2. public LocalBiome getSavedBiome(int x, int z) throws BiomeNotFoundException
  3. {
  4. return getBiomeById(Biome.getIdForBiome(this.world.getBiome(new BlockPos(x, 0, z))));
  5. }

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

  1. /**
  2. * Checks if light level is low enough
  3. * Only exception is the vampire biome in which it returns true if ontop of {@link ModBlocks#cursed_earth}
  4. */
  5. private boolean getCanSpawnHereRestricted() {
  6. boolean vampireBiome = ModBiomes.vampireForest.equals(this.world.getBiome(this.getPosition()));
  7. if (!vampireBiome) return isLowLightLevel();
  8. IBlockState iblockstate = this.world.getBlockState((new BlockPos(this)).down());
  9. return ModBlocks.cursed_earth.equals(iblockstate.getBlock());
  10. }
  11. }

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

  1. @Override
  2. public void populate(int x, int z) {
  3. int i = x * 16;
  4. int j = z * 16;
  5. BlockPos blockpos = new BlockPos(i, 0, j);
  6. Biome biome = this.worldObj.getBiome(blockpos.add(16, 0, 16));
  7. // Add biome decorations (like flowers, grass, trees, ...)
  8. biome.decorate(this.worldObj, this.random, blockpos);
  9. // Make sure animals appropriate to the biome spawn here when the chunk is generated
  10. WorldEntitySpawner.performWorldGenSpawning(this.worldObj, biome, i + 8, j + 8, 16, 16, this.random);
  11. }

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

  1. public static boolean isRainingAt(World world, BlockPos pos) {
  2. Biome biome = world.getBiome(pos);
  3. Weather weather = HFApi.calendar.getWeather(world);
  4. return (weather.isRain() || (weather.isSnow() && biome.isHighHumidity())) && world.canBlockSeeSky(pos) && world.getPrecipitationHeight(pos).getY() <= pos.getY() && world.getBiome(pos).canRain();
  5. }
  6. }

代码示例来源:origin: ForestryMC/Binnie

  1. @Override
  2. public boolean generate(final World world, final Random random, final BlockPos pos) {
  3. final Biome biome = world.getBiome(pos);
  4. if (!BiomeDictionary.hasType(biome, BiomeDictionary.Type.NETHER)) {
  5. return false;
  6. }
  7. if (this.embedInWall(world, Blocks.NETHERRACK, pos)) {
  8. world.setBlockState(pos, ModuleCore.hive.getDefaultState().withProperty(BlockExtraBeeHives.HIVE_TYPE, EnumHiveType.NETHER));
  9. }
  10. return true;
  11. }

代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft

  1. public static boolean isSwamp(World world, BlockPos pos)
  2. {
  3. ChunkDataTFC data = ChunkDataTFC.get(world, pos);
  4. return data != null && data.isInitialized() &&
  5. data.getRainfall() >= 375f &&
  6. data.getFloraDiversity() >= 0.5f &&
  7. data.getFloraDensity() >= 0.5f &&
  8. world.getBiome(pos).getHeightVariation() < 0.15;
  9. }

代码示例来源:origin: superckl/BiomeTweaker

  1. @SubscribeEvent(priority = EventPriority.HIGH)
  2. public void onBiomeDecorate(final DecorateBiomeEvent.Decorate e){
  3. if(BiomeEventHandler.decorateTypes.isEmpty())
  4. return;
  5. final Biome gen = e.getWorld().getBiome(e.getChunkPos().getBlock(0, 0, 0));
  6. if((BiomeEventHandler.decorateTypes.containsKey(Biome.getIdForBiome(gen))) && (BiomeEventHandler.decorateTypes.get(Biome.getIdForBiome(gen)).contains(e.getType().name()) || BiomeEventHandler.decorateTypes.get(Biome.getIdForBiome(gen)).contains("all")))
  7. e.setResult(Result.DENY);
  8. }

相关文章

World类方法