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

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

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

World.getHeight介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. seaLevel = w.getHeight( x, z );

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

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

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

  1. public HeightTransformAdapter(World world, RegionComponentType<ShortRasterTile> heightComponent, double heightScale, int heightOffset) {
  2. this.heightComponent = heightComponent;
  3. this.heightScale = heightScale;
  4. this.heightOffset = heightOffset;
  5. this.maxHeight = world.getHeight() - 1;
  6. }

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

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

代码示例来源:origin: ata4/dragon-mounts

  1. @Override
  2. public boolean isHabitatEnvironment(EntityTameableDragon dragon) {
  3. // true if located pretty high (> 2/3 of the maximum world height)
  4. return dragon.posY > dragon.worldObj.getHeight() * 0.66;
  5. }

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

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

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

  1. @Override
  2. public void generate(final World world, final Random rand, final BlockPos chunkPos) {
  3. for (int i = 0; i < this.count; i++) {
  4. final int x = rand.nextInt(16) + 8;
  5. final int z = rand.nextInt(16) + 8;
  6. final BlockPos blockpos = world.getHeight(chunkPos.add(x, 0, z));
  7. this.generator.generate(world, rand, blockpos);
  8. }
  9. }

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

  1. public static BlockPos getRandomPosInBox(World w, AxisAlignedBB box) {
  2. int x = (int) box.minX + w.rand.nextInt((int) (box.maxX - box.minX) + 1);
  3. int z = (int) box.minZ + w.rand.nextInt((int) (box.maxZ - box.minZ) + 1);
  4. int y = w.getHeight(new BlockPos(x, 0, z)).getY();
  5. if (y < box.minX || y > box.maxY) {
  6. y = (int) box.minY + w.rand.nextInt((int) (box.maxY - box.minY) + 1);
  7. }
  8. return new BlockPos(x, y, z);
  9. }

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

  1. if (y >= world.getHeight() || y <= 0
  2. || !world.isAirBlock(pos) && world.getBlockState(pos).getBlock() != place)
  3. break;

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

  1. public BlockPos getTargetPosition(int radius){
  2. int x = (int)myrmex.posX + myrmex.getRNG().nextInt(radius * 2) - radius;
  3. int z = (int)myrmex.posZ + myrmex.getRNG().nextInt(radius * 2) - radius;
  4. return myrmex.world.getHeight(new BlockPos(x, 0, z));
  5. }
  6. private boolean areMyrmexNear(double distance){

代码示例来源:origin: ata4/dragon-mounts

  1. /**
  2. * Returns the distance to the ground while the entity is flying.
  3. */
  4. public double getAltitude() {
  5. BlockPos groundPos = worldObj.getHeight(getPosition());
  6. return posY - groundPos.getY();
  7. }

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

  1. public void generateFromImage(World world, Random random, BlockPos start, int layer, int placeNotify, T worker) {
  2. if (layers != null && layers.size() > 0) {
  3. for (BlockMapping blockMapping : blockMap.values()) {
  4. blockMapping.reset(localRandom);
  5. }
  6. generateFromImage(world, random, new BlockPos(start.getX(), Math.min(start.getY(), world.getHeight() - layerCount), start.getZ()), layers, layer, placeNotify, worker);
  7. }
  8. }

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

  1. public boolean isFlat(World world, BlockPos pos) {
  2. BlockPos y10 = world.getHeight(pos.add(layerWidth, 0, 0));
  3. BlockPos y11 = world.getHeight(pos.add(layerWidth, 0, layerHeight));
  4. BlockPos y01 = world.getHeight(pos.add(0, 0, layerHeight));
  5. if (Math.abs(pos.getY() - y10.getY()) <= airLeeway && Math.abs(pos.getY() - y11.getY()) <= airLeeway && Math.abs(pos.getY() - y01.getY()) <= airLeeway) {
  6. return blockBelowMatches(airLeeway, world, Blocks.SAND, pos) && blockBelowMatches(airLeeway, world, Blocks.SAND, pos.add(layerWidth, 0, 0)) && blockBelowMatches(airLeeway, world, Blocks.SAND, pos.add(0, 0, layerHeight)) && blockBelowMatches(airLeeway, world, Blocks.SAND, pos.add(layerWidth, 0, layerHeight));
  7. }
  8. return false;
  9. }

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

  1. public static float getUndergroundCoefficient(World world, BlockPos pos)
  2. {
  3. if (!(isUnderground(world, pos)))
  4. return 1F;
  5. int verticalSurface = world.getHeight((int)pos.getX(), (int)pos.getZ());
  6. int depth = verticalSurface - pos.getY();
  7. int equilibriumDepth = ModConfig.temperature.equilibriumDepth;
  8. if (depth >= equilibriumDepth)
  9. return 0F;
  10. return 1F - (float)depth / (float)equilibriumDepth;
  11. }

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

  1. @Override
  2. public boolean placeBlock(BlockPos pos, IBlockState state, int priority) {
  3. if (pos.getY() <= 0 || pos.getY() >= world.getHeight()) {
  4. return false;
  5. }
  6. IBlockState adjustedState = state;
  7. if (template.getValidationSettings().isBlockSwap()) {
  8. adjustedState = getBiomeSpecificBlockState(biome, state);
  9. }
  10. int updateFlag = state.canProvidePower() ? 3 : 2;
  11. return world.setBlockState(pos, adjustedState, updateFlag);
  12. }

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

  1. private BlockPos findSolidPos(World world, BlockPos position) {
  2. Material material;
  3. BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(world.getHeight(position).up(30));
  4. while (((material = world.getBlockState(pos).getMaterial()) == Material.LEAVES || material == Material.PLANTS || world.isAirBlock(pos)) && pos.getY() > 50) {
  5. pos.move(EnumFacing.DOWN);
  6. }
  7. return pos.up();
  8. }

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

  1. private static BlockPos moveAboveSolid(BlockPos pos, EntityCreature mob) {
  2. if (!mob.world.getBlockState(pos).getMaterial().isSolid()) {
  3. return pos;
  4. } else {
  5. BlockPos blockpos;
  6. for (blockpos = pos.up(); blockpos.getY() < mob.world.getHeight() && mob.world.getBlockState(blockpos).getMaterial().isSolid(); blockpos = blockpos.up()) {
  7. ;
  8. }
  9. return blockpos;
  10. }
  11. }

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

  1. private void teleportBehind(EntityLivingBase target) {
  2. BlockPos behind = UtilLib.getPositionBehindEntity(target, 1.5F);
  3. this.setPosition(behind.getX(), target.posY, behind.getZ());
  4. if (!this.isNotColliding()) {
  5. int y = getEntityWorld().getHeight(behind).getY();
  6. this.setPosition(behind.getX(), y, behind.getZ());
  7. }
  8. }
  9. }

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

  1. private static int getYForCocoon(World world, int x, int z) {
  2. int y = world.getHeight(new BlockPos(x, 0, z)).getY() - 1;
  3. BlockPos pos = new BlockPos(x, y, z);
  4. IBlockState blockState = world.getBlockState(pos);
  5. if (!blockState.getBlock().isLeaves(blockState, world, pos)) {
  6. return -1;
  7. }
  8. do {
  9. pos = pos.down();
  10. blockState = world.getBlockState(pos);
  11. } while (blockState.getBlock().isLeaves(blockState, world, pos));
  12. return y;
  13. }

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

  1. private static AxisAlignedBB getHarvestBox(World world, IFarmHousing farmHousing, boolean toWorldHeight) {
  2. BlockPos coords = farmHousing.getCoords();
  3. Vec3i area = farmHousing.getArea();
  4. Vec3i offset = farmHousing.getOffset();
  5. BlockPos min = coords.add(offset);
  6. BlockPos max = min.add(area);
  7. int maxY = max.getY();
  8. if (toWorldHeight) {
  9. maxY = world.getHeight();
  10. }
  11. return new AxisAlignedBB(min.getX(), min.getY(), min.getZ(), max.getX(), maxY, max.getZ());
  12. }

相关文章

World类方法