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

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

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

Block.isBlockIndirectlyPowered介绍

[英]Returns true if the block is being indirectly powered by Redstone.
[中]如果块由Redstone间接供电,则返回true。

代码示例

代码示例来源:origin: EngineHub/CommandHelper

@Override
public boolean isBlockIndirectlyPowered() {
  return b.isBlockIndirectlyPowered();
}

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

@Override
public boolean isBlockIndirectlyPowered() {
  return base.isBlockIndirectlyPowered();
}

代码示例来源:origin: catageek/ByteCart

/**
 * Check if a block is powered above a sign.
 *
 * @param event
 */
@EventHandler(ignoreCancelled = true)
@SuppressWarnings("ucd")
public void onBlockPhysics(BlockPhysicsEvent event) {
  if (event.getChangedType() != Material.SIGN || ! event.getBlock().isBlockIndirectlyPowered()) {
    return;
  }
  final Powerable myIC = this.MyPoweredICFactory.getIC(event.getBlock());
  if (myIC != null) {
    myIC.power();
  }
}
/*

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH)
public void onBlockRedstoneChange(BlockRedstoneEvent event) {
  Block blockTo = event.getBlock();
  World world = blockTo.getWorld();
  WorldConfiguration wcfg = getWorldConfig(world);
  if (wcfg.simulateSponge && wcfg.redstoneSponges) {
    int ox = blockTo.getX();
    int oy = blockTo.getY();
    int oz = blockTo.getZ();
    for (int cx = -1; cx <= 1; cx++) {
      for (int cy = -1; cy <= 1; cy++) {
        for (int cz = -1; cz <= 1; cz++) {
          Block sponge = world.getBlockAt(ox + cx, oy + cy, oz + cz);
          if (sponge.getType() == Material.SPONGE
              && sponge.isBlockIndirectlyPowered()) {
            SpongeUtil.clearSpongeWater(BukkitAdapter.adapt(world), ox + cx, oy + cy, oz + cz);
          } else if (sponge.getType() == Material.SPONGE
              && !sponge.isBlockIndirectlyPowered()) {
            SpongeUtil.addSpongeWater(BukkitAdapter.adapt(world), ox + cx, oy + cy, oz + cz);
          }
        }
      }
    }
    return;
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
  Block target = event.getBlock();
  World world = target.getWorld();
  WorldConfiguration wcfg = getWorldConfig(world);
  if (wcfg.simulateSponge && target.getType() == Material.SPONGE) {
    if (wcfg.redstoneSponges && target.isBlockIndirectlyPowered()) {
      return;
    }
    int ox = target.getX();
    int oy = target.getY();
    int oz = target.getZ();
    SpongeUtil.clearSpongeWater(BukkitAdapter.adapt(world), ox, oy, oz);
  }
}

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

if (block.isBlockIndirectlyPowered() || block.isBlockPowered()) {
  return true;

代码示例来源:origin: EngineHub/WorldGuard

Block sponge = world.getBlockAt(ox + cx, oy + cy, oz + cz);
if (sponge.getType() == Material.SPONGE
    && (!wcfg.redstoneSponges || !sponge.isBlockIndirectlyPowered())) {
  event.setCancelled(true);
  return;

相关文章