public static void playSound(World worldObj, String soundName, double x, double y, double z, double volume, double pitch) { S29PacketSoundEffect soundEffect = new S29PacketSoundEffect(soundName, x, y, z, (float) volume, (float) pitch); for (int j = 0; j < worldObj.playerEntities.size(); ++j) { EntityPlayerMP entityplayermp = (EntityPlayerMP)worldObj.playerEntities.get(j); ChunkCoordinates chunkcoordinates = entityplayermp.getPlayerCoordinates(); double d7 = x - chunkcoordinates.posX; double d8 = y - chunkcoordinates.posY; double d9 = z - chunkcoordinates.posZ; double d10 = d7 * d7 + d8 * d8 + d9 * d9; if (d10 <= 256.0D) { entityplayermp.playerNetServerHandler.sendPacket(soundEffect); } } }
/** * Opens a mod added container. * * @param player The player to open the container for * @param inventory The tile entity providing the inventory */ public static void openContainer(EntityPlayerMP player, IModInventory inventory) { if (player.openContainer != player.inventoryContainer) player.closeScreen(); if (inventory instanceof IModLockableInventory) { IModLockableInventory lockable = (IModLockableInventory)inventory; if (lockable.isLocked() && !player.canOpen(lockable.getLockCode()) && !player.isSpectator()) { player.playerNetServerHandler.sendPacket(new S02PacketChat(new ChatComponentTranslation(lockable.getLockMessageString(), inventory.getDisplayName()), (byte) 2)); player.playerNetServerHandler.sendPacket(new S29PacketSoundEffect(lockable.getLockSoundString(), player.posX, player.posY, player.posZ, 1.0F, 1.0F)); return; } } player.getNextWindowId(); Container container = inventory.createContainer(player.inventory, player); player.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(player.currentWindowId, inventory.getGuiID(), inventory.getDisplayName(), inventory.getSizeInventory())); player.openContainer = container; player.openContainer.windowId = player.currentWindowId; player.openContainer.onCraftGuiOpened(player); }
/** * Displays the GUI for interacting with a chest inventory. Args: chestInventory */ public void displayGUIChest(IInventory chestInventory) { 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.playerNetServerHandler.sendPacket(new S02PacketChat(new ChatComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2)); this.playerNetServerHandler.sendPacket(new S29PacketSoundEffect("random.door_close", this.posX, this.posY, this.posZ, 1.0F, 1.0F)); return; } } this.getNextWindowId(); if (chestInventory instanceof IInteractionObject) { this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory())); this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this); } else { this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory())); this.openContainer = new ContainerChest(this.inventory, chestInventory, this); } this.openContainer.windowId = this.currentWindowId; this.openContainer.onCraftGuiOpened(this); }
private void doTheLightningThing(EntityPlayerMP user, World world, double x, double y, double z) { user.playerNetServerHandler.sendPacket(new S2CPacketSpawnGlobalEntity( new EntityLightningBolt(world, x, y, z))); user.playerNetServerHandler.sendPacket( new S29PacketSoundEffect("ambient.weather.thunder", x, y, z, 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F)); user.playerNetServerHandler .sendPacket(new S29PacketSoundEffect("random.explode", x, y, z, 20.0F, 0.5F + this.rand.nextFloat() * 0.2F)); }
public static void playSound(World worldObj, String soundName, double x, double y, double z, double volume, double pitch) { S29PacketSoundEffect soundEffect = new S29PacketSoundEffect(soundName, 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.playerNetServerHandler.sendPacket(soundEffect); } } }
/** * Plays the specified sound. Arg: soundName, x, y, z, volume, pitch */ public void playSound(String soundName, double x, double y, double z, float volume, float pitch) { this.mcServer.getConfigurationManager().sendToAllNear(x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.theWorldServer.provider.getDimensionId(), new S29PacketSoundEffect(soundName, x, y, z, volume, pitch)); }
/** * Plays sound to all near players except the player reference given */ public void playSoundToNearExcept(EntityPlayer except, String soundName, double x, double y, double z, float volume, float pitch) { this.mcServer.getConfigurationManager().sendToAllNearExcept(except, x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.theWorldServer.provider.getDimensionId(), new S29PacketSoundEffect(soundName, x, y, z, volume, pitch)); }
public void handleSoundEffect(S29PacketSoundEffect packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.theWorld.playSound(packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getSoundName(), packetIn.getVolume(), packetIn.getPitch(), false); }
/** * Plays the specified sound. Arg: soundName, x, y, z, volume, pitch */ public void playSound(String par1Str, double par2, double par4, double par6, float par8, float par9) { this.mcServer.getConfigurationManager().func_148541_a(par2, par4, par6, par8 > 1.0F ? (double)(16.0F * par8) : 16.0D, this.theWorldServer.provider.dimensionId, new S29PacketSoundEffect(par1Str, par2, par4, par6, par8, par9)); }
/** * Plays sound to all near players except the player reference given */ public void playSoundToNearExcept(EntityPlayer par1EntityPlayer, String par2Str, double par3, double par5, double par7, float par9, float par10) { this.mcServer.getConfigurationManager().func_148543_a(par1EntityPlayer, par3, par5, par7, par9 > 1.0F ? (double)(16.0F * par9) : 16.0D, this.theWorldServer.provider.dimensionId, new S29PacketSoundEffect(par2Str, par3, par5, par7, par9, par10)); }
public void handleSoundEffect(S29PacketSoundEffect p_147255_1_) { this.gameController.theWorld.playSound(p_147255_1_.func_149207_d(), p_147255_1_.func_149211_e(), p_147255_1_.func_149210_f(), p_147255_1_.func_149212_c(), p_147255_1_.func_149208_g(), p_147255_1_.func_149209_h(), false); }
public void playSound(String p_72704_1_, double p_72704_2_, double p_72704_4_, double p_72704_6_, float p_72704_8_, float p_72704_9_) { this.mcServer.getConfigurationManager().sendToAllNear(p_72704_2_, p_72704_4_, p_72704_6_, p_72704_8_ > 1.0F ? (double)(16.0F * p_72704_8_) : 16.0D, this.theWorldServer.provider.dimensionId, new S29PacketSoundEffect(p_72704_1_, p_72704_2_, p_72704_4_, p_72704_6_, p_72704_8_, p_72704_9_)); }
public void playSoundToNearExcept(EntityPlayer p_85102_1_, String p_85102_2_, double p_85102_3_, double p_85102_5_, double p_85102_7_, float p_85102_9_, float p_85102_10_) { this.mcServer.getConfigurationManager().sendToAllNearExcept(p_85102_1_, p_85102_3_, p_85102_5_, p_85102_7_, p_85102_9_ > 1.0F ? (double)(16.0F * p_85102_9_) : 16.0D, this.theWorldServer.provider.dimensionId, new S29PacketSoundEffect(p_85102_2_, p_85102_3_, p_85102_5_, p_85102_7_, p_85102_9_, p_85102_10_)); }
void handleSoundEffect(S29PacketSoundEffect packetIn);
void handleSoundEffect(S29PacketSoundEffect var1);
void handleSoundEffect(S29PacketSoundEffect p_147255_1_);