org.bukkit.block.Block.getData()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.bukkit.block.Block.getData()方法的一些代码示例,展示了Block.getData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getData()方法的具体详情如下:
包路径:org.bukkit.block.Block
类名称:Block
方法名:getData

Block.getData介绍

[英]Gets the metadata for this block
[中]获取此块的元数据

代码示例

代码示例来源:origin: GlowstoneMC/Glowstone

public boolean matches(Block block) {
  return block.getType() == getType() && block.getData() == getData();
}

代码示例来源:origin: GlowstoneMC/Glowstone

/**
 * Test whether this pattern matches a block.
 * @param location the base location
 * @param xz TODO: document this parameter
 * @param y TODO: document this parameter
 * @param alignment TODO: document this parameter
 * @return true if this pattern matches; false otherwise
 */
public Location[] matches(Location location, int xz, int y, Alignment alignment) {
  int i = 0;
  Location[] r = new Location[blocks.length];
  for (PatternItem block : blocks) {
    int dxz = block.xz - xz;
    int dy = block.y - y;
    Location relative = location.clone()
      .add(dxz * alignment.x, -dy, dxz * alignment.z);
    if (relative.getBlock().getType() != block.getType() || (
      (relative.getBlock().getData() != block.getData()) && block.getData() != -1)) {
      return null;
    }
    r[i++] = relative;
  }
  return r;
}

代码示例来源:origin: GlowstoneMC/Glowstone

Block block = blocks.get(i);
  setType(block.getRelative(pistonBlockFace), block.getTypeId(), block.getData());
setType(relativeBlock, block.getTypeId(), block.getData());
setType(block, 0, 0);

代码示例来源:origin: webbukkit/dynmap

private void checkBlock(Block b, String trigger) {
  BlockToCheck btt = new BlockToCheck();
  btt.loc = b.getLocation();
  btt.typeid = b.getTypeId();
  btt.data = b.getData();
  btt.trigger = trigger;
  blocks_to_check_accum.add(btt); /* Add to accumulator */
  btth.startIfNeeded();
}

代码示例来源:origin: NoCheatPlus/NoCheatPlus

/**
 * Get the (legacy) data value for the block.
 *
 * @param block
 *            the block
 * @return the data
 */
public static int getData(final Block block) {
  return block.getData();
}

代码示例来源:origin: webbukkit/dynmap

public void run() {
  BlockToCheck btt;
  while(blocks_to_check.isEmpty() != true) {
    btt = blocks_to_check.pop();
    Location loc = btt.loc;
    World w = loc.getWorld();
    if(!w.isChunkLoaded(loc.getBlockX()>>4, loc.getBlockZ()>>4))
      continue;
    int bt = w.getBlockTypeIdAt(loc);
    /* Avoid stationary and moving water churn */
    if(bt == 9) bt = 8;
    if(btt.typeid == 9) btt.typeid = 8;
    if((bt != btt.typeid) || (btt.data != w.getBlockAt(loc).getData())) {
      String wn = getWorld(w).getName();
      sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
      mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), btt.trigger);
    }
  }
  blocks_to_check = null;
  /* Kick next run, if one is needed */
  startIfNeeded();
}
public void startIfNeeded() {

代码示例来源:origin: NoCheatPlus/NoCheatPlus

@SuppressWarnings("deprecation")
@Override
public int fetchData(final int x, final int y, final int z) {
  // TODO: consider setting type id and data at once.
  return world.getBlockAt(x, y, z).getData();
}

代码示例来源:origin: marcelo-mason/PreciousStones

/**
 * @param block
 */
public BlockTypeEntry(Block block) {
  this.material = block.getType();
  this.data = block.getData();
}

代码示例来源:origin: elBukkit/MagicPlugin

@SuppressWarnings("deprecation")
public void modifyFast(Block block) {
  Material material = this.material == null ? block.getType() : this.material;
  int data = this.data == null ? block.getData() : this.data;
  if (material != block.getType() || data != block.getData()) {
    CompatibilityUtils.setBlockFast(block, material, data);
  }
}

代码示例来源:origin: ProjectKorra/ProjectKorra

public static boolean isLavabendable(final Player player, final Block block) {
  final byte full = 0x0;
  if (TempBlock.isTempBlock(block)) {
    final TempBlock tblock = TempBlock.instances.get(block);
    if (tblock == null || !LavaFlow.getTempLavaBlocks().values().contains(tblock)) {
      return false;
    }
  }
  if (isLava(block) && block.getData() == full) {
    return true;
  }
  return false;
}

代码示例来源:origin: marcelo-mason/PreciousStones

/**
 * @param block
 */
public BlockEntry(Block block) {
  this.typeId = block.getTypeId();
  this.data = block.getData();
  this.location = block.getLocation();
}

代码示例来源:origin: Co0sh/BetonQuest

@Override
@SuppressWarnings("deprecation")
public boolean check(String playerID) throws QuestRuntimeException {
  Block block = loc.getLocation(playerID).getBlock();
  if (data.isPresent()) {
    return (block.getType() == material && block.getData() == data.get());
  } else {
    return (block.getType() == material);
  }
}

代码示例来源:origin: ProjectKorra/ProjectKorra

public void revertGlowBlock() {
  if (this.block != null) {
    this.player.sendBlockChange(this.block.getLocation(), this.block.getTypeId(), this.block.getData());
  }
}

代码示例来源:origin: ProSavage/SavageFactions

@SuppressWarnings ("deprecation")
public static void clear(Player player) {
  Set<Location> locations = getPlayerLocations(player);
  if (locations == null) {
    return;
  }
  for (Location location : locations) {
    Block block = location.getWorld().getBlockAt(location);
    player.sendBlockChange(location, block.getType(), block.getData());
  }
  locations.clear();
}

代码示例来源:origin: CitizensDev/CitizensAPI

public void debugEnd() {
  for (Player player : Bukkit.getOnlinePlayers()) {
    for (PathEntry entry : path) {
      Block block = entry.vector.toLocation(player.getWorld()).getBlock();
      player.sendBlockChange(block.getLocation(), block.getType(), block.getData());
    }
  }
}

代码示例来源:origin: marcelo-mason/PreciousStones

/**
 * @param block
 */
public TranslocationBlock(Block block) {
  super(block.getX(), block.getY(), block.getZ(), block.getWorld().getName());
  this.type = new BlockTypeEntry(block.getTypeId(), block.getData());
}

代码示例来源:origin: marcelo-mason/PreciousStones

/**
 * @param block
 */
public Unbreakable(Block block) {
  super(block.getX(), block.getY(), block.getZ(), block.getWorld().getName());
  this.type = new BlockTypeEntry(block.getTypeId(), block.getData());
  this.dirty = true;
}

代码示例来源:origin: marcelo-mason/PreciousStones

/**
 * @param block
 */
public GriefBlock(Block block) {
  super(block.getX(), block.getY(), block.getZ(), block.getWorld().getName());
  this.type = new BlockTypeEntry(block.getTypeId(), block.getData());
}

代码示例来源:origin: marcelo-mason/PreciousStones

/**
 * @param block
 */
public TranslocationBlock(Field field, Block block) {
  super(block.getX(), block.getY(), block.getZ(), block.getWorld().getName());
  this.type = new BlockTypeEntry(block.getTypeId(), block.getData());
  setRelativeCoords(field);
}

代码示例来源:origin: AddstarMC/Minigames

@Override
@SuppressWarnings("deprecation")
public void hide() {
  temp.setWorld(world);
  temp.setX(position.getX());
  temp.setY(position.getY());
  temp.setZ(position.getZ());
  
  send(temp.getBlock().getType(), temp.getBlock().getData());
  super.hide();
}

相关文章