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.

Featured Replies

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

  • Author

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

  • Author

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

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...

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.