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

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

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

Block.setTypeId介绍

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

代码示例

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

@Override
public boolean setTypeId(final int type) {
  return base.setTypeId(type);
}

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

return;
case 3:
  block.setTypeId(37, false); // yellow flower
  return;
case 4:
  block.setTypeId(38, false); // red flower
  return;
case 5:
  block.setTypeId(40, false); // brown shroom
  return;
case 6:
  block.setTypeId(39, false); // red shroom
  return;

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

toSand.setTypeId(12, false);
break;

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

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

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

toSand.setTypeId(12, false);
break;

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

/**
 * Drop block to ground and wipe out existing
 *
 * @param block
 */
public static void dropBlockWipe(Block block) {
  if (dropBlock(block)) {
    block.setTypeId(0);
  }
}

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

/**
 * Sets current block type. Returns false if the block wasn't set.
 *
 * @param typeID
 */
public boolean setCurrentBlock(int typeID) {
  Block blk = getCurrentBlock();
  if (blk != null) {
    blk.setTypeId(typeID);
    return true;
  }
  return false;
}

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

/**
 * Sets previous block type id. Returns false if the block wasn't set.
 *
 * @param typeID
 */
public boolean setPreviousBlock(int typeID) {
  if (Material.getMaterial(typeID) != null) {
    Block blk = getPreviousBlock();
    if (blk != null) {
      blk.setTypeId(typeID);
      return true;
    }
  }
  return false;
}

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

/**
   * Destroys the block, spawning item drops naturally in the process
   * 
   * @param world the block is in
   * @param x - coordinate of the block
   * @param y - coordinate of the block
   * @param z - coordinate of the block
   * @param data of the block
   * @param yield (e.g. 20.0f)
   */
  @SuppressWarnings("deprecation")
  public final void destroy(World world, int x, int y, int z, int data, float yield) {
    dropNaturally(world, x, y, z, data, yield);
//        net.minecraft.server.World nativeWorld = CommonNMS.getNative(world);
//        net.minecraft.server.Block nativeBlock = nativeWorld.getType(x, y, z);
//        nativeWorld.setTypeId(x, y, z, nativeBlock, 0);
    //DAT NMS IS WUT SUX
    
    world.getBlockAt(x, y, z).setTypeId(0);
  }
}

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

/**
 * Sets the type of the block attached to the face at the sight. Returns false if the block wasn't set.
 *
 * @param typeID
 * @return boolean
 */
public boolean setFaceBlock(int typeID) {
  if (Material.getMaterial(typeID) != null) {
    if (getCurrentBlock() != null) {
      Block blk = loc.getWorld().getBlockAt(prevPos.getBlockX(), prevPos.getBlockY(), prevPos.getBlockZ());
      blk.setTypeId(typeID);
      return true;
    }
  }
  return false;
}

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

/**
 * Sets the type of the block at the sight. Returns false if the block wasn't set.
 *
 * @param typeID ID of type to set the block to
 * @return boolean
 */
public boolean setTargetBlock(int typeID) {
  this.reset();
  while (getNextBlock() != null && getCurrentBlock().getTypeId() == 0) ;
  if (getCurrentBlock() != null) {
    Block blk = loc.getWorld().getBlockAt(targetPos.getBlockX(), targetPos.getBlockY(), targetPos.getBlockZ());
    blk.setTypeId(typeID);
    return true;
  }
  return false;
}

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

bottom.setTypeId(0);
    block.setTypeId(0);
    top.setTypeId(0);
    block.setTypeId(0);
block.setTypeId(0);

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

block.setTypeId(unbreakable.getTypeId());
block.setData(unbreakable.getData());

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

if (!field.matchesBlockType()) {
  Block block = field.getBlock();
  block.setTypeId(field.getTypeId());
  block.setData((byte) field.getData());
  revertedCount++;

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

block.setTypeId(0, false);
block.getLocation().add(0, -1, 0).getBlock().setTypeId(field.getSettings().getGroundBlock().getTypeId(), false);

代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common

theBlock.setTypeId(this.breakedBlockTypes.get(block));
theBlock.setData(this.breakedBlockData.get(block));

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

theBlock.setTypeId(this.breakedBlockTypes.get(block));
theBlock.setData(this.breakedBlockData.get(block));

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

fertile.setTypeId(field.getSettings().getGroundBlock().getTypeId());

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

public void hide() {
  if (!field.hasFlag(FieldFlag.HIDABLE)) {
    return;
  }
  if (!isHidden()) {
    hidden = true;
    field.getFlagsModule().dirtyFlags("hide");
    BlockTypeEntry maskType = findMaskType();
    Block block = field.getBlock();
    block.setTypeId(maskType.getTypeId());
    block.setData(maskType.getData());
  }
  if (field.isParent()) {
    for (Field child : field.getChildren()) {
      if (!child.getHidingModule().isHidden()) {
        child.getHidingModule().hide();
      }
    }
  }
  if (field.isChild()) {
    if (!field.getParent().getHidingModule().isHidden()) {
      field.getParent().getHidingModule().hide();
    }
  }
}

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

/**
 * Unhides the field block turning it back to its normal block type
 */
public void unHide() {
  if (!field.hasFlag(FieldFlag.HIDABLE)) {
    return;
  }
  if (isHidden()) {
    hidden = false;
    field.getFlagsModule().dirtyFlags("unHide");
    Block block = field.getBlock();
    block.setTypeId(field.getTypeId());
    block.setData((byte) field.getData());
  }
  if (field.isParent()) {
    for (Field child : field.getChildren()) {
      if (child.getHidingModule().isHidden()) {
        child.getHidingModule().unHide();
      }
    }
  }
  if (field.isChild()) {
    if (field.getParent().getHidingModule().isHidden()) {
      field.getParent().getHidingModule().unHide();
    }
  }
}

相关文章