Line 61: |
Line 61: |
| For example, to reference <code>example_complex.ogg</code>, you would store the reference name (e.g. <code>example_sound_complex</code>) within a <code>new SoundEvent(new ResourceLocation("examplemod", "example_sound_complex"))</code>. This will locate <code>assets/examplemod/sounds.json</code> and try to find an <code>example_sound_complex</code> object nested within it. | | For example, to reference <code>example_complex.ogg</code>, you would store the reference name (e.g. <code>example_sound_complex</code>) within a <code>new SoundEvent(new ResourceLocation("examplemod", "example_sound_complex"))</code>. This will locate <code>assets/examplemod/sounds.json</code> and try to find an <code>example_sound_complex</code> object nested within it. |
| | | |
− | <code>SoundEvent</code>s must be [[Registration|registered/1.16]] to be referenced in code. | + | <code>SoundEvent</code>s must be [[Registration/1.16|registered]] to be referenced in code. |
| | | |
| == Playing Sounds == | | == Playing Sounds == |
Line 95: |
Line 95: |
| === <code> PlayerEntity</code> === | | === <code> PlayerEntity</code> === |
| | | |
− | # <code><nowiki>playSound(SoundEvent, volume, pitch)</nowiki></code> (overriding the one in <code>[[Sounds#Entity|Entity/1.16]]</code>) | + | # <code><nowiki>playSound(SoundEvent, volume, pitch)</nowiki></code> (overriding the one in <code>[[Sounds#Entity/1.16|Entity]]</code>) |
| #* Forwards to <code>World</code>‘s overload (2), passing in <code>this</code> as the player. | | #* Forwards to <code>World</code>‘s overload (2), passing in <code>this</code> as the player. |
− | #* <code>Client Behavior</code>: Does nothing, see override in <code>[[Sounds#clientplayerentity|ClientPlayerEntity/1.16]]</code>. | + | #* <code>Client Behavior</code>: Does nothing, see override in <code>[[Sounds#clientplayerentity/1.16|ClientPlayerEntity]]</code>. |
| #* <code>Server Behavior</code>: Plays the sound to everyone nearby <code>except</code> this player. | | #* <code>Server Behavior</code>: Plays the sound to everyone nearby <code>except</code> this player. |
− | #* <code>Usage</code>: See <code>[[Sounds#clientplayerentity|ClientPlayerEntity/1.16]]</code>. | + | #* <code>Usage</code>: See <code>[[Sounds#clientplayerentity/1.16|ClientPlayerEntity]]</code>. |
| | | |
| === <code> ClientPlayerEntity</code> === | | === <code> ClientPlayerEntity</code> === |
| | | |
− | # <code><nowiki>playSound(SoundEvent, volume, pitch)</nowiki></code> (overriding the one in <code>[[Sounds#playerentity|PlayerEntity/1.16]]</code>) | + | # <code><nowiki>playSound(SoundEvent, volume, pitch)</nowiki></code> (overriding the one in <code>[[Sounds#playerentity/1.16|PlayerEntity]]</code>) |
| #* Forwards to <code>World</code>‘s overload (2), passing in <code>this</code> as the player. | | #* Forwards to <code>World</code>‘s overload (2), passing in <code>this</code> as the player. |
| #* <code>Client Behavior</code>: Just plays the Sound Event. | | #* <code>Client Behavior</code>: Just plays the Sound Event. |
Line 110: |
Line 110: |
| | | |
| | | |
− | [[Category:Game Effects/1.16]] | + | [[Category:Game Effects/1.16|Category:Game Effects]] |