Java Code Examples for org.bukkit.block.BlockState#getMaterial()

The following examples show how to use org.bukkit.block.BlockState#getMaterial() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockTracker.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
boolean isPlaced(BlockState state) {
  // If block was registered with a specific world, check that the new state
  // has the same world, otherwise assume the block is still placed.
  Material material = materials.get(state.getBlock());
  return material == null || material == state.getMaterial();
}
 
Example 2
Source File: FallingBlocksRule.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
public boolean canFall(BlockState block) {
    // Can't spawn falling air blocks
    return block.getMaterial() != Material.AIR &&
           fall.query(new BlockQuery(block))
               .toBoolean(block.getMaterial().hasGravity());
}
 
Example 3
Source File: FallingBlocksRule.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
public boolean canSupport(BlockState supporter) {
    return supporter.getMaterial() != Material.AIR &&
           stick.query(new BlockQuery(supporter)).isAllowed();
}
 
Example 4
Source File: BlockTracker.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
boolean isPlaced(BlockState state) {
    // If block was registered with a specific material, check that the new state
    // has the same material, otherwise assume the block is still placed.
    Material material = materials.get(state.getBlock());
    return material == null || material == state.getMaterial();
}