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

I'm adding a disc to the game, and it works perfectly fine, with one problem. When playing the disc for the first time after the resources were loaded (with the game or F3+T), the game lags for a few seconds, just like if the audio file was just loaded only at that moment. Do you have any idea where the problem could be? Here are my items and sounds registering classes:

 

RandomItems.java

package smyler.random.item;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import smyler.random.sound.RandomSounds;

@Mod.EventBusSubscriber
public class RandomItems {

	// ==== The items ====
	public static final Item RECORD_ZELDA_STORM = new RandomRecordItem("zelda_storm", RandomSounds.SONG_OF_THE_STROM_ZELDA).setUnlocalizedName("record_storm_zelda").setRegistryName("record_storm_zelda");
	// ==== End of items ====
	
	
	@SubscribeEvent
	public static void registerItems(RegistryEvent.Register<Item> event){
		event.getRegistry().register(RECORD_ZELDA_STORM);
		
	}
	
	@SubscribeEvent
	public static void registerModels(ModelRegistryEvent event){
		registerItemModel(RECORD_ZELDA_STORM);
	}
	
	
	private static void registerItemModel(Item item){
		ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
	}
	
}

 

RandomSounds.java

package smyler.random.sound;

import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import smyler.random.RandomMod;

@Mod.EventBusSubscriber
public class RandomSounds {
	
	// ==== The sounds ====
	public static SoundEvent SONG_OF_THE_STROM_ZELDA = new SoundEvent(new ResourceLocation(RandomMod.MOD_ID, "songofstormzelda")).setRegistryName("songofstormzelda");
	// ==== End of sounds ====
	
	@SubscribeEvent
	public static void registerSounds(RegistryEvent.Register<SoundEvent> event){
		event.getRegistry().register(RandomSounds.SONG_OF_THE_STROM_ZELDA);
	}
	
	
}

 

Thanks in advance.

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.