本文整理汇总了Java中net.minecraft.world.World.getActualHeight方法的典型用法代码示例。如果您正苦于以下问题:Java World.getActualHeight方法的具体用法?Java World.getActualHeight怎么用?Java World.getActualHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.getActualHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdate
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onUpdate(EntityPlayer player, IRitualHandler tile, World world, BlockPos pos, NBTTagCompound data, int ticks) {
if (ticks % 40 == 0) {
List<EntityItem> smeltables = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos).grow(3), ie -> !FurnaceRecipes.instance().getSmeltingResult(ie.getItem()).isEmpty());
smeltables.parallelStream().filter(ei -> !ei.getItem().getItem().hasContainerItem(ei.getItem())).findAny().ifPresent(e -> smeltAndSpawn(e));
if (rng.nextDouble() < 0.1) {
if (world.getGameRules().getBoolean("doFireTick")) {
int x = Math.round(pos.getX()) - 5 + rng.nextInt(12);
int y = Math.round(pos.getY()) - 5 + rng.nextInt(12);
int z = Math.round(pos.getZ()) - 5 + rng.nextInt(12);
if (y < 1)
y = 1;
if (y > world.getActualHeight())
y = world.getActualHeight() - 2;
BlockPos posn = new BlockPos(x, y, z);
if (canBurn(world, posn))
world.setBlockState(posn, Blocks.FIRE.getDefaultState());
}
}
}
}
示例2: getBottomBlockAir
import net.minecraft.world.World; //导入方法依赖的package包/类
public static BlockPos getBottomBlockAir(World world, BlockPos pos)
{
Chunk chunk = world.getChunkFromBlockCoords(pos);
BlockPos blockpos;
BlockPos blockpos1;
for (blockpos = new BlockPos(pos.getX(), 0, pos.getZ()); blockpos.getY() < world.getActualHeight()- 1; blockpos = blockpos1)
{
blockpos1 = blockpos.up();
IBlockState state = chunk.getBlockState(blockpos1);
if ((state.getBlock() instanceof BlockLiquid || world.isAirBlock(blockpos1)) &&
chunk.getBlockState(blockpos1.up()) instanceof BlockLiquid || world.isAirBlock(blockpos1.up()))
{
break;
}
}
return blockpos.up(2);
}
示例3: removeStone
import net.minecraft.world.World; //导入方法依赖的package包/类
private void removeStone(World world, Random random, int x, int z) {
int id = world.getBiomeGenForCoords(x, z).biomeID;
Block block = Blocks.stone;
if(id == 35 || id == 163 || id == 29 || id == 157 || id == 6 || id == 134 || id == 160 || id == 161 || id == 32 || id == 33) {
block = Granite;
} else if(id == 36 || id == 164 || id == 16 || id == 14 || id == 15 || id == 0 || id == 24 || id == 26) {
block = Basalt;
} else if(id == 2 || id == 1 || id == 7 || id == 129 || id == 5 || id == 30 || id == 11) {
block = Limestone;
} else if(id == 130 || id == 17 || id == 21 || id == 149 || id == 23 || id == 151 || id == 22 || id == 133 || id == 155 || id == 19 || id == 31 || id == 158 || id == 27) {
block = Shale;
} else if(id == 37 || id == 165 || id == 132 || id == 4 || id == 3 || id == 131 || id == 34 || id == 162 || id == 28 || id == 156 || id == 25) {
block = Slate;
} else if(id == 39 || id == 167 || id == 38 || id == 166 || id == 18 || id == 13 || id == 12 || id == 140) {
block = Gneiss;
} else {
FMLLog.log(Level.ERROR, Technical.modName + ": TechnicalWorldGenerator could not find stone type for " + world.getBiomeGenForCoords(x, z).biomeName + " (id " + id + "). Please report this to the mod author(s)");
}
for(int y = 0; y < world.getActualHeight(); y++) {
if(world.getBlock(x, y, z) == Blocks.stone)
world.setBlock(x, y, z, block, 0, 0);
}
}
示例4: isValidNemesisLocation
import net.minecraft.world.World; //导入方法依赖的package包/类
private static boolean isValidNemesisLocation(World world, BlockPos pos) {
BlockPos scan = new BlockPos(pos.getX(), world.getActualHeight(), pos.getZ());
while(scan.getY() > 0){
if (!world.isAirBlock(scan)) {
return world.getBlockState(scan).isOpaqueCube();
}
scan = scan.down();
}
return false;
}