Code:java @EventHandler public void onPlayerInteract(PlayerInteractEvent event){ { Player player = event.getPlayer(); int blockId = player.getItemInHand().getType().getId(); if (blockId == 369){ Location loc = player.getTargetBlock(null, 50).getLocation(); Material mat = loc.getBlock().getType(); FallingBlock block = event.getPlayer().getWorld().spawnFallingBlock(loc,mat, loc.getBlock().getData()); block.setVelocity(new Vector(0, 3,0 )); loc.getBlock().setType(Material.AIR); } } }} That is my code that when right clicks block shoots it up. I want get nearby blocks, where clicked and shoot up them.
HashMap<Integer, BlockFace> BF = new HashMap<Integer, BlockFace>(); BF.put(1, BlockFace.DOWN); BF.put(2, BlockFace.UP); BF.put(3, BlockFace.SOUTH); BF.put(4, BlockFace.NORTH); BF.put(5, BlockFace.EAST); BF.put(6, BlockFace.WEST); for (int ee = 1; ee <= 6; ee++) { if (event.getBlock().getRelative(BF.get(ee))) { //Falling block code } This only works for blocks directly adjacent to the block you click give a plus effect.
sharp237 4x4 blocks or 3x3 blocks Fluxanoia Thanks EDIT by Moderator: merged posts, please use the edit button instead of double posting.