Package org.bukkit.material

Examples of org.bukkit.material.MaterialData


   *
   * @param block to set
   * @param facing direction to set to
   */
  public static void setFacing(org.bukkit.block.Block block, BlockFace facing) {
    MaterialData data = getData(block);
    if (data != null && data instanceof Directional) {
      ((Directional) data).setFacingDirection(facing);
      setData(block, data, true);
    }
  }
View Full Code Here


    public boolean getFlippedPosition()
    { return flip; }

    public boolean active()
    {
      MaterialData bdata = state.getData();

      if (bdata instanceof Redstone)
        return flip == ((Redstone) bdata).isPowered();
      if (bdata instanceof PressureSensor)
        return flip == ((PressureSensor) bdata).isPressed();
View Full Code Here

    this.clearEntities();

    // loop through all the redstone mechanisms required to start
    for (StartMechanism sm : startMechanisms)
    {
      MaterialData mdata = sm.getBlockState().getData();
      switch (sm.getBlockState().getType())
      {
        case LEVER:
          // flip the lever to the correct state
          ((Lever) mdata).setPowered(sm.getFlippedPosition());
View Full Code Here

        if (ent instanceof Boat)
          submitMatches(new BlockData(Material.WOOD), ent, goals);
        // endermen can carry blocks...possibly into other lane? interesting, investigate later
        if (ent instanceof Enderman)
        {
          MaterialData carried = ((Enderman) ent).getCarriedMaterial();
          submitMatches(new BlockData(carried.getItemType(), carried.getData()), ent, goals);
        }
        // break minecarts to get the blocks used to craft
        if (ent instanceof Minecart)
        {
          if (ent instanceof ExplosiveMinecart)
View Full Code Here

  }
 
  @Override
  protected boolean init(final @Nullable Class<? extends Enderman> c, final @Nullable Enderman e) {
    if (e != null) {
      final MaterialData m = e.getCarriedMaterial();
      if (m != null) {
        final ItemStack i = m.toItemStack(1);
        if (i == null)
          return false;
        hand = new ItemType[] {new ItemType(i)};
      }
    }
View Full Code Here

  @Override
  @Nullable
  public Color convert(final Object o) {
    if (o instanceof ItemStack || o instanceof Item) {
      final ItemStack is = o instanceof ItemStack ? (ItemStack) o : ((Item) o).getItemStack();
      final MaterialData d = is.getData();
      if (d instanceof Colorable)
        return Color.byWoolColor(((Colorable) d).getColor());
    } else if (o instanceof Colorable) { // Sheep
      return Color.byWoolColor(((Colorable) o).getColor());
    }
View Full Code Here

      return;
   
    for (final Object o : os) {
      if (o instanceof ItemStack || o instanceof Item) {
        final ItemStack is = o instanceof ItemStack ? (ItemStack) o : ((Item) o).getItemStack();
        final MaterialData d = is.getData();
        if (d instanceof Colorable)
          ((Colorable) d).setColor(c.getWoolColor());
        else
          continue;
       
View Full Code Here

  @SuppressWarnings({"deprecation", "null"})
  @Override
  @Nullable
  public Direction convert(final Object o) {
    if (o instanceof Block) {
      final MaterialData d = ((Block) o).getType().getNewData(((Block) o).getData());
      if (d instanceof Directional)
        return new Direction(((Directional) d).getFacing(), 1);
      return null;
    } else if (o instanceof LivingEntity) {
      return new Direction(Direction.getFacing(((LivingEntity) o).getLocation(), horizontal), 1);
View Full Code Here

    assert delta != null;
   
    final Block b = (Block) getExpr().getSingle(e);
    if (b == null)
      return;
    final MaterialData d = b.getType().getNewData(b.getData());
    if (!(d instanceof Directional))
      return;
    ((Directional) d).setFacingDirection(toBlockFace(((Direction) delta[0]).getDirection(b)));
    b.setData(d.getData());
  }
View Full Code Here

TOP

Related Classes of org.bukkit.material.MaterialData

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.