Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AyrA

Members
  • Joined

  • Last visited

Everything posted by AyrA

  1. I have an issue with audio playback in my mod. First I created a SoundEvents Class public class SoundEvents { @ForgeSubscribe public void onSound(SoundLoadEvent e) { URL u=DirtyMod.class.getResource(CommonProxy.FURNACE_SOUND); if(u!=null) { e.manager.soundPoolSounds.addSound(CommonProxy.FURNACE_SOUNDID, u); System.out.println(CommonProxy.FURNACE_SOUND+" registered as "+u.toString()); } else { System.out.println(CommonProxy.FURNACE_SOUND+" not found"); } } } I then call it in my PreInit function with MinecraftForge.EVENT_BUS.register(new SoundEvents()); I then created a packet handler. whenever I place a dirtfurnace the coords are transferred to the player placing the furnace. The receiver end looks like the folowing: public class PacketHandler implements IPacketHandler { @Override @SideOnly(Side.CLIENT) public void onPacketData(INetworkManager manager,Packet250CustomPayload packet, Player player) { int x,y,z; World w; EntityClientPlayerMP p; if (packet.channel.equals("DirtyNetwork")) { DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); try { x=inputStream.readInt(); y=inputStream.readInt(); z=inputStream.readInt(); p = (EntityClientPlayerMP) player; w=p.worldObj; w.playSoundEffect((double)x+0.5D,(double)y+0.5D,(double)z+0.5D,CommonProxy.FURNACE_SOUNDID,1.0F,w.rand.nextFloat()*.1F+0.9F); System.out.println("FURNACE!!! "+x+","+y+","+z); } catch (IOException e) { e.printStackTrace(); } } } } the folowing constants are defined in my CommonProxy class: public static final String FURNACE_SOUND= "/ayra/dirtyMod/furnace.ogg"; public static final String FURNACE_SOUNDID="ayra.dirtyMod.furnace"; My issue is, that the sound is not playing. The initialization function gets called. The output to the console looks like this: /ayra/dirtyMod/furnace.ogg registered as file:/D:/Programme/Games/minecraft/develop/1.4.7/forge/mcp/eclipse/Minecraft/bin/ayra/dirtyMod/furnace.ogg The ogg file exists at the specified location. The placement function also gets called because the receiver function outputs to the console: FURNACE!!! -43,74,308 There is no error printed to the console. Does somebody know how to correctly do this? I also tried using a .wav file.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.