Package org.spout.api.geo.cuboid

Examples of org.spout.api.geo.cuboid.Block


    }
  }

  @Override
  public boolean onDestroy(Block block, Cause<?> cause) {
    Block input = block.translate(this.getFacing(block).getOpposite());
    if (input.getMaterial().isMaterial(inputs)) {
      Inventory inventory = input.getType(Container.class).getInventory();
      ComparableViewer cViewer = null;
      for (InventoryViewer viewer : inventory.getViewers()) {
        if (viewer instanceof ComparableViewer) {
          cViewer = (ComparableViewer) viewer;
        }
View Full Code Here


  public short getRedstonePowerStrength(BlockSnapshot state) {
    return this.isPowered() ? REDSTONE_POWER_MAX : REDSTONE_POWER_MIN;  //TODO:
  }

  private short getInputAStrength(Block block) {
    Block input = block.translate(this.getFacing(block).getOpposite());
    if (input.getMaterial().isMaterial(inputs)) {
      Inventory inv = input.getType(Container.class).getInventory();
      ComparableViewer view = null;
      for (InventoryViewer viewer : inv.getViewers()) {
        if (viewer instanceof ComparableViewer) {
          view = (ComparableViewer) viewer;
        }
View Full Code Here

    short power = 0;
    for (BlockFace face : BlockFaces.ESWN) {
      if (face == dir || face == opp) {
        continue;
      }
      Block toCheck = block.translate(face);
      VanillaBlockMaterial material = (VanillaBlockMaterial) toCheck.getMaterial();
      short matPower = material.getRedstonePower(toCheck);
      short indPower = material.getIndirectRedstonePower(toCheck, face.getOpposite(), RedstonePowerMode.ALLEXCEPTWIRE);
      if (matPower > power) {
        power = matPower;
      }
View Full Code Here

    }
    return null;
  }

  public MinecartTrackLogic getLogic(BlockFace direction) {
    Block block = this.block.translate(direction);
    MinecartTrackLogic logic;
    logic = create(block);
    if (logic != null) {
      return logic;
    }
    logic = create(block.translate(BlockFace.TOP));
    if (logic != null) {
      return logic;
    }
    logic = create(block.translate(BlockFace.BOTTOM));
    return logic;
  }
View Full Code Here

    }
  }

  @EventHandler
  public void onEntityTileData(EntityTileDataEvent event) {
    Block b = event.getBlock();
    event.getMessages().add(new EntityTileDataMessage(b.getX(), b.getY(), b.getZ(), event.getAction(), event.getData(), getRepositionManager()));
  }
View Full Code Here

    if (!(entity instanceof Player) || type != Action.RIGHT_CLICK) {
      return;
    }

    EntityHead head = entity.add(EntityHead.class);
    Block b = head.getBlockView(1).next();
    if (!b.isMaterial(VanillaMaterials.WATER)) {
      return;
    }
    this.spawnEntity(b, new Vector3f(0.0, 0.25, 0.0));
  }
View Full Code Here

  }

  @Override
  public void onDynamicUpdate(Block block, long updateTime, int data) {
    block.dynamicUpdate(block.getWorld().getAge() + getGrowTime(block), true);
    Block below = block.translate(BlockFace.BOTTOM);
    // Only fire dynamic updates for the bottom block
    if (!this.canAttachTo(below, BlockFace.TOP) || below.isMaterial(this)) {
      return;
    }
    if (isFullyGrown(block)) {
      return;
    }
    // Check the top block for availability and light level
    Block top = getTop(block).translate(BlockFace.TOP);
    if (!top.isMaterial(VanillaMaterials.AIR)) {
      return;
    }
    int minLight = this.getMinimumLightToGrow();
    if (minLight > 0 && VanillaLighting.getLight(top) < minLight) {
      return;
View Full Code Here

    Sleep sleep = player.get(Sleep.class);
    if (sleep == null) {
      return;
    }

    final Block head = getCorrectHalf(block, true);
    final World world = player.getWorld();
    final Sky sky = world.get(Sky.class);

    for (Entity e : world.getNearbyEntities(player, NEARBY_MONSTER_RANGE)) {
      if (e.get(Living.class) instanceof Hostile) {
View Full Code Here

    this.getDrops().NOT_CREATIVE.add(VanillaMaterials.BED);
  }

  @Override
  public boolean onDestroy(Block block, Cause<?> cause) {
    Block head = getCorrectHalf(block, true);
    Block foot = getCorrectHalf(block, false);
    return head.setMaterial(VanillaMaterials.AIR, cause) && foot.setMaterial(VanillaMaterials.AIR, cause);
  }
View Full Code Here

   *
   * @param footBlock of the bed
   * @param facing of the bed
   */
  public void create(Block footBlock, BlockFace facing) {
    Block headBlock = footBlock.translate(facing);
    if (headBlock.getWorld().getGenerator() instanceof NetherGenerator) {
      ExplosionModel explosion = new ExplosionModelSpherical();
      explosion.execute(headBlock.getPosition(), NETHER_EXPLOSION_SIZE, true, toCause(footBlock));
    } else {
      footBlock.setMaterial(this, 0x0, toCause(footBlock));
      headBlock.setMaterial(this, 0x8, toCause(footBlock));
      setFacing(footBlock, facing);
      setFacing(headBlock, facing);
    }
  }
View Full Code Here

TOP

Related Classes of org.spout.api.geo.cuboid.Block

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.