本文整理了Java中net.minecraft.world.World.getHeight()
方法的一些代码示例,展示了World.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getHeight()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getHeight
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
seaLevel = w.getHeight( x, z );
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public int getHeight(int x, int z) {
return wrapped.getHeight(x, z);
}
代码示例来源:origin: gegy1000/Terrarium
public HeightTransformAdapter(World world, RegionComponentType<ShortRasterTile> heightComponent, double heightScale, int heightOffset) {
this.heightComponent = heightComponent;
this.heightScale = heightScale;
this.heightOffset = heightOffset;
this.maxHeight = world.getHeight() - 1;
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public int getHeight() {
return wrapped.getHeight();
}
代码示例来源:origin: ata4/dragon-mounts
@Override
public boolean isHabitatEnvironment(EntityTameableDragon dragon) {
// true if located pretty high (> 2/3 of the maximum world height)
return dragon.posY > dragon.worldObj.getHeight() * 0.66;
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public @Nonnull BlockPos getHeight(@Nonnull BlockPos pos) {
return wrapped.getHeight(pos);
}
代码示例来源:origin: superckl/BiomeTweaker
@Override
public void generate(final World world, final Random rand, final BlockPos chunkPos) {
for (int i = 0; i < this.count; i++) {
final int x = rand.nextInt(16) + 8;
final int z = rand.nextInt(16) + 8;
final BlockPos blockpos = world.getHeight(chunkPos.add(x, 0, z));
this.generator.generate(world, rand, blockpos);
}
}
代码示例来源:origin: TeamLapen/Vampirism
public static BlockPos getRandomPosInBox(World w, AxisAlignedBB box) {
int x = (int) box.minX + w.rand.nextInt((int) (box.maxX - box.minX) + 1);
int z = (int) box.minZ + w.rand.nextInt((int) (box.maxZ - box.minZ) + 1);
int y = w.getHeight(new BlockPos(x, 0, z)).getY();
if (y < box.minX || y > box.maxY) {
y = (int) box.minY + w.rand.nextInt((int) (box.maxY - box.minY) + 1);
}
return new BlockPos(x, y, z);
}
代码示例来源:origin: Vazkii/Botania
if (y >= world.getHeight() || y <= 0
|| !world.isAirBlock(pos) && world.getBlockState(pos).getBlock() != place)
break;
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public BlockPos getTargetPosition(int radius){
int x = (int)myrmex.posX + myrmex.getRNG().nextInt(radius * 2) - radius;
int z = (int)myrmex.posZ + myrmex.getRNG().nextInt(radius * 2) - radius;
return myrmex.world.getHeight(new BlockPos(x, 0, z));
}
private boolean areMyrmexNear(double distance){
代码示例来源:origin: ata4/dragon-mounts
/**
* Returns the distance to the ground while the entity is flying.
*/
public double getAltitude() {
BlockPos groundPos = worldObj.getHeight(getPosition());
return posY - groundPos.getY();
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
public void generateFromImage(World world, Random random, BlockPos start, int layer, int placeNotify, T worker) {
if (layers != null && layers.size() > 0) {
for (BlockMapping blockMapping : blockMap.values()) {
blockMapping.reset(localRandom);
}
generateFromImage(world, random, new BlockPos(start.getX(), Math.min(start.getY(), world.getHeight() - layerCount), start.getZ()), layers, layer, placeNotify, worker);
}
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
public boolean isFlat(World world, BlockPos pos) {
BlockPos y10 = world.getHeight(pos.add(layerWidth, 0, 0));
BlockPos y11 = world.getHeight(pos.add(layerWidth, 0, layerHeight));
BlockPos y01 = world.getHeight(pos.add(0, 0, layerHeight));
if (Math.abs(pos.getY() - y10.getY()) <= airLeeway && Math.abs(pos.getY() - y11.getY()) <= airLeeway && Math.abs(pos.getY() - y01.getY()) <= airLeeway) {
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));
}
return false;
}
代码示例来源:origin: Glitchfiend/ToughAsNails
public static float getUndergroundCoefficient(World world, BlockPos pos)
{
if (!(isUnderground(world, pos)))
return 1F;
int verticalSurface = world.getHeight((int)pos.getX(), (int)pos.getZ());
int depth = verticalSurface - pos.getY();
int equilibriumDepth = ModConfig.temperature.equilibriumDepth;
if (depth >= equilibriumDepth)
return 0F;
return 1F - (float)depth / (float)equilibriumDepth;
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@Override
public boolean placeBlock(BlockPos pos, IBlockState state, int priority) {
if (pos.getY() <= 0 || pos.getY() >= world.getHeight()) {
return false;
}
IBlockState adjustedState = state;
if (template.getValidationSettings().isBlockSwap()) {
adjustedState = getBiomeSpecificBlockState(biome, state);
}
int updateFlag = state.canProvidePower() ? 3 : 2;
return world.setBlockState(pos, adjustedState, updateFlag);
}
代码示例来源:origin: TeamLapen/Vampirism
private BlockPos findSolidPos(World world, BlockPos position) {
Material material;
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(world.getHeight(position).up(30));
while (((material = world.getBlockState(pos).getMaterial()) == Material.LEAVES || material == Material.PLANTS || world.isAirBlock(pos)) && pos.getY() > 50) {
pos.move(EnumFacing.DOWN);
}
return pos.up();
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
private static BlockPos moveAboveSolid(BlockPos pos, EntityCreature mob) {
if (!mob.world.getBlockState(pos).getMaterial().isSolid()) {
return pos;
} else {
BlockPos blockpos;
for (blockpos = pos.up(); blockpos.getY() < mob.world.getHeight() && mob.world.getBlockState(blockpos).getMaterial().isSolid(); blockpos = blockpos.up()) {
;
}
return blockpos;
}
}
代码示例来源:origin: TeamLapen/Vampirism
private void teleportBehind(EntityLivingBase target) {
BlockPos behind = UtilLib.getPositionBehindEntity(target, 1.5F);
this.setPosition(behind.getX(), target.posY, behind.getZ());
if (!this.isNotColliding()) {
int y = getEntityWorld().getHeight(behind).getY();
this.setPosition(behind.getX(), y, behind.getZ());
}
}
}
代码示例来源:origin: ForestryMC/ForestryMC
private static int getYForCocoon(World world, int x, int z) {
int y = world.getHeight(new BlockPos(x, 0, z)).getY() - 1;
BlockPos pos = new BlockPos(x, y, z);
IBlockState blockState = world.getBlockState(pos);
if (!blockState.getBlock().isLeaves(blockState, world, pos)) {
return -1;
}
do {
pos = pos.down();
blockState = world.getBlockState(pos);
} while (blockState.getBlock().isLeaves(blockState, world, pos));
return y;
}
代码示例来源:origin: ForestryMC/ForestryMC
private static AxisAlignedBB getHarvestBox(World world, IFarmHousing farmHousing, boolean toWorldHeight) {
BlockPos coords = farmHousing.getCoords();
Vec3i area = farmHousing.getArea();
Vec3i offset = farmHousing.getOffset();
BlockPos min = coords.add(offset);
BlockPos max = min.add(area);
int maxY = max.getY();
if (toWorldHeight) {
maxY = world.getHeight();
}
return new AxisAlignedBB(min.getX(), min.getY(), min.getZ(), max.getX(), maxY, max.getZ());
}
内容来源于网络,如有侵权,请联系作者删除!