当前位置: 首页>>代码示例>>Java>>正文


Java DoorSound类代码示例

本文整理汇总了Java中cn.nukkit.level.sound.DoorSound的典型用法代码示例。如果您正苦于以下问题:Java DoorSound类的具体用法?Java DoorSound怎么用?Java DoorSound使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DoorSound类属于cn.nukkit.level.sound包,在下文中一共展示了DoorSound类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toggle

import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
public boolean toggle(Player player) {
    DoorToggleEvent event = new DoorToggleEvent(this, player);
    this.getLevel().getServer().getPluginManager().callEvent(event);

    if (event.isCancelled()) {
        return false;
    }


    int sideBit = this.meta & 0x07;
    boolean open = isOpen();

    this.meta = sideBit;

    if (open) {
        this.meta |= 0x08;
    }

    this.level.setBlock(this, this, false, false);
    this.level.addSound(new DoorSound(this));
    return true;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:23,代码来源:BlockTrapdoor.java

示例2: onActivate

import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
    if (!this.toggle(player)) {
        return false;
    }

    this.level.addSound(new DoorSound(this));
    return true;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:10,代码来源:BlockDoor.java

示例3: toggle

import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
public boolean toggle(Player player) {
    DoorToggleEvent event = new DoorToggleEvent(this, player);
    this.getLevel().getServer().getPluginManager().callEvent(event);

    if (event.isCancelled()) {
        return false;
    }

    if (isTop(this.meta)) { //Top
        Block down = this.down();
        if (down.getId() != this.getId()) {
            return false;
        }

        this.getLevel().setBlock(down, Block.get(this.getId(), down.getDamage() ^ 0x04), true);

        this.meta ^= 0x04;
        this.getLevel().setBlock(this, this, true);
    } else { //Down
        Block up = this.up();
        if (up.getId() != this.getId()) {
            return false;
        }

        this.meta ^= 0x04;
        this.getLevel().setBlock(this, this, true);
    }

    this.level.addSound(new DoorSound(this));
    return true;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:32,代码来源:BlockDoor.java

示例4: onActivate

import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
    if (player == null) {
        return false;
    }

    if (!this.toggle(player)) {
        return false;
    }

    this.getLevel().setBlock(this, this, true);
    this.getLevel().addSound(new DoorSound(this));

    return true;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:16,代码来源:BlockFenceGate.java

示例5: onActivate

import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
@Override
public boolean onActivate(Item item, Player player) {
    if (!this.toggle(player)) {
        return false;
    }

    this.getLevel().setBlock(this, this, true);
    this.level.addSound(new DoorSound(this));
    return true;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:11,代码来源:BlockTrapdoor.java

示例6: toggle

import cn.nukkit.level.sound.DoorSound; //导入依赖的package包/类
public boolean toggle(Player player) {
    DoorToggleEvent event = new DoorToggleEvent(this, player);
    this.getLevel().getServer().getPluginManager().callEvent(event);

    if (event.isCancelled()) {
        return false;
    }


    int sideBit = this.meta & 0x03;
    boolean top = isTop();
    boolean open = isOpen();

    this.meta = 0;
    this.meta |= sideBit;

    if (!open) {
        this.meta |= 0x04;
    }

    if (top) {
        this.meta |= 0x08;
    }

    this.level.setBlock(this, this, false, false);
    this.level.addSound(new DoorSound(this));
    return true;
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:29,代码来源:BlockTrapdoor.java


注:本文中的cn.nukkit.level.sound.DoorSound类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。