Package org.bukkit.material

Examples of org.bukkit.material.Attachable


                }
                return;
            case BlockID.STONE_BUTTON:
            case BlockID.WOODEN_BUTTON:
            case BlockID.LEVER:
                Attachable button = (Attachable) block.getState().getData();
                if(button != null) {
                    BlockFace face = button.getAttachedFace();
                    if(face != null)
                        handleDirectWireInput(new WorldVector(w, x + face.getModX()*2, y, z + face.getModZ()*2), block, oldLevel, newLevel);
                }
        }

View Full Code Here


            if (event.getTo().getBlock().getType() == Material.STONE_PLATE || event.getTo().getBlock().getType() == Material.WOOD_PLATE || event.getTo().getBlock().getType() == Material.GOLD_PLATE || event.getTo().getBlock().getType() == Material.IRON_PLATE)
                event.getVehicle().setVelocity(event.getVehicle().getVelocity().normalize().multiply(4));

        if (ladder)
            if (event.getTo().getBlock().getType() == Material.LADDER) {
                Attachable ladder = (Attachable) event.getTo().getBlock().getState().getData();
                Vector velocity = new Vector(0,ladderVerticalVelocity,((Attachable) event.getTo().getBlock().getState().getData()).getAttachedFace().getModZ());
                if(velocity.length() > ((Minecart) event.getVehicle()).getMaxSpeed()) {
                    double length = velocity.length()/((Minecart) event.getVehicle()).getMaxSpeed();
                    velocity.setX(velocity.getX() / length);
                    velocity.setY(velocity.getY() / length);
                    velocity.setZ(velocity.getZ() / length);
                }
                velocity.add(new Vector(ladder.getAttachedFace().getModX(), 0, ladder.getAttachedFace().getModZ()));
                event.getVehicle().setVelocity(event.getVehicle().getVelocity().add(velocity));
            } else if (event.getTo().getBlock().getType() == Material.VINE) {
                BlockFace movementFace = BlockFace.SELF;
                Vine vine = (Vine) event.getTo().getBlock().getState().getData();
                for(BlockFace test : LocationUtil.getDirectFaces())
View Full Code Here

    }
    final MaterialData mdata = type.getNewData((byte) rawData);

    // Fix attachable face returning NULL sometimes
    if (mdata instanceof Attachable) {
      Attachable att = (Attachable) mdata;
      if (att.getAttachedFace() == null) {
        att.setFacingDirection(BlockFace.NORTH);
      }
    }
    return mdata;
  }
View Full Code Here

   *
   * @param attachable block
   * @return Attached face
   */
  public static BlockFace getAttachedFace(org.bukkit.block.Block attachable) {
    Attachable data = getData(attachable, Attachable.class);
    return data == null ? BlockFace.DOWN : data.getAttachedFace();
  }
View Full Code Here

    }

    // Towny regen
    if (TownySettings.getRegenDelay() > 0) {
      if (event.getClickedBlock().getState().getData() instanceof Attachable) {
        Attachable attachable = (Attachable) event.getClickedBlock().getState().getData();
        BlockLocation attachedToBlock = new BlockLocation(event.getClickedBlock().getRelative(attachable.getAttachedFace()).getLocation());
        // Prevent attached blocks from falling off when interacting
        if (plugin.getTownyUniverse().hasProtectionRegenTask(attachedToBlock)) {
          event.setCancelled(true);
        }
      }
View Full Code Here

TOP

Related Classes of org.bukkit.material.Attachable

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.