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

Java SPacketSoundEffect类代码示例

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

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



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

示例1: isCorrectSplashPacket

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
private boolean isCorrectSplashPacket(SPacketSoundEffect packet) {
    EntityPlayerSP me = getLocalPlayer();
    return packet.getSound().equals(SoundEvents.ENTITY_BOBBER_SPLASH) &&
            (
                    me != null &&
                    me.fishEntity != null &&
                            (
                                    max_sound_distance.get() == 0 || // disables this check
                                    (me.fishEntity.getPositionVector().distanceTo(new Vec3d(packet.getX(), packet.getY(), packet.getZ())) <= max_sound_distance.get())
                            )
            );
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:13,代码来源:AutoFishMod.java


示例2: onPacketIncoming

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
@SubscribeEvent
public void onPacketIncoming(PacketEvent.Incoming.Pre event) {
    if(event.getPacket() instanceof SPacketSoundEffect) {
        SPacketSoundEffect packet = (SPacketSoundEffect)event.getPacket();
        if(isCorrectSplashPacket(packet)) {
            rightClick();
        }
    }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:10,代码来源:AutoFishMod.java


示例3: onReceivedPacket

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
@Override
public void onReceivedPacket(PacketInputEvent event)
{
	// check packet type
	if(!(event.getPacket() instanceof SPacketSoundEffect))
		return;
	
	// check sound type
	if(!WSoundEvents.isBobberSplash((SPacketSoundEffect)event.getPacket()))
		return;
	
	// catch fish
	rightClick();
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:15,代码来源:AutoFishMod.java


示例4: playSound

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public static void playSound(World worldObj, SoundEvent soundName, double x, double y, double z, double volume, double pitch) {
    SPacketSoundEffect soundEffect = new SPacketSoundEffect(soundName, SoundCategory.BLOCKS, x, y, z, (float) volume, (float) pitch);

    for (int j = 0; j < worldObj.playerEntities.size(); ++j) {
        EntityPlayerMP entityplayermp = (EntityPlayerMP)worldObj.playerEntities.get(j);
        double d7 = x - entityplayermp.posX;
        double d8 = y - entityplayermp.posY;
        double d9 = z - entityplayermp.posZ;
        double d10 = d7 * d7 + d8 * d8 + d9 * d9;

        if (d10 <= 256.0D) {
            entityplayermp.connection.sendPacket(soundEffect);
        }
    }
}
 
开发者ID:romelo333,项目名称:rflux,代码行数:16,代码来源:Tools.java


示例5: isBobberSplash

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public static boolean isBobberSplash(SPacketSoundEffect soundEffect)
{
	return SoundEvents.ENTITY_BOBBER_SPLASH.equals(soundEffect.getSound());
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12-OF,代码行数:5,代码来源:WSoundEvents.java


示例6: displayGUIChest

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
/**
 * Displays the GUI for interacting with a chest inventory.
 */
public void displayGUIChest(IInventory chestInventory)
{
    if (chestInventory instanceof ILootContainer && ((ILootContainer)chestInventory).getLootTable() != null && this.isSpectator())
    {
        this.addChatComponentMessage((new TextComponentTranslation("container.spectatorCantOpen", new Object[0])).setStyle((new Style()).setColor(TextFormatting.RED)), true);
    }
    else
    {
        if (this.openContainer != this.inventoryContainer)
        {
            this.closeScreen();
        }

        if (chestInventory instanceof ILockableContainer)
        {
            ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory;

            if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator())
            {
                this.connection.sendPacket(new SPacketChat(new TextComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2));
                this.connection.sendPacket(new SPacketSoundEffect(SoundEvents.BLOCK_CHEST_LOCKED, SoundCategory.BLOCKS, this.posX, this.posY, this.posZ, 1.0F, 1.0F));
                return;
            }
        }

        this.getNextWindowId();

        if (chestInventory instanceof IInteractionObject)
        {
            this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
            this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this);
        }
        else
        {
            this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
            this.openContainer = new ContainerChest(this.inventory, chestInventory, this);
        }

        this.openContainer.windowId = this.currentWindowId;
        this.openContainer.addListener(this);
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:46,代码来源:EntityPlayerMP.java


示例7: handleSoundEffect

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public void handleSoundEffect(SPacketSoundEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.world.playSound(this.gameController.player, packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getSound(), packetIn.getCategory(), packetIn.getVolume(), packetIn.getPitch());
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:6,代码来源:NetHandlerPlayClient.java


示例8: playSoundToAllNearExcept

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public void playSoundToAllNearExcept(@Nullable EntityPlayer player, SoundEvent soundIn, SoundCategory category, double x, double y, double z, float volume, float pitch)
{
    this.mcServer.getPlayerList().sendToAllNearExcept(player, x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.theWorldServer.provider.getDimensionType().getId(), new SPacketSoundEffect(soundIn, category, x, y, z, volume, pitch));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:ServerWorldEventHandler.java


示例9: playSoundToAllNearExcept

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public void playSoundToAllNearExcept(@Nullable EntityPlayer player, SoundEvent soundIn, SoundCategory category, double x, double y, double z, float volume, float pitch)
{
    this.mcServer.getPlayerList().sendToAllNearExcept(player, x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.theWorldServer.provider.getDimension(), new SPacketSoundEffect(soundIn, category, x, y, z, volume, pitch));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:ServerWorldEventHandler.java


示例10: displayGUIChest

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
/**
 * Displays the GUI for interacting with a chest inventory.
 */
public void displayGUIChest(IInventory chestInventory)
{
    if (chestInventory instanceof ILootContainer && ((ILootContainer)chestInventory).getLootTable() != null && this.isSpectator())
    {
        this.addChatMessage((new TextComponentTranslation("container.spectatorCantOpen", new Object[0])).setStyle((new Style()).setColor(TextFormatting.RED)));
    }
    else
    {
        if (this.openContainer != this.inventoryContainer)
        {
            this.closeScreen();
        }

        if (chestInventory instanceof ILockableContainer)
        {
            ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory;

            if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator())
            {
                this.connection.sendPacket(new SPacketChat(new TextComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2));
                this.connection.sendPacket(new SPacketSoundEffect(SoundEvents.BLOCK_CHEST_LOCKED, SoundCategory.BLOCKS, this.posX, this.posY, this.posZ, 1.0F, 1.0F));
                return;
            }
        }

        this.getNextWindowId();

        if (chestInventory instanceof IInteractionObject)
        {
            this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
            this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this);
        }
        else
        {
            this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
            this.openContainer = new ContainerChest(this.inventory, chestInventory, this);
        }

        this.openContainer.windowId = this.currentWindowId;
        this.openContainer.addListener(this);
        net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.openContainer));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:47,代码来源:EntityPlayerMP.java


示例11: handleSoundEffect

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public void handleSoundEffect(SPacketSoundEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.theWorld.playSound(this.gameController.thePlayer, packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getSound(), packetIn.getCategory(), packetIn.getVolume(), packetIn.getPitch());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:6,代码来源:NetHandlerPlayClient.java


示例12: playSoundToAllNearExcept

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
@Override
public void playSoundToAllNearExcept(EntityPlayer player, SoundEvent sound, SoundCategory category, double x, double y, double z, float volume, float pitch) {
    double range = volume > 1.0F ? 16.0F * volume : 16.0;
    this.server.getPlayerList().sendToAllNearExcept(player, x, y, z, range, this.blockSystem.provider.getDimension(), new SPacketSoundEffect(sound, category, x, y, z, volume, pitch));
}
 
开发者ID:gegy1000,项目名称:BlockSystems,代码行数:6,代码来源:ServerBlockSystemListener.java


示例13: execute

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
@Override
public boolean execute(EntityPlayerMP target) {
	SoundEvent sound = CollectionUtils.getRandom(sounds);
	target.connection.sendPacket(new SPacketSoundEffect(sound, SoundCategory.MASTER, target.posX, target.posY, target.posZ, 1, 1));
	return true;
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:7,代码来源:SoundFlimFlam.java


示例14: handleSoundEffect

import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
void handleSoundEffect(SPacketSoundEffect packetIn); 
开发者ID:sudofox,项目名称:Backmemed,代码行数:2,代码来源:INetHandlerPlayClient.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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