Package org.spout.api.material.block

Examples of org.spout.api.material.block.BlockFace


    return 0;
  }

  @Override
  public boolean isReceivingPower(Block block) {
    BlockFace face = this.getFacing(block).getOpposite();
    return RedstoneUtil.isEmittingPower(block.translate(face), getFacing(block));
  }
View Full Code Here


    }
    return 0;
  }

  private short getInputBStrength(Block block) {
    BlockFace dir = this.getFacing(block);
    BlockFace opp = dir.getOpposite();
    short power = 0;
    for (BlockFace face : BlockFaces.ESWN) {
      if (face == dir || face == opp) {
        continue;
      }
View Full Code Here

import org.spout.vanilla.world.generator.theend.TheEndGenerator;

public class NetherPortalObject extends WorldGeneratorObject {
  public BlockFace getDirection(Point pos) {
    final Block bottomLeftCorner = pos.getWorld().getBlock(pos);
    BlockFace direction = null;
    // Get the direction of the frame on horizontal axis
    for (BlockFace face : BlockFaces.NESW) {
      if (bottomLeftCorner.translate(face).isMaterial(VanillaMaterials.OBSIDIAN)) {
        if (direction != null) {
          // Two many corners
View Full Code Here

  public boolean find(Block bottomBlock) {

    final Block bottomLeftCorner = bottomBlock;

    // Frame not there or misshapen frame
    BlockFace direction = getDirection(bottomLeftCorner.getPosition());
    if (direction == null) {
      return false;
    }

    // Define other corners of the frame
View Full Code Here

    } else {
      material = VanillaMaterials.AIR;
    }

    // Activate or deactivate the portal
    BlockFace direction = getDirection(bottomBlock.getPosition());
    Block corner1 = bottomBlock.translate(direction).translate(BlockFace.TOP);
    Block corner2 = corner1.translate(direction);
    for (int d = 0; d < 3; d++) {
      corner1.translate(BlockFace.TOP, d).setMaterial(material);
      corner2.translate(BlockFace.TOP, d).setMaterial(material);
View Full Code Here

    PlayerInteract hit = ((Player) source).get(PlayerInteract.class);
    if (hit != null) {
      final Block hitting = hit.getTargetBlock();
      if (hitting != null && selection != null && !hitting.getMaterial().equals(VanillaMaterials.AIR)) {
        final BlockFace clicked = hit.getTargetFace();
        System.out.println(clicked);
        if (clicked == null) {
          return;
        }
        client.getLogger().info(clicked.name());
        client.getScheduler().safeRun(VanillaPlugin.getInstance(), new Runnable() {
          @Override
          public void run() {
            hitting.translate(clicked).setMaterial(selection);
          }
View Full Code Here

    position.getWorld().setBlockMaterial(transformed.getFloorX(), transformed.getFloorY(), transformed.getFloorZ(),
        material, data, null);
    if (material instanceof Directional) {
      final Directional directional = (Directional) material;
      final Block block = position.getWorld().getBlock(transformed);
      final BlockFace face = directional.getFacing(block);
      if (face != BlockFace.BOTTOM && face != BlockFace.TOP) {
        directional.setFacing(block, BlockFace.fromYaw(face.getDirection().getAxesAngleDeg().getY()
            + rotation.getAxesAngleDeg().getY()));
      }
    } else if (material instanceof Attachable) {
      final Attachable attachable = (Attachable) material;
      final Block block = position.getWorld().getBlock(transformed);
      final BlockFace face = attachable.getAttachedFace(block);
      if (face != BlockFace.BOTTOM && face != BlockFace.TOP) {
        attachable.setAttachedFace(block, BlockFace.fromYaw(face.getDirection().getAxesAngleDeg().getY()
            + rotation.getAxesAngleDeg().getY()), null);
      }
    }
  }
View Full Code Here

    return this.isPowered() && this.getFacing(block) == direction;
  }

  @Override
  public boolean isReceivingPower(Block block) {
    final BlockFace face = this.getFacing(block);
    return RedstoneUtil.isEmittingPower(block.translate(face.getOpposite()), face);
  }
View Full Code Here

    }
  }

  @Override
  public boolean isReceivingPower(Block block) {
    BlockFace attached = this.getAttachedFace(block);
    return RedstoneUtil.isEmittingPower(block.translate(attached), attached.getOpposite());
  }
View Full Code Here

      this.connect(r1, r2);
      r1.connect();
      r2.connect();
    } else if (this.neighbours.size() == 3) {
      //sort neighbours: middle at index 1
      BlockFace middle = this.neighbours.get(1).direction.getOpposite();
      if (middle == this.neighbours.get(2).direction) {
        //dirs[1] need to be swapped with dirs[0]
        Collections.swap(this.neighbours, 1, 0);
      } else if (middle == this.neighbours.get(0).direction) {
        //dirs[1] need to be swapped with dirs[2]
View Full Code Here

TOP

Related Classes of org.spout.api.material.block.BlockFace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.