protected boolean isTargetOccluding(GlowBlock block, BlockFace face) { return block.getRelative(face).getType().isOccluding(); } }
/** * Returns whether the entity's eye location is within a solid block. * * @return true if the entity is in a solid block; false otherwise */ public boolean isWithinSolidBlock() { return getEyeLocation().getBlock().getType().isOccluding(); }
@Override public boolean onToolRightClick(GlowPlayer player, GlowBlock target, BlockFace face, ItemStack holding, Vector clickedLoc, EquipmentSlot hand) { if (target.getType() == Material.OBSIDIAN) { fireNetherPortal(target, face); return true; } if (target.getType() == Material.TNT) { fireTnt(target, player); return true; } if (target.isFlammable() || target.getType().isOccluding()) { setBlockOnFire(player, target, face, holding, clickedLoc, hand); return true; } return false; }
private void generatePodzolPatch(int sourceX, int sourceY, int sourceZ, World world) { for (int x = -2; x <= 2; x++) { for (int z = -2; z <= 2; z++) { if (Math.abs(x) == 2 && Math.abs(z) == 2) { continue; } for (int y = 2; y >= -3; y--) { Block block = world .getBlockAt(sourceX + x, sourceY + y, sourceZ + z); if (block.getType() == Material.GRASS || block.getType() == Material.DIRT) { BlockState state = block.getState(); state.setType(Material.DIRT); DirtType dirtType = DirtType.PODZOL; if (world.getBlockAt(sourceX + x, sourceY + y + 1, sourceZ + z) .getType().isOccluding()) { dirtType = DirtType.NORMAL; } state.setData(new Dirt(dirtType)); state.update(true); } else if (!block.isEmpty() && sourceY + y < sourceY) { break; } } } } } }
Block blockAbove = block.getRelative(BlockFace.UP); if (block.getType() == Material.DIRT && !blockAbove.getType().isOccluding() && blockAbove.getLightLevel() > 0) { block.setType(mycelBiome ? Material.MYCEL : Material.GRASS);
putVine(b, new Vine(), block); } else if (b.getType().isOccluding()) { vine.putOnFace(face); putVine(block, vine, null);
@Override public boolean isOccluding() { return m.isOccluding(); }
@Override public boolean isOccluding() { return b.getType().isOccluding(); }
@SuppressWarnings("deprecation") private boolean guessItchyBlockPre1_13(final Material mat) { return !mat.isOccluding() || !mat.isSolid() || mat.isTransparent(); }
public final boolean isNonstackableBlock(Block block) { // either because it really isn't or it just doesn't look return !block.getType().isOccluding();
private List<BlockFace> getPossibleFaces(Location loc) { List<BlockFace> faces = new ArrayList<>(); Block relative = loc.getBlock().getRelative(BlockFace.DOWN); if (relative.getType().isSolid() && relative.getType().isOccluding()) { faces.add(BlockFace.DOWN); } for (BlockFace f : ((Directional) Material.WALL_TORCH.createBlockData()).getFaces()) { Block block = loc.getBlock().getRelative(f); if (block.getType().isSolid() && block.getType().isOccluding()) { faces.add(f.getOppositeFace()); } } return faces; } }
/** * Determines whether a material can be fertilised underneath the water. * * @param block * * @return true if the block can be fertilised, false otherwise */ private boolean canBeFertilisedUnderwater(Block block) { if (serverVersion < 13) { return false; } return block.getType().isOccluding() && block.getRelative(BlockFace.UP).getType() == Material.WATER || block.getType() == Material.KELP || block.getType() == Material.SEAGRASS || block.getType() == Material.SEA_PICKLE; }
boolean isInNonOccludingBlock(Block block) { Material playerBlock = block.getType(); //Most blocks you can "stand" inside but cannot pass through (isSolid) usually can be seen through (!isOccluding) //This can cause players to technically be considered not in a portal block, yet in reality is still stuck in the portal animation. if ((!playerBlock.isSolid() || playerBlock.isOccluding())) //If it is _not_ such a block, { //Check the block above playerBlock = block.getRelative(BlockFace.UP).getType(); if ((!playerBlock.isSolid() || playerBlock.isOccluding())) return false; //player is not stuck } //Check if this block is also adjacent to a portal if (block.getRelative(BlockFace.EAST).getType() == Material.PORTAL || block.getRelative(BlockFace.WEST).getType() == Material.PORTAL || block.getRelative(BlockFace.NORTH).getType() == Material.PORTAL || block.getRelative(BlockFace.SOUTH).getType() == Material.PORTAL) return true; return false; }
boolean isInNonOccludingBlock(Block block) { Material playerBlock = block.getType(); //Most blocks you can "stand" inside but cannot pass through (isSolid) usually can be seen through (!isOccluding) //This can cause players to technically be considered not in a portal block, yet in reality is still stuck in the portal animation. if ((!playerBlock.isSolid() || playerBlock.isOccluding())) //If it is _not_ such a block, { //Check the block above playerBlock = block.getRelative(BlockFace.UP).getType(); if ((!playerBlock.isSolid() || playerBlock.isOccluding())) return false; //player is not stuck } //Check if this block is also adjacent to a portal if (block.getRelative(BlockFace.EAST).getType() == Material.PORTAL || block.getRelative(BlockFace.WEST).getType() == Material.PORTAL || block.getRelative(BlockFace.NORTH).getType() == Material.PORTAL || block.getRelative(BlockFace.SOUTH).getType() == Material.PORTAL) return true; return false; }
@Override public void run() { if (i < 100) { TARDISParticles.sendSnowParticles(location, player); player.getNearbyEntities(16.0, 16.0, 16.0).forEach((e) -> { if (e instanceof Player) { Player p = (Player) e; TARDISParticles.sendSnowParticles(location, p); } }); if (i % 5 == 0) { Location s = calculateLocationInCircle(location); s.setY(location.getWorld().getHighestBlockYAt(s)); Block b = s.getBlock(); if (b.isEmpty() && b.getRelative(BlockFace.DOWN).getType().isOccluding()) { b.setBlockData(TARDISConstants.SNOW); snow.add(b); } } i++; } else { plugin.getServer().getScheduler().cancelTask(task); task = 0; plugin.getTrackerKeeper().getExcitation().remove(player.getUniqueId()); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> snow.forEach((block) -> block.setBlockData(TARDISConstants.AIR)), 40L); } }
case SPONGE: Block swap_block = world.getBlockAt(x, y, z); if (!swap_block.getType().isOccluding()) { TARDISBlockSetters.setBlock(world, x, y, z, Material.AIR);