org.bukkit.material.PistonExtensionMaterial Java Examples

The following examples show how to use org.bukkit.material.PistonExtensionMaterial. 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: BlockTransformListener.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventWrapper
public void onBlockPistonExtend(final BlockPistonExtendEvent event) {
  Map<Block, BlockState> newStates = new HashMap<>();

  // Add the arm of the piston, which will extend into the adjacent block.
  PistonExtensionMaterial pistonExtension =
      new PistonExtensionMaterial(Material.PISTON_EXTENSION);
  pistonExtension.setFacingDirection(event.getDirection());
  BlockState pistonExtensionState = event.getBlock().getRelative(event.getDirection()).getState();
  pistonExtensionState.setType(pistonExtension.getItemType());
  pistonExtensionState.setData(pistonExtension);
  newStates.put(event.getBlock(), pistonExtensionState);

  this.onPistonMove(event, event.getBlocks(), newStates);
}
 
Example #2
Source File: BlockTransformListener.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventWrapper
public void onBlockPistonExtend(final BlockPistonExtendEvent event) {
    Map<Block, BlockState> newStates = new HashMap<>();

    // Add the arm of the piston, which will extend into the adjacent block.
    PistonExtensionMaterial pistonExtension = new PistonExtensionMaterial(Material.PISTON_EXTENSION);
    pistonExtension.setFacingDirection(event.getDirection());
    BlockState pistonExtensionState = event.getBlock().getRelative(event.getDirection()).getState();
    pistonExtensionState.setType(pistonExtension.getItemType());
    pistonExtensionState.setData(pistonExtension);
    newStates.put(event.getBlock(), pistonExtensionState);

    this.onPistonMove(event, event.getBlocks(), newStates);
}