getRelative

public abstract Block getRelative(int modX, int modY, int modZ)

Gets the block at the given offsets

Return

Block at the given offsets

Parameters

modX

X-coordinate offset

modY

Y-coordinate offset

modZ

Z-coordinate offset


public abstract Block getRelative(BlockFace face)

Gets the block at the given face

This method is equal to getRelative(face, 1)

Return

Block at the given face

Parameters

face

Face of this block to return

See also


public abstract Block getRelative(BlockFace face, int distance)

Gets the block at the given distance of the given face

For example, the following method places water at 100,102,100; two blocks above 100,100,100.

Block block = world.getBlockAt(100, 100, 100);
Block shower = block.getRelative(BlockFace.UP, 2);
shower.setType(Material.WATER);

Return

Block at the given face

Parameters

face

Face of this block to return

distance

Distance to get the block at