Java Code Examples for net.minecraft.world.World.getActualHeight()

The following are Jave code examples for showing how to use getActualHeight() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Bewitchment   File: RitualFlames.java   View Source Code Vote up 6 votes
@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());
			}
		}
	}
}
 
Example 2
Project: harshencastle   File: HarshenUtils.java   View Source Code Vote up 6 votes
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);		
}
 
Example 3
Project: Technical   File: TechnicalWorldGenerator.java   View Source Code Vote up 6 votes
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);
	}
}
 
Example 4
Project: NemesisSystem   File: NemesisUtil.java   View Source Code Vote up 5 votes
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;
}