Jump to content

Custom Sound Types for Block Sound Events


Durand1w

Recommended Posts

I have two mods that have working Sound Events.  I have encountered a situation where I would like to be able to define a custom Sound Type, as the available SoundTypes don't fit the block I have created.  I have not been able to find a post or example so far to know if I'm missing a requirement.

 

I have confirmed that the sound file itself works with OnBlockPlaced, so the sound file and the sounds.json file are fine.

 

When I define a Custom SoundType, the vanilla action sounds work without issues.  The custom action sound causes a null pointer exception.  The log itself hasn't helped in identifying a cause.

 

Eclipse shows the correct path, so it isn't an issue of not finding the sound file/file not found exception.

 

Block Class:

setSoundType(TyrDropSounds.COINS);

 

Sounds Class:

public static SoundEvent coins_sliding;

 

coins_sliding = registerSound("coins_sliding");

 

public static SoundType COINS = new SoundType(1.0F, 1.0F, coins_sliding, SoundEvents.BLOCK_WOOD_STEP, SoundEvents.BLOCK_WOOD_PLACE, SoundEvents.BLOCK_WOOD_HIT, SoundEvents.BLOCK_WOOD_FALL);

 

 

I'm wondering if there is something else that must be done for Custom SoundTypes or other information that may make this problematic, since I think the available sounds work for the vast majority of blocks.  Chains and Coins are my only two use cases so far.  Thanks for any info.

 

 

Link to comment
Share on other sites

If you can't figure it out yourself, post the crash log.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

I do know that if I substitute a vanilla sound in for the custom sound, it does not crash.  Sorry if that was not clear earlier.  I have also tried other working custom sounds, and they cause a crash as well when used.

 

public static SoundType COINS = new SoundType(1.0F, 1.0F, coins_sliding, SoundEvents.BLOCK_WOOD_STEP, SoundEvents.BLOCK_WOOD_PLACE, SoundEvents.BLOCK_WOOD_HIT, SoundEvents.BLOCK_WOOD_FALL);

 

At one point I thought that SoundTypes needed to be registered like SoundEvents, but I don't believe that is the case.  If they did, then I would not expect the vanilla sounds to work in the statement above, nor have I found where they are registered like SoundEvents.

 

Minecraft 1.10.2, Forge 12.18.1.2011

 

Thanks for any insights.  I spent a large chunk of Sunday trying to identify my mistake or lack of understanding.

 

Crash Log:

 

 

---- Minecraft Crash Report ----

// I'm sorry, Dave.

 

Time: 12/18/16 8:22 PM

Description: Playing level event

 

java.lang.NullPointerException: Playing level event

at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:40)

at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:35)

at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:498)

at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:492)

at net.minecraft.client.renderer.RenderGlobal.playEvent(RenderGlobal.java:2389)

at net.minecraft.world.World.playEvent(World.java:3944)

at net.minecraft.world.World.playEvent(World.java:3935)

at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDestroyBlock(PlayerControllerMP.java:172)

at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDamageBlock(PlayerControllerMP.java:339)

at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1503)

at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2295)

at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2058)

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1846)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118)

at net.minecraft.client.Minecraft.run(Minecraft.java:406)

at net.minecraft.client.main.Main.main(Main.java:118)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

at GradleStart.main(GradleStart.java:26)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Thread: Client thread

Stacktrace:

at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:40)

at net.minecraft.client.audio.PositionedSoundRecord.<init>(PositionedSoundRecord.java:35)

at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:498)

at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:492)

at net.minecraft.client.renderer.RenderGlobal.playEvent(RenderGlobal.java:2389)

 

-- Level event being played --

Details:

Block coordinates: World: (-103,69,23), Chunk: (at 9,4,7 in -7,1; contains blocks -112,0,16 to -97,255,31), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Event source: ~~NULL~~

Event type: 2001

Event data: 17229

Stacktrace:

at net.minecraft.world.World.playEvent(World.java:3944)

at net.minecraft.world.World.playEvent(World.java:3935)

at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDestroyBlock(PlayerControllerMP.java:172)

at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDamageBlock(PlayerControllerMP.java:339)

at net.minecraft.client.Minecraft.sendClickBlockToController(Minecraft.java:1503)

at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2295)

at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2058)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityPlayerSP['Player412'/125, l='MpServer', x=-100.06, y=69.00, z=23.10]]

Chunk stats: MultiplayerChunkCache: 622, 622

Level seed: 0

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: World: (-104,64,20), Chunk: (at 8,4,4 in -7,1; contains blocks -112,0,16 to -97,255,31), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 16146 game time, 5697 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

Forced entities: 100 total; [EntitySkeleton['Skeleton'/3, l='MpServer', x=-178.50, y=27.00, z=38.50], EntityCreeper['Creeper'/4, l='MpServer', x=-179.49, y=27.00, z=38.85], EntitySkeleton['Skeleton'/8, l='MpServer', x=-175.50, y=16.00, z=100.50], EntitySkeleton['Skeleton'/9, l='MpServer', x=-149.73, y=27.00, z=-6.51], EntityZombie['Zombie'/10, l='MpServer', x=-149.02, y=27.00, z=-3.62], EntityZombie['Zombie'/11, l='MpServer', x=-148.22, y=33.00, z=-15.50], EntityZombie['Zombie'/12, l='MpServer', x=-147.29, y=33.00, z=-9.48], EntityCreeper['Creeper'/13, l='MpServer', x=-146.54, y=15.00, z=46.17], EntityZombie['Zombie'/16, l='MpServer', x=-130.74, y=24.00, z=-34.47], EntityCreeper['Creeper'/17, l='MpServer', x=-130.30, y=25.00, z=-33.50], EntitySkeleton['Skeleton'/18, l='MpServer', x=-134.21, y=25.00, z=-33.50], EntityCreeper['Creeper'/19, l='MpServer', x=-136.14, y=29.00, z=-24.54], EntityChicken['Chicken'/20, l='MpServer', x=-131.53, y=64.00, z=-12.79], EntityChicken['Chicken'/21, l='MpServer', x=-137.43, y=62.69, z=8.86], EntityZombie['Zombie'/22, l='MpServer', x=-134.26, y=26.00, z=27.45], EntitySkeleton['Skeleton'/23, l='MpServer', x=-131.60, y=32.00, z=26.30], EntitySkeleton['Skeleton'/24, l='MpServer', x=-140.50, y=15.00, z=59.50], EntitySkeleton['Skeleton'/25, l='MpServer', x=-142.73, y=16.00, z=54.50], EntityBat['Bat'/28, l='MpServer', x=-118.48, y=29.10, z=-39.25], EntityZombie['Zombie'/29, l='MpServer', x=-119.46, y=22.00, z=-27.24], EntityCreeper['Creeper'/30, l='MpServer', x=-118.03, y=23.00, z=-18.70], EntityZombie['Zombie'/31, l='MpServer', x=-115.50, y=20.00, z=-22.50], EntitySpider['Spider'/32, l='MpServer', x=-116.50, y=20.00, z=-24.50], EntityItem['item.item.rottenFlesh'/33, l='MpServer', x=-125.46, y=64.00, z=-19.30], EntityBat['Bat'/35, l='MpServer', x=-124.43, y=25.10, z=12.75], EntityCreeper['Creeper'/36, l='MpServer', x=-122.12, y=29.00, z=7.20], EntitySkeleton['Skeleton'/37, l='MpServer', x=-119.47, y=41.00, z=14.86], EntityBat['Bat'/38, l='MpServer', x=-121.36, y=33.10, z=7.60], EntityBat['Bat'/39, l='MpServer', x=-116.54, y=51.93, z=8.64], EntityBat['Bat'/40, l='MpServer', x=-118.60, y=22.10, z=20.54], EntityBat['Bat'/41, l='MpServer', x=-118.75, y=52.10, z=20.17], EntityItem['item.item.egg'/42, l='MpServer', x=-112.83, y=67.00, z=29.22], EntityCreeper['Creeper'/43, l='MpServer', x=-122.81, y=26.00, z=47.48], EntityCreeper['Creeper'/45, l='MpServer', x=-98.22, y=17.00, z=-21.52], EntityCreeper['Creeper'/46, l='MpServer', x=-100.83, y=25.00, z=-14.50], EntitySpider['Spider'/47, l='MpServer', x=-107.40, y=26.00, z=-14.10], EntityBat['Bat'/48, l='MpServer', x=-101.75, y=46.10, z=20.25], EntityBat['Bat'/49, l='MpServer', x=-104.52, y=44.10, z=24.49], EntityBat['Bat'/50, l='MpServer', x=-102.78, y=44.00, z=11.55], EntityBat['Bat'/51, l='MpServer', x=-105.41, y=39.16, z=24.50], EntityChicken['Chicken'/52, l='MpServer', x=-111.53, y=68.00, z=24.79], EntityZombie['Zombie'/53, l='MpServer', x=-80.84, y=13.00, z=-56.64], EntityCreeper['Creeper'/56, l='MpServer', x=-83.50, y=22.00, z=-18.50], EntityCreeper['Creeper'/57, l='MpServer', x=-94.50, y=19.00, z=-26.50], EntityCreeper['Creeper'/58, l='MpServer', x=-92.50, y=19.00, z=-27.50], EntitySkeleton['Skeleton'/59, l='MpServer', x=-90.24, y=20.00, z=-24.47], EntityChicken['Chicken'/60, l='MpServer', x=-86.92, y=65.00, z=-12.85], EntitySkeleton['Skeleton'/61, l='MpServer', x=-83.50, y=24.00, z=11.50], EntityZombie['Zombie'/62, l='MpServer', x=-95.30, y=40.05, z=11.30], EntityItem['item.item.arrow'/63, l='MpServer', x=-83.14, y=67.00, z=5.92], EntityItem['item.item.bone'/64, l='MpServer', x=-82.13, y=67.00, z=6.09], EntitySpider['Spider'/65, l='MpServer', x=-83.43, y=58.00, z=21.30], EntitySpider['Spider'/66, l='MpServer', x=-83.01, y=58.88, z=17.25], EntityBat['Bat'/71, l='MpServer', x=-76.03, y=13.26, z=-50.85], EntityChicken['Chicken'/72, l='MpServer', x=-76.64, y=64.00, z=-37.86], EntityChicken['Chicken'/73, l='MpServer', x=-80.20, y=66.00, z=-21.51], EntityItem['item.item.egg'/74, l='MpServer', x=-72.39, y=67.00, z=-17.42], EntityItem['item.item.egg'/75, l='MpServer', x=-74.88, y=67.00, z=-16.55], EntityChicken['Chicken'/76, l='MpServer', x=-79.12, y=66.00, z=-12.06], EntityItem['item.item.egg'/77, l='MpServer', x=-67.80, y=68.00, z=-3.39], EntityChicken['Chicken'/78, l='MpServer', x=-69.60, y=68.00, z=-7.50], EntityChicken['Chicken'/79, l='MpServer', x=-68.62, y=68.00, z=-14.50], EntityCreeper['Creeper'/80, l='MpServer', x=-67.18, y=36.00, z=8.25], EntityCreeper['Creeper'/81, l='MpServer', x=-64.50, y=34.44, z=7.70], EntitySpider['Spider'/82, l='MpServer', x=-81.92, y=58.00, z=21.30], EntityChicken['Chicken'/83, l='MpServer', x=-79.37, y=69.00, z=9.13], EntityChicken['Chicken'/84, l='MpServer', x=-65.46, y=68.00, z=0.77], EntitySquid['Squid'/85, l='MpServer', x=-82.01, y=49.88, z=55.93], EntitySquid['Squid'/86, l='MpServer', x=-80.35, y=43.15, z=79.95], EntityZombie['Zombie'/87, l='MpServer', x=-62.30, y=12.00, z=-44.51], EntityItem['item.item.rottenFlesh'/88, l='MpServer', x=-48.13, y=58.00, z=-6.49], EntityItem['item.item.egg'/89, l='MpServer', x=-58.57, y=68.00, z=1.89], EntityChicken['Chicken'/90, l='MpServer', x=-63.78, y=68.00, z=3.52], EntityChicken['Chicken'/91, l='MpServer', x=-59.70, y=68.00, z=32.50], EntityCreeper['Creeper'/92, l='MpServer', x=-50.82, y=30.00, z=88.52], EntitySkeleton['Skeleton'/93, l='MpServer', x=-34.50, y=58.00, z=-18.68], EntityZombie['Zombie'/94, l='MpServer', x=-46.50, y=9.00, z=-13.27], EntityZombie['Zombie'/95, l='MpServer', x=-47.50, y=18.00, z=-4.50], EntityBat['Bat'/96, l='MpServer', x=-43.25, y=59.10, z=-12.36], EntitySkeleton['Skeleton'/97, l='MpServer', x=-43.27, y=50.00, z=-2.50], EntityEnderman['Enderman'/98, l='MpServer', x=-44.54, y=51.00, z=-2.30], EntityCreeper['Creeper'/99, l='MpServer', x=-38.59, y=57.00, z=-16.02], EntityCreeper['Creeper'/100, l='MpServer', x=-38.50, y=57.00, z=-5.78], EntityCreeper['Creeper'/101, l='MpServer', x=-37.82, y=58.00, z=-15.38], EntityCreeper['Creeper'/102, l='MpServer', x=-47.95, y=57.00, z=-15.61], EntityItem['item.item.rottenFlesh'/104, l='MpServer', x=-45.32, y=68.00, z=-14.70], EntitySkeleton['Skeleton'/105, l='MpServer', x=-33.52, y=54.00, z=13.72], EntityChicken['Chicken'/106, l='MpServer', x=-45.34, y=69.00, z=13.10], EntityChicken['Chicken'/107, l='MpServer', x=-40.86, y=69.00, z=4.31], EntityItem['item.item.egg'/109, l='MpServer', x=-41.75, y=69.00, z=3.99], EntitySkeleton['Skeleton'/110, l='MpServer', x=-32.92, y=54.00, z=16.40], EntityBat['Bat'/111, l='MpServer', x=-35.78, y=46.10, z=40.74], EntitySkeleton['Skeleton'/112, l='MpServer', x=-39.50, y=18.00, z=60.50], EntitySkeleton['Skeleton'/114, l='MpServer', x=-26.47, y=23.00, z=21.27], EntityZombie['Zombie'/115, l='MpServer', x=-24.52, y=19.00, z=25.80], EntityZombie['Zombie'/116, l='MpServer', x=-23.70, y=43.00, z=36.70], EntityZombie['Zombie'/118, l='MpServer', x=-27.47, y=16.00, z=99.22], EntityPlayerSP['Player412'/125, l='MpServer', x=-100.06, y=69.00, z=23.10], EntityItem['item.item.egg'/231, l='MpServer', x=-60.19, y=68.00, z=33.05], EntityItem['item.item.egg'/234, l='MpServer', x=-75.79, y=64.00, z=-38.47]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:450)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2779)

at net.minecraft.client.Minecraft.run(Minecraft.java:427)

at net.minecraft.client.main.Main.main(Main.java:118)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

at GradleStart.main(GradleStart.java:26)

 

-- System Details --

Details:

Minecraft Version: 1.10.2

Operating System: Windows 10 (amd64) version 10.0

Java Version: 1.8.0_91, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 312991296 bytes (298 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95

FML: MCP 9.32 Powered by Forge 12.18.1.2011 5 mods loaded, 5 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar)

UCHIJAAAA Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar)

UCHIJAAAA tyrbuilders{1.1.10_01} [tyrbuilders] (TyrBuilders-1.10.2-v1.0.1.jar)

UCHIJAAAA tyrdrops{1.10.2-1.0.1} [Tyr Drops] (bin)

Loaded coremods (and transformers):

GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 369.09' Renderer: 'GeForce GTX 980 Ti/PCIe/SSE2'

Launched Version: 1.10.2

LWJGL: 2.9.4

OpenGL: GeForce GTX 980 Ti/PCIe/SSE2 GL version 4.5.0 NVIDIA 369.09, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using GL 1.3 texture combiners.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Shaders are available because OpenGL 2.1 is supported.

VBOs are available because OpenGL 1.5 is supported.

 

Using VBOs: Yes

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs:

Current Language: English (US)

Profiler Position: N/A (disabled)

CPU: 8x Intel® Core i7-2600 CPU @ 3.40GHz

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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