Package org.bukkit.block

Examples of org.bukkit.block.BlockState


        setHeight(random.nextInt(3) + 4);
    }

    @Override
    public boolean canPlaceOn() {
        final BlockState state = delegate.getBlockState(loc.getBlock().getRelative(BlockFace.DOWN).getLocation());
        return state.getType() == Material.GRASS || state.getType() == Material.DIRT || state.getType() == Material.MYCEL;
    }
View Full Code Here


        }

        Location location = new Location(player.getWorld(), message.getX(), message.getY(), message.getZ());
        if (player.checkSignLocation(location)) {
            // update the sign if it's actually still there
            BlockState state = location.getBlock().getState();
            if (state instanceof Sign) {
                Sign sign = (Sign) state;
                for (int i = 0; i < lines.length; ++i) {
                    sign.setLine(i, lines[i]);
                }
View Full Code Here

      blockStateBuff.clear();
    }
  }

  private static void offerTile(World world, int x, int y, int z) {
    BlockState state = Conversion.toBlockState.convert(TileEntityRef.getFromWorld(world, x, y, z));
    if (state != null) {
      blockStateBuff.add(state);
    }
  }
View Full Code Here

    public BlockState newInstance(Object tileEntity) {
      return newInstance(TileEntityRef.getBlock(tileEntity), tileEntity);
    }

    public BlockState newInstance(Block block, Object tileEntity) {
      final BlockState state = (BlockState) STATE.newInstanceNull();
      final int typeId = MaterialUtil.getTypeId(block);
      tileField.set(state, tileEntity);
      world.set(state, block.getWorld());
      secondWorld.set(state, block.getWorld());
      chunk.set(state, block.getChunk());
View Full Code Here

    String holderDescription;
    Location location;
    if (holder instanceof BlockState)
    {
      BlockState h = (BlockState) holder;
      location = h.getLocation();
      holderDescription = h.getType().toString();
    }
    else if (holder instanceof DoubleChest)
    {
      DoubleChest c = (DoubleChest) holder;
      location = c.getLocation();
View Full Code Here

  }

  public void checkContainerBreak(Block block, Set<BlockData> goals, AutoRefMatch match,
      String causeStr, String actionStr)
  {
    BlockState state = block.getState();
    if (state instanceof InventoryHolder)
    {
      GoalsInventorySnapshot snap = new GoalsInventorySnapshot(((InventoryHolder) state).getInventory(), goals);
      if (snap.isEmpty()) return;
      Location loc = block.getLocation();
View Full Code Here

          face = BlockFace.DOWN;
        }

        // Apply a force-update to the attached block
        Block atch = sm.getBlock().getRelative(face);
        BlockState stat = atch.getState(); // Store the state, to reapply it
        // Trying to update with no changes does nothing, so we first set it to air, with no physics (so that the mechanism doesn't come off).
        atch.setTypeId(0, false);
        stat.update(true);
      }
    }

    // set teams as started
    for (AutoRefTeam team : getTeams())
View Full Code Here

    }
  }
 
  @Override
  public boolean setTypeId(final int type) {
    final BlockState newState = this.newState;
    if (newState != null) {
      newState.setTypeId(type);
      return newState.getTypeId() != getTypeId();
    } else {
      Bukkit.getScheduler().scheduleSyncDelayedTask(Skript.getInstance(), new Runnable() {
        @Override
        public void run() {
          b.setTypeId(type);
View Full Code Here

    }
  }
 
  @Override
  public boolean setTypeId(final int type, final boolean applyPhysics) {
    final BlockState newState = this.newState;
    if (newState != null) {
      newState.setTypeId(type);
      return newState.getTypeId() != getTypeId();
    } else {
      Bukkit.getScheduler().scheduleSyncDelayedTask(Skript.getInstance(), new Runnable() {
        @Override
        public void run() {
          b.setTypeId(type, applyPhysics);
View Full Code Here

    }
  }
 
  @Override
  public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
    final BlockState newState = this.newState;
    if (newState != null) {
      newState.setTypeId(type);
      newState.setRawData(data);
      return newState.getTypeId() != getTypeId() || newState.getRawData() != getData();
    } else {
      Bukkit.getScheduler().scheduleSyncDelayedTask(Skript.getInstance(), new Runnable() {
        @Override
        public void run() {
          b.setTypeIdAndData(type, data, applyPhysics);
View Full Code Here

TOP

Related Classes of org.bukkit.block.BlockState

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.