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

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

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

World.getSeaLevel介绍

暂无

代码示例

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

  1. @Override
  2. public int getSeaLevel() {
  3. return wrapped.getSeaLevel();
  4. }

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

  1. public boolean getCanSpawnHere() {
  2. return this.posY > 30 && this.posY < (double) this.world.getSeaLevel();
  3. }

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

  1. @Override
  2. public int getMinimumSpawnHeight(World world)
  3. {
  4. return world.getSeaLevel() + 1;
  5. }

代码示例来源:origin: lawremi/CustomOreGen

  1. @Override
  2. public int getHeight(World world, int x, int z) {
  3. return world.getSeaLevel();
  4. }

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

  1. if(startCenter.getY() < world.getSeaLevel()) // Not below sea level
  2. return;

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

  1. @Override
  2. public int getSeaLevel() {
  3. return getActualWorld().getSeaLevel();
  4. }

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

  1. @Override
  2. protected void composeDecoration(IChunkGenerator generator, World world, int chunkX, int chunkZ, Biome biome) {
  3. int globalX = chunkX << 4;
  4. int globalZ = chunkZ << 4;
  5. BlockPos pos = new BlockPos(globalX, 0, globalZ);
  6. if (this.random.nextInt(8) == 0) {
  7. if (TerrainGen.populate(generator, world, this.random, globalX, globalZ, false, PopulateChunkEvent.Populate.EventType.LAVA)) {
  8. int offsetX = this.random.nextInt(16) + 8;
  9. int offsetY = this.random.nextInt(this.random.nextInt(world.getHeight() - 8) + 8);
  10. int offsetZ = this.random.nextInt(16) + 8;
  11. if (offsetY < world.getSeaLevel() || this.random.nextInt(10) == 0) {
  12. (new WorldGenLakes(Blocks.LAVA)).generate(world, this.random, pos.add(offsetX, offsetY, offsetZ));
  13. }
  14. }
  15. }
  16. }
  17. }

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

  1. else if (i2 * 8 + j2 < world.getSeaLevel())

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

  1. int minY = Math.max(0, world.getSeaLevel() - 3);

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

  1. @Override
  2. public boolean getCanSpawnHere()
  3. {
  4. BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
  5. if (blockpos.getY() <= this.world.getSeaLevel())
  6. {
  7. return false;
  8. }
  9. else
  10. {
  11. if (blockpos.getY() >= 90)
  12. {
  13. return false;
  14. }
  15. else
  16. {
  17. int light = this.world.getLightFromNeighbors(blockpos);
  18. return light > 8 && super.getCanSpawnHere();
  19. }
  20. }
  21. }

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

  1. @Override
  2. public boolean getCanSpawnHere()
  3. {
  4. BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
  5. if (blockpos.getY() <= this.world.getSeaLevel())
  6. {
  7. return false;
  8. }
  9. else
  10. {
  11. if (blockpos.getY() >= 90)
  12. {
  13. return false;
  14. }
  15. else
  16. {
  17. int light = this.world.getLightFromNeighbors(blockpos);
  18. return light > 8 && super.getCanSpawnHere();
  19. }
  20. }
  21. }

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

  1. public final void generateGlacierBiome(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
  2. int i = worldIn.getSeaLevel();
  3. IBlockState iblockstate = this.topBlock;
  4. IBlockState iblockstate1 = rand.nextInt(5) == 0 ? Blocks.ICE.getDefaultState() : this.fillerBlock;

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

  1. @Override
  2. public boolean getCanSpawnHere()
  3. {
  4. BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
  5. if (blockpos.getY() <= this.world.getSeaLevel())
  6. {
  7. return false;
  8. }
  9. else
  10. {
  11. if (blockpos.getY() >= 90)
  12. {
  13. return false;
  14. }
  15. else
  16. {
  17. int light = this.world.getLightFromNeighbors(blockpos);
  18. return light > 8 && super.getCanSpawnHere();
  19. }
  20. }
  21. }

代码示例来源:origin: joshiejack/Mariculture

  1. @Override
  2. protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) {
  3. Biome biome = worldObj.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
  4. if (biome == Biomes.OCEAN || biome == Biomes.DEEP_OCEAN || biome == Biomes.FROZEN_OCEAN) {
  5. IBlockState state = data.getBlockState(x, y, z);
  6. if (state.getBlock() == Blocks.STONE || state == OCEAN_SURFACE || state == OCEAN_FILLER || (state == BEDROCK && y > 1)) {
  7. if (y - 1 < 4) {
  8. data.setBlockState(x, y, z, OCEAN_SURFACE);
  9. } else {
  10. if (y < worldObj.getSeaLevel())
  11. data.setBlockState(x, y, z, WATER);
  12. else data.setBlockState(x, y, z, AIR);
  13. if (y < 6 && y > 1) {
  14. data.setBlockState(x, y - 1, z, OCEAN_FILLER);
  15. }
  16. }
  17. }
  18. }
  19. }

代码示例来源:origin: joshiejack/Mariculture

  1. int i = worldIn.getSeaLevel();
  2. IBlockState iblockstate = this.topBlock;
  3. IBlockState iblockstate1 = this.fillerBlock;

代码示例来源:origin: joshiejack/Mariculture

  1. private void genSandyOceans(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
  2. int i = worldIn.getSeaLevel();
  3. IBlockState iblockstate = Abyssal.OCEAN_SURFACE;
  4. IBlockState iblockstate1 = Abyssal.OCEAN_FILLER;

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

  1. public static boolean canBlockSeeSun(World world, BlockPos pos) {
  2. if (pos.getY() >= world.getSeaLevel()) {
  3. return world.canSeeSky(pos);
  4. } else {
  5. BlockPos blockpos = new BlockPos(pos.getX(), world.getSeaLevel(), pos.getZ());
  6. if (!world.canSeeSky(blockpos)) {
  7. return false;
  8. } else {
  9. int liquidBlocks = 0;
  10. for (blockpos = blockpos.down(); blockpos.getY() > pos.getY(); blockpos = blockpos.down()) {
  11. IBlockState iblockstate = world.getBlockState(blockpos);
  12. if (iblockstate.getBlock().getLightOpacity(iblockstate, world, blockpos) > 0) {
  13. if (iblockstate.getMaterial().isLiquid()) {
  14. liquidBlocks++;
  15. if (liquidBlocks >= Balance.vp.SUNDAMAGE_WATER_BLOCKS) {
  16. return false;
  17. }
  18. } else {
  19. return false;
  20. }
  21. }
  22. }
  23. return true;
  24. }
  25. }
  26. }

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

  1. @Override
  2. protected void borderLeveling(World world, int x, int z, StructureTemplate template, StructureBB bb) {
  3. if (getMaxLeveling() <= 0) {
  4. return;
  5. }
  6. int topFilledY = Math.max(world.getSeaLevel(), WorldStructureGenerator.getTargetY(world, x, z, true));
  7. int topNonAirBlock = BlockTools.getTopFilledHeight(world.getChunkFromBlockCoords(new BlockPos(x, 1, z)), x, z, false);
  8. int step = WorldStructureGenerator.getStepNumber(x, z, bb.min.getX(), bb.max.getX(), bb.min.getZ(), bb.max.getZ());
  9. int startY = Math.min(bb.min.getY() + template.getOffset().getY() + step, topFilledY + 1);
  10. for (int y = topNonAirBlock; y >= startY; y--) {
  11. handleClearAction(world, new BlockPos(x, y, z), template, bb);
  12. }
  13. Biome biome = world.provider.getBiomeForCoords(new BlockPos(x, 1, z));
  14. IBlockState fillBlock = biome.topBlock;
  15. int y = bb.min.getY() + template.getOffset().getY() + step - 1;
  16. BlockPos pos = new BlockPos(x, y, z);
  17. IBlockState state = world.getBlockState(pos);
  18. Block block = state.getBlock();
  19. if (block != Blocks.FLOWING_WATER && block != Blocks.WATER && !AWStructureStatics.isSkippable(state)) {
  20. world.setBlockState(pos, fillBlock);
  21. }
  22. }
  23. }

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

  1. blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos).down();
  2. if (blockpos.getY() < worldIn.getSeaLevel()) {
  3. blockpos = new BlockPos(blockpos.getX(), worldIn.getSeaLevel() - 1, blockpos.getZ());
  4. while (blockpos.getY() >= worldIn.getSeaLevel() - 1) {
  5. IBlockState iblockstate4 = worldIn.getBlockState(blockpos);

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

  1. blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos).down();
  2. if (blockpos.getY() < worldIn.getSeaLevel()) {
  3. blockpos = new BlockPos(blockpos.getX(), worldIn.getSeaLevel() - 1, blockpos.getZ());
  4. while (blockpos.getY() >= worldIn.getSeaLevel() - 1) {
  5. IBlockState iblockstate4 = worldIn.getBlockState(blockpos);

相关文章

World类方法