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

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

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

Block.setTypeIdAndData介绍

[英]Sets the type-id of this block
[中]设置此块的类型id

代码示例

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

@Override
public boolean update(boolean force, boolean applyPhysics) {
  Block block = getBlock();
  return (block.getTypeId() == typeId || force)
      && block.setTypeIdAndData(typeId, getRawData(), applyPhysics);
}

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

private void placeFallingBlock() {
  location.getBlock().setTypeIdAndData(material.getId(), getBlockData(), true);
  if (getBlockEntityCompoundTag() != null) {
    if (location.getBlock() instanceof GlowBlock) {
      GlowBlock block = (GlowBlock) location.getBlock();
      BlockEntity blockEntity = block.getBlockEntity();
      if (blockEntity != null) {
        blockEntity.loadNbt(getBlockEntityCompoundTag());
      }
    }
  }
  if (material == Material.ANVIL) {
    ThreadLocalRandom random = ThreadLocalRandom.current();
    world.playSound(location, Sound.BLOCK_ANVIL_FALL, 4, (1.0F
        + (random.nextFloat() - random.nextFloat()) * 0.2F) * 0.7F);
  }
}

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

relativeBlock.setTypeIdAndData(0, (byte) 0, true);
return;

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
  return base.setTypeIdAndData(type, data, applyPhysics);
}

代码示例来源:origin: bergerkiller/BKCommonLib

/**
 * Sets the Block type and data at once
 * 
 * @param block to set the type and data of
 * @param type to set to
 * @param data to set to
 * @param update - whether to perform physics afterwards
 */
@SuppressWarnings("deprecation")
public static void setTypeAndRawData(org.bukkit.block.Block block, Material type, int data, boolean update) {
  block.setTypeIdAndData(type.getId(), (byte) data, update);
}

代码示例来源:origin: bergerkiller/BKCommonLib

/**
 * Sets the Block type and data at once
 * 
 * @param block to set the type and data of
 * @param type to set to
 * @param data to set to
 * @param update - whether to perform physics afterwards
 */
@SuppressWarnings("deprecation")
public static void setTypeAndData(org.bukkit.block.Block block, Material type, MaterialData data, boolean update) {
  block.setTypeIdAndData(type.getId(), data.getData(), update);
}

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

block.setTypeIdAndData(31, (byte) 0, false); // tall grass
  return;
case 1:
  block.setTypeIdAndData(31, (byte) 1, false); // tall grass
  return;
case 2:
  block.setTypeIdAndData(31, (byte) 2, false); // tall grass
  return;
case 3:

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

/**
 * Wipes a single translocation block from the world
 *
 * @param field
 * @param tb
 */
public boolean wipeTranslocationBlock(Field field, TranslocationBlock tb) {
  Block block = tb.getBlock();
  tb = processBlock(tb);
  if (tb != null) {
    // wipe the block
    addBlock(field, block, true);
    block.setTypeIdAndData(0, (byte) 0, true);
    return true;
  }
  return false;
}

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

/**
 * Clears a single translocation block from the world
 *
 * @param tb
 */
public void zeroOutBlock(TranslocationBlock tb) {
  final Block block = tb.getBlock().getWorld().getBlockAt(tb.getX(), tb.getY(), tb.getZ());
  block.setTypeIdAndData(0, (byte) 0, true);
}

代码示例来源:origin: Dytanic/CloudNet

@Override
  public void run()
  {
    if (id != -1 && id != 0 && subId != -1)
    {
      org.bukkit.material.Sign sign = (org.bukkit.material.Sign) location.getBlock().getState().getData();
      location.getBlock().getRelative(sign.getAttachedFace()).setTypeIdAndData(id, (byte) subId, true);
    }
  }
});

代码示例来源:origin: BigScary/GriefPrevention

currentBlock.setTypeIdAndData(blockUpdate.typeId, blockUpdate.data, false);

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

block.setTypeIdAndData(0, (byte) 0, true);

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

block.setTypeIdAndData(gb.getTypeId(), gb.getData(), true);
return;
block.setTypeIdAndData(gb.getTypeId(), gb.getData(), true);

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

block.setTypeIdAndData(0, (byte) 0, true);
        bottom.setTypeIdAndData(0, (byte) 0, true);
        top.setTypeIdAndData(0, (byte) 0, true);
} else {
  if (!Helper.isDoor(block)) {
    block.setTypeIdAndData(0, (byte) 0, true);

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

block.setTypeIdAndData(0, (byte) 0, false);
continue;
block.setTypeIdAndData(0, (byte) 0, false);
continue;
for (BlockEntry db : revert) {
  Block block = db.getLocation().getBlock();
  block.setTypeIdAndData(db.getTypeId(), db.getData(), true);

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

block.setTypeIdAndData(tb.getTypeId(), tb.getData(), true);
return true;
block.setTypeIdAndData(tb.getTypeId(), tb.getData(), true);

相关文章