Package org.spout.api.material

Examples of org.spout.api.material.BlockMaterial


      if (length > 0) {
        BlockFace facing = this.getFacing(block);
        MoveReaction reac;

        //the previous material
        BlockMaterial prevMat = VanillaMaterials.PISTON_EXTENSION;
        short prevData = (short) (block.getBlockData() & 0x7);
        Block previous = block.translate(facing);
        if (this.isSticky()) {
          prevData |= 0x8;
        }

        //temporary values to use while swapping
        BlockMaterial nextMat;
        short nextData;

        Block next; // = block.translate(facing);
        for (int i = 0; i < length; i++) {
          //prepare the next material
          nextMat = previous.getMaterial();
          nextData = previous.getBlockData();
          next = previous.translate(facing);

          reac = this.getReaction(previous);
          if (reac == MoveReaction.BREAK) {
            //break block
            nextMat.getSubMaterial(nextData).destroy(previous, toCause(block));
            previous.setMaterial(prevMat, prevData);
            break;
          } else if (reac == MoveReaction.ALLOW) {
            //transfer data over and continue
            previous.setMaterial(prevMat, prevData);
View Full Code Here


    playBlockAction(block, (byte) 1, (byte) block.getDataField(0x7));
    return true;
  }

  private MoveReaction getReaction(Block block) {
    BlockMaterial mat = block.getMaterial();
    if (mat.equals(VanillaMaterials.AIR)) {
      return MoveReaction.BREAK;
    }
    if (!(mat instanceof VanillaBlockMaterial)) {
      return MoveReaction.DENY;
    }
View Full Code Here

TOP

Related Classes of org.spout.api.material.BlockMaterial

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.