• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LevelSoundEventPacket类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onOpen

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public void onOpen(Player who) {
    super.onOpen(who);

    if (this.getViewers().size() == 1) {
        BlockEventPacket pk = new BlockEventPacket();
        pk.x = (int) this.getHolder().getX();
        pk.y = (int) this.getHolder().getY();
        pk.z = (int) this.getHolder().getZ();
        pk.case1 = 1;
        pk.case2 = 2;

        Level level = this.getHolder().getLevel();
        if (level != null) {
            level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_CHEST_OPEN, 1, -1, this.getHolder().add(0.5, 0.5, 0.5));
            level.addChunkPacket((int) this.getHolder().getX() >> 4, (int) this.getHolder().getZ() >> 4, pk);
        }
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:20,代码来源:ChestInventory.java


示例2: onClose

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public void onClose(Player who) {
    if (this.getViewers().size() == 1) {
        BlockEventPacket pk = new BlockEventPacket();
        pk.x = (int) this.getHolder().getX();
        pk.y = (int) this.getHolder().getY();
        pk.z = (int) this.getHolder().getZ();
        pk.case1 = 1;
        pk.case2 = 0;

        Level level = this.getHolder().getLevel();
        if (level != null) {
            level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_CHEST_CLOSED, 1, -1, this.getHolder().add(0.5, 0.5, 0.5));
            level.addChunkPacket((int) this.getHolder().getX() >> 4, (int) this.getHolder().getZ() >> 4, pk);
        }
    }

    super.onClose(who);
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:20,代码来源:ChestInventory.java


示例3: encode

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public DataPacket[] encode() {
    LevelSoundEventPacket pk = new LevelSoundEventPacket();
    pk.sound = this.type;
    pk.x = (float) this.x;
    pk.y = (float) this.y;
    pk.z = (float) this.z;
    pk.extraData = this.extraData;
    pk.pitch = this.pitch;

    return new DataPacket[]{pk};
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:13,代码来源:LevelSoundEventSound.java


示例4: addSound

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
private void addSound(Vector3 pos, boolean canConnect, boolean nextPowered, boolean attached, boolean powered) {
    if (nextPowered && !powered) {
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_POWER_ON, 1, -1, pos);
        this.level.getServer().getPluginManager().callEvent(new BlockRedstoneEvent(this, 0, 15));
    } else if (!nextPowered && powered) {
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_POWER_OFF, 1, -1, pos);
        this.level.getServer().getPluginManager().callEvent(new BlockRedstoneEvent(this, 15, 0));
    } else if (canConnect && !attached) {
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_ATTACH, 1, -1, pos);
    } else if (!canConnect && attached) {
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_DETACH, 1, -1, pos);
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:14,代码来源:BlockTripWireHook.java


示例5: onOpen

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public void onOpen(Player who) {
    super.onOpen(who);
    this.left.viewers.add(who);
    this.right.viewers.add(who);

    if (this.getViewers().size() == 1) {
        BlockEventPacket pk1 = new BlockEventPacket();
        pk1.x = (int) this.left.getHolder().getX();
        pk1.y = (int) this.left.getHolder().getY();
        pk1.z = (int) this.left.getHolder().getZ();
        pk1.case1 = 1;
        pk1.case2 = 2;
        Level level = this.left.getHolder().getLevel();
        if (level != null) {
            level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_CHEST_OPEN, 1, -1, this.left.getHolder().add(0.5, 0.5, 0.5));
            level.addChunkPacket((int) this.left.getHolder().getX() >> 4, (int) this.left.getHolder().getZ() >> 4, pk1);
        }

        BlockEventPacket pk2 = new BlockEventPacket();
        pk2.x = (int) this.right.getHolder().getX();
        pk2.y = (int) this.right.getHolder().getY();
        pk2.z = (int) this.right.getHolder().getZ();
        pk2.case1 = 1;
        pk2.case2 = 2;

        level = this.right.getHolder().getLevel();
        if (level != null) {
            level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_CHEST_OPEN, 1, -1, this.right.getHolder().add(0.5, 0.5, 0.5));
            level.addChunkPacket((int) this.right.getHolder().getX() >> 4, (int) this.right.getHolder().getZ() >> 4, pk2);
        }
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:34,代码来源:DoubleChestInventory.java


示例6: onClose

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public void onClose(Player who) {
    if (this.getViewers().size() == 1) {
        BlockEventPacket pk1 = new BlockEventPacket();
        pk1.x = (int) this.right.getHolder().getX();
        pk1.y = (int) this.right.getHolder().getY();
        pk1.z = (int) this.right.getHolder().getZ();
        pk1.case1 = 1;
        pk1.case2 = 0;

        Level level = this.right.getHolder().getLevel();
        if (level != null) {
            level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_CHEST_CLOSED, 1, -1, this.right.getHolder().add(0.5, 0.5, 0.5));
            level.addChunkPacket((int) this.right.getHolder().getX() >> 4, (int) this.right.getHolder().getZ() >> 4, pk1);
        }

        BlockEventPacket pk2 = new BlockEventPacket();
        pk2.x = (int) this.left.getHolder().getX();
        pk2.y = (int) this.left.getHolder().getY();
        pk2.z = (int) this.left.getHolder().getZ();
        pk2.case1 = 1;
        pk2.case2 = 0;

        level = this.left.getHolder().getLevel();
        if (level != null) {
            level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_CHEST_CLOSED, 1, -1, this.left.getHolder().add(0.5, 0.5, 0.5));
            level.addChunkPacket((int) this.left.getHolder().getX() >> 4, (int) this.left.getHolder().getZ() >> 4, pk2);
        }
    }

    this.left.viewers.remove(who);
    this.right.viewers.remove(who);
    super.onClose(who);
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:35,代码来源:DoubleChestInventory.java


示例7: onOpen

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public void onOpen(Player who) {
    if (who != this.getHolder()) {
        return;
    }
    super.onOpen(who);
    ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket();
    containerOpenPacket.windowId = who.getWindowId(this);
    containerOpenPacket.type = this.getType().getNetworkType();
    BlockEnderChest chest = who.getViewingEnderChest();
    if (chest != null) {
        containerOpenPacket.x = (int) chest.getX();
        containerOpenPacket.y = (int) chest.getY();
        containerOpenPacket.z = (int) chest.getZ();
    } else {
        containerOpenPacket.x = containerOpenPacket.y = containerOpenPacket.z = 0;
    }

    who.dataPacket(containerOpenPacket);

    this.sendContents(who);

    if (chest != null && chest.getViewers().size() == 1) {
        BlockEventPacket blockEventPacket = new BlockEventPacket();
        blockEventPacket.x = (int) chest.getX();
        blockEventPacket.y = (int) chest.getY();
        blockEventPacket.z = (int) chest.getZ();
        blockEventPacket.case1 = 1;
        blockEventPacket.case2 = 2;

        Level level = this.getHolder().getLevel();
        if (level != null) {
            level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_CHEST_OPEN, 1, -1, this.getHolder().add(0.5, 0.5, 0.5));
            level.addChunkPacket((int) this.getHolder().getX() >> 4, (int) this.getHolder().getZ() >> 4, blockEventPacket);
        }
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:38,代码来源:PlayerEnderChestInventory.java


示例8: onClose

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public void onClose(Player who) {
    ContainerClosePacket containerClosePacket = new ContainerClosePacket();
    containerClosePacket.windowId = who.getWindowId(this);
    who.dataPacket(containerClosePacket);
    super.onClose(who);

    BlockEnderChest chest = who.getViewingEnderChest();
    if (chest != null && chest.getViewers().size() == 1) {
        BlockEventPacket blockEventPacket = new BlockEventPacket();
        blockEventPacket.x = (int) chest.getX();
        blockEventPacket.y = (int) chest.getY();
        blockEventPacket.z = (int) chest.getZ();
        blockEventPacket.case1 = 1;
        blockEventPacket.case2 = 0;

        Level level = this.getHolder().getLevel();
        if (level != null) {
            level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_CHEST_CLOSED, 1, -1, this.getHolder().add(0.5, 0.5, 0.5));
            level.addChunkPacket((int) this.getHolder().getX() >> 4, (int) this.getHolder().getZ() >> 4, blockEventPacket);
        }

        who.setViewingEnderChest(null);
    }

    super.onClose(who);
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:28,代码来源:PlayerEnderChestInventory.java


示例9: play

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
public void play() {
    if (this.recordItem instanceof ItemRecord) {
        LevelSoundEventPacket pk = new LevelSoundEventPacket();
        pk.sound = ((ItemRecord) this.recordItem).getSoundId();
        pk.pitch = 1;
        pk.extraData = -1;
        pk.x = (float) this.x;
        pk.y = (float) this.y;
        pk.z = (float) this.z;

        Server.broadcastPacket(this.level.getPlayers().values(), pk);
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:14,代码来源:BlockEntityJukebox.java


示例10: addLevelSoundEvent

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
public void addLevelSoundEvent(int type, int pitch, int data, Vector3 pos, boolean isGlobal) {
    LevelSoundEventPacket pk = new LevelSoundEventPacket();
    pk.sound = type;
    pk.pitch = pitch;
    pk.extraData = data;
    pk.x = (float) pos.x;
    pk.y = (float) pos.y;
    pk.z = (float) pos.z;
    pk.isGlobal = isGlobal;

    this.addChunkPacket(pos.getFloorX() >> 4, pos.getFloorZ() >> 4, pk);
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:13,代码来源:Level.java


示例11: encode

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public DataPacket[] encode() {
    LevelSoundEventPacket pk = new LevelSoundEventPacket();
    pk.type = this.type;
    pk.x = (float) this.x;
    pk.y = (float) this.y;
    pk.z = (float) this.z;
    pk.extraData = this.extraData;
    pk.pitch = this.pitch;

    return new DataPacket[]{pk};
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:13,代码来源:LevelSoundEventSound.java


示例12: addSound

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
private void addSound(Vector3 pos, boolean canConnect, boolean nextPowered, boolean attached, boolean powered) {
    if (nextPowered && !powered) {
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_POWER_ON, 1, -1, pos, false, false);
        this.level.getServer().getPluginManager().callEvent(new BlockRedstoneEvent(this, 0, 15));
    } else if (!nextPowered && powered) {
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_POWER_OFF, 1, -1, pos, false, false);
        this.level.getServer().getPluginManager().callEvent(new BlockRedstoneEvent(this, 15, 0));
    } else if (canConnect && !attached) {
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_ATTACH, 1, -1, pos, false, false);
    } else if (!canConnect && attached) {
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_DETACH, 1, -1, pos, false, false);
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:14,代码来源:BlockTripWireHook.java


示例13: onUpdate

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public boolean onUpdate(int currentTick) {
    if (this.closed) {
        return false;
    }

    int tickDiff = currentTick - this.lastUpdate;

    if (tickDiff <= 0 && !this.justCreated) {
        return true;
    }

    this.lastUpdate = currentTick;

    this.entityBaseTick(tickDiff);

    if (this.state == 2) {
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_THUNDER, 93, -1, this);
        this.level.addLevelSoundEvent(LevelSoundEventPacket.SOUND_EXPLODE, 93, -1, this);
    }

    this.state--;

    if (this.state < 0) {
        if (this.liveTime == 0) {
            this.close();
            return false;
        } else if (this.state < -this.level.rand.nextInt(10)) {
            this.liveTime--;
            this.state = 1;

            if (this.isEffect && this.level.gameRules.getBoolean("doFireTick")) {
                Block block = this.getLevelBlock();

                if (block.getId() == Block.AIR || block.getId() == Block.TALL_GRASS) {
                    BlockIgniteEvent e = new BlockIgniteEvent(block, null, this, BlockIgniteEvent.BlockIgniteCause.LIGHTNING);
                    getServer().getPluginManager().callEvent(e);

                    if (!e.isCancelled()) {
                        Block fire = new BlockFire();
                        this.level.setBlock(block, fire);
                        this.getLevel().scheduleUpdate(fire, fire.tickRate());
                    }
                }
            }
        }
    }

    if (this.state >= 0) {
        if (this.isEffect) {
            AxisAlignedBB bb = getBoundingBox().grow(3, 3, 3);
            bb.maxX += 6;

            for (Entity entity : this.level.getCollidingEntities(bb, this)) {
                entity.onStruckByLightning(this);
            }
        }
    }

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


示例14: getSoundId

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public int getSoundId() {
    return LevelSoundEventPacket.SOUND_RECORD_11;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:5,代码来源:ItemRecord11.java


示例15: getSoundId

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public int getSoundId() {
    return LevelSoundEventPacket.SOUND_RECORD_STAL;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:5,代码来源:ItemRecordStal.java


示例16: getSoundId

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public int getSoundId() {
    return LevelSoundEventPacket.SOUND_RECORD_CAT;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:5,代码来源:ItemRecordCat.java


示例17: getSoundId

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public int getSoundId() {
    return LevelSoundEventPacket.SOUND_RECORD_WARD;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:5,代码来源:ItemRecordWard.java


示例18: getSoundId

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public int getSoundId() {
    return LevelSoundEventPacket.SOUND_RECORD_CHIRP;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:5,代码来源:ItemRecordChirp.java


示例19: getSoundId

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public int getSoundId() {
    return LevelSoundEventPacket.SOUND_RECORD_BLOCKS;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:5,代码来源:ItemRecordBlocks.java


示例20: getSoundId

import cn.nukkit.network.protocol.LevelSoundEventPacket; //导入依赖的package包/类
@Override
public int getSoundId() {
    return LevelSoundEventPacket.SOUND_RECORD_13;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:5,代码来源:ItemRecord13.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MeasureComputer类代码示例发布时间:2022-05-22
下一篇:
Java NaryExpression类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap