Jump to content

Recommended Posts

Posted

how can i make custom block break/place/footsteps sounds i tried making custom sound events and then making a forgesoundtype with them everything works fine except the sound is not there i can play it with /playsound but its silent even when i break/place the block i applied it to

Posted (edited)

here is my sound events class

public class ModSoundEvents {
	public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister
			.create(ForgeRegistries.SOUND_EVENTS, ThingMod.MOD_ID);

	public static final RegistryObject<SoundEvent> THING_SOUND = registerSoundEvent("thing_sound");

	public static final ForgeSoundType THING_SOUND_TYPE = new ForgeSoundType(1f, 1f, () -> THING_SOUND.get(),
			() -> THING_SOUND.get(), () -> THING_SOUND.get(), () -> THING_SOUND.get(), () -> THING_SOUND.get());

	private static RegistryObject<SoundEvent> registerSoundEvent(String name) {
		return SOUND_EVENTS.register(name, () -> new SoundEvent(new ResourceLocation(ThingMod.MOD_ID, name)));
	}

	public static void register(IEventBus eventBus) {
		SOUND_EVENTS.register(eventBus);
	}
}

and here is my sounds.json

{
	"thing_sound": {
		"category": "blocks",
		"subtitle": "thingmod.thing_sound",
		"sounds": [
			"thingmod.thing_sound"
		]
	}
}

my sound file is an ogg file and is named the exact same as it is registered as

then i use ModSoundEvents.THING_SOUND_TYPE as the parameter in .Sound() when creating my block

and then in my main class i register the ModSoundEvents class with the event bus

Edited by KaboomRoads
Posted (edited)

how do i post screenshots here?

 

since i cant find a way to post screenshots ill just write it down

Spoiler

assets.thingmod

    blockstates

    lang

    models

        block

        item

    sounds

        thing_sound.ogg

    textures

        block

        item

    sounds.json

 

Edited by KaboomRoads
Posted
3 hours ago, KaboomRoads said:

i dont have that button there. its probably a rank thing.

website issue, you could still drag and drop files over the dark gray area and upload them

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.