Java 类net.minecraft.network.play.server.SPacketCustomSound 实例源码

项目:ElectricAdvantage    文件:ElectricGeneratorTileEntity.java   
protected void playSoundEffect(double x, double y, double z, SoundEvent sound, float volume, float pitch){
    if(getWorld().isRemote) return;
    final double range = 16;
    List<EntityPlayerMP> players = getWorld().getEntitiesWithinAABB(EntityPlayerMP.class, new AxisAlignedBB(
            x - range, y - range, z - range,
            x + range, y + range, z + range));
    for(EntityPlayerMP player : players){
        player.connection.sendPacket(new SPacketCustomSound(sound.getRegistryName().toString(), SoundCategory.BLOCKS,
                x, y, z, (float)volume, (float)pitch));
    }
}
项目:ElectricAdvantage    文件:ElectricMachineTileEntity.java   
protected void playSoundEffect(double x, double y, double z, SoundEvent sound, float volume, float pitch){
    if(getWorld().isRemote) return;
    final double range = 16;
    List<EntityPlayerMP> players = getWorld().getEntitiesWithinAABB(EntityPlayerMP.class, new AxisAlignedBB(
            x - range, y - range, z - range,
            x + range, y + range, z + range));
    for(EntityPlayerMP player : players){
        player.connection.sendPacket(new SPacketCustomSound(sound.getRegistryName().toString(), SoundCategory.BLOCKS,
                x, y, z, (float)volume, (float)pitch));
    }
}
项目:SteamAdvantage    文件:SoundHelper.java   
public static void playSoundAtPosition(double x, double y, double z, SoundEvent sound, SoundCategory soundType, float volume, float pitch, World serverWorld){
    if(serverWorld.isRemote) return;
    final double range = 16;
    List<EntityPlayerMP> players = serverWorld.getEntitiesWithinAABB(EntityPlayerMP.class, new AxisAlignedBB(
            x - range, y - range, z - range,
            x + range, y + range, z + range));
    for(EntityPlayerMP player : players){
        player.connection.sendPacket(new SPacketCustomSound(sound.getRegistryName().toString(), soundType,
                x, y, z, (float)volume, (float)pitch));
    }
}
项目:SteamAdvantage    文件:SoundHelper.java   
public static void playBigSoundAtPosition(double x, double y, double z, SoundEvent sound, SoundCategory soundType, float volume, float pitch, World serverWorld){
    if(serverWorld.isRemote) return;
    final double range = 50;
    List<EntityPlayerMP> players = serverWorld.getEntitiesWithinAABB(EntityPlayerMP.class, new AxisAlignedBB(
            x - range, y - range, z - range,
            x + range, y + range, z + range));
    for(EntityPlayerMP player : players){
        player.connection.sendPacket(new SPacketCustomSound(sound.getRegistryName().toString(), soundType,
                x, y, z, (float)volume, (float)pitch));
    }
}
项目:DrCyanosWonderfulWands    文件:Wand.java   
protected void playSound(World w, Vec3d position, double range, SoundEvent sound, float volume, float pitch){
    if(w.isRemote)return;
    AxisAlignedBB area = new AxisAlignedBB(
            position.xCoord - range,position.yCoord - range,position.zCoord - range,
            position.xCoord + range,position.yCoord + range,position.zCoord + range
            );

    List<EntityPlayerMP> players = w.getEntitiesWithinAABB(EntityPlayerMP.class, area);
    SPacketCustomSound soundPacket = new SPacketCustomSound(sound.getRegistryName().toString(), SoundCategory.PLAYERS,
            position.xCoord, position.yCoord, position.zCoord, volume, pitch);
    for(EntityPlayerMP player : players){
        player.connection.sendPacket(soundPacket);
    }
}
项目:DrCyanosWonderfulWands    文件:Wand.java   
protected void playFadedSound(World w, Vec3d position, double range, SoundEvent sound, float volume, float pitch){
    if(w.isRemote)return;
    AxisAlignedBB area = new AxisAlignedBB(
            position.xCoord - range,position.yCoord - range,position.zCoord - range,
            position.xCoord + range,position.yCoord + range,position.zCoord + range
    );
    List<EntityPlayerMP> players = w.getEntitiesWithinAABB(EntityPlayerMP.class, area);
    for(EntityPlayerMP player : players){
        float distSqr = (float)player.getPositionVector().squareDistanceTo(position);
        float localVolume = Math.min(volume,volume/distSqr);
        SPacketCustomSound soundPacket = new SPacketCustomSound(sound.getRegistryName().toString(), SoundCategory.PLAYERS,
                position.xCoord, position.yCoord, position.zCoord, localVolume, pitch);
        player.connection.sendPacket(soundPacket);
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
public void handleCustomSound(SPacketCustomSound packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(packetIn.getSoundName()), packetIn.getCategory(), packetIn.getVolume(), packetIn.getPitch(), false, 0, ISound.AttenuationType.LINEAR, (float)packetIn.getX(), (float)packetIn.getY(), (float)packetIn.getZ()));
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
public void handleCustomSound(SPacketCustomSound packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(packetIn.getSoundName()), packetIn.getCategory(), packetIn.getVolume(), packetIn.getPitch(), false, 0, ISound.AttenuationType.LINEAR, (float)packetIn.getX(), (float)packetIn.getY(), (float)packetIn.getZ()));
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
public void handleCustomSound(SPacketCustomSound packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(packetIn.getSoundName()), packetIn.getCategory(), packetIn.getVolume(), packetIn.getPitch(), false, 0, ISound.AttenuationType.LINEAR, (float)packetIn.getX(), (float)packetIn.getY(), (float)packetIn.getZ()));
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
public void handleCustomSound(SPacketCustomSound packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(packetIn.getSoundName()), packetIn.getCategory(), packetIn.getVolume(), packetIn.getPitch(), false, 0, ISound.AttenuationType.LINEAR, (float)packetIn.getX(), (float)packetIn.getY(), (float)packetIn.getZ()));
}
项目:Backmemed    文件:INetHandlerPlayClient.java   
void handleCustomSound(SPacketCustomSound packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayClient.java   
void handleCustomSound(SPacketCustomSound packetIn);