本文整理汇总了Java中cn.nukkit.redstone.Redstone.deactive方法的典型用法代码示例。如果您正苦于以下问题:Java Redstone.deactive方法的具体用法?Java Redstone.deactive怎么用?Java Redstone.deactive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.redstone.Redstone
的用法示例。
在下文中一共展示了Redstone.deactive方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAroundRedstone
import cn.nukkit.redstone.Redstone; //导入方法依赖的package包/类
public void updateAroundRedstone(Block block) {
BlockUpdateEvent ev = new BlockUpdateEvent(block);
this.server.getPluginManager().callEvent(ev);
if (!ev.isCancelled()) {
for (Entity entity : this.getNearbyEntities(
new AxisAlignedBB(block.x - 1, block.y - 1, block.z - 1, block.x + 1, block.y + 1, block.z + 1))) {
entity.scheduleUpdate();
}
ev.getBlock().onUpdate(BLOCK_UPDATE_NORMAL);
RedstoneUpdateEvent rsEv = new RedstoneUpdateEvent(ev.getBlock());
this.server.getPluginManager().callEvent(rsEv);
if (!rsEv.isCancelled()) {
Block redstoneWire = rsEv.getBlock().getSide(Vector3.SIDE_DOWN);
if (redstoneWire instanceof BlockRedstoneWire) {
if (rsEv.getBlock() instanceof BlockSolid) {
int level = redstoneWire.getPowerLevel();
redstoneWire.setPowerLevel(redstoneWire.getNeighborPowerLevel() - 1);
redstoneWire.getLevel().setBlock(redstoneWire, redstoneWire, true, true);
Redstone.deactive(redstoneWire, level);
} else {
redstoneWire.setPowerLevel(redstoneWire.getNeighborPowerLevel() - 1);
redstoneWire.getLevel().setBlock(redstoneWire, redstoneWire, true, true);
Redstone.active(redstoneWire);
}
}
}
}
}
示例2: onUpdate
import cn.nukkit.redstone.Redstone; //导入方法依赖的package包/类
@Override
public int onUpdate(int type) {
if ((type == Level.BLOCK_UPDATE_NORMAL || type == Level.BLOCK_UPDATE_SCHEDULED) && this.getNeighborPowerLevel() > 0) {
int level = this.getPowerLevel();
Redstone.deactive(this, level);
this.getLevel().setBlock(this, new BlockLitRedstoneLamp());
}
return 0;
}
示例3: onBreak
import cn.nukkit.redstone.Redstone; //导入方法依赖的package包/类
@Override
public boolean onBreak(Item item) {
int level = this.getPowerLevel();
this.getLevel().setBlock(this, new BlockAir(), true, false);
Redstone.deactive(this, level);
return true;
}
示例4: onBreak
import cn.nukkit.redstone.Redstone; //导入方法依赖的package包/类
@Override
public boolean onBreak(Item item) {
int level = this.getPowerLevel();
this.getLevel().setBlock(this, new BlockAir(), true, true);
Redstone.deactive(this, level);
return true;
}
示例5: onActivate
import cn.nukkit.redstone.Redstone; //导入方法依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
this.meta ^= 0x08;
this.getLevel().setBlock(this, this, true, true);
this.getLevel().addSound(new LeverSound(this, this.isPowerOn()));
if (this.isPowerOn()) {
this.setPowerSource(true);
Redstone.active(this);
} else {
this.setPowerSource(false);
Redstone.deactive(this, this.getPowerLevel());
}
return true;
}
示例6: onUpdate
import cn.nukkit.redstone.Redstone; //导入方法依赖的package包/类
@Override
public int onUpdate(int type) {
if ((type == Level.BLOCK_UPDATE_NORMAL || type == Level.BLOCK_UPDATE_SCHEDULED) && this.getNeighborPowerLevel() > 0) {
int level = this.getPowerLevel();
Redstone.deactive(this, level);
this.getLevel().setBlock(this, new BlockRedstoneLampLit());
}
return 0;
}
示例7: onBreak
import cn.nukkit.redstone.Redstone; //导入方法依赖的package包/类
@Override
public boolean onBreak(Item item) {
this.getLevel().setBlock(this, new BlockAir(), true, true);
Redstone.deactive(this, this.getPowerLevel());
return true;
}