Jump to content

Music Disc Issue [1.10/11.2]


turbodiesel4598

Recommended Posts

Hi there,

 

I'm trying to add a couple of music discs to the game - the general idea is to just extend the ItemRecord class and register instances. My discs are in the game, and can be inserted into jukeboxes, but their associated music does not play. Another hint that there is something wrong is that the name of the song does not appear above the hotbar as one would usually expect. Other sounds in the mod do work, by the way. I have probably just misinterpreted and misused some of the methods - here are the relevant classes and files:

 

NCItemRecord:

public class NCItemRecord extends ItemRecord {
	
	public final String[] info;
	private final String music;
	private final String name;
	
	public NCItemRecord(String unlocalizedName, String registryName, SoundEvent sound, Object... tooltip) {
		super("record_" + unlocalizedName, sound);
		name = unlocalizedName;
		setUnlocalizedName("record_" + unlocalizedName);
		setRegistryName(new ResourceLocation(Global.MOD_ID, "record_" + registryName));
		music = Global.MOD_ID + ":music." + unlocalizedName;
		
		if (tooltip.length == 0) {
			String[] strings = {};
			info = strings;
		} else if (tooltip[0] instanceof String) {
			String[] strings = new String[tooltip.length];
			for (int i = 0; i < tooltip.length; i++) {
				strings[i] = (String) tooltip[i];
			}
			info = strings;
		} else if (tooltip[0] instanceof Integer) {
			String[] strings = new String[(int) tooltip[0]];
			for (int i = 0; i < (int) tooltip[0]; i++) {
				strings[i] = I18n.translateToLocalFormatted("item." + "record_" + unlocalizedName + ".des" + i);
			}
			info = strings;
		} else {
			String[] strings = {};
			info = strings;
		}
	}
	
	public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> tooltip, boolean advanced) {
		//super.addInformation(itemStack, player, tooltip, advanced);
		if (info.length > 0) NCInfo.infoFull(tooltip, info);
	}

	public ResourceLocation getRecordResource(String name) {
		return new ResourceLocation(Global.MOD_ID, "music." + name);
	}

	public EnumRarity getRarity(ItemStack stack) {
		return EnumRarity.EPIC;
	}
	
	@SideOnly(Side.CLIENT)
	public String getRecordNameLocal() {
		return I18n.translateToLocal("item.record_" + name + ".des0");
	}
}

 

Relevent part of registering:

public static Item record_wanderer;
public static Item record_end_of_the_world;
.
.
.
record_wanderer = new NCItemRecord("wanderer", "wanderer", SoundHandler.WANDERER, 2);
record_end_of_the_world = new NCItemRecord("end_of_the_world", "end_of_the_world", SoundHandler.END_OF_THE_WORLD, 2);
.
.
.
registerItem(record_wanderer, CommonProxy.TAB_MISC);
registerItem(record_end_of_the_world, CommonProxy.TAB_MISC);
.
.
.
registerRender(record_wanderer);
registerRender(record_end_of_the_world);

 

SoundHandler:

public class SoundHandler {
	
	private static int size = 0;
	
	public static SoundEvent FUSION_RUN;
	public static final int FUSION_RUN_TIME = 67;
	
	public static SoundEvent ACCELERATOR_RUN;
	public static final int ACCELERATOR_RUN_TIME = 67;
	
	public static SoundEvent WANDERER;
	public static SoundEvent END_OF_THE_WORLD;
	
	public static void init() {
		size = SoundEvent.REGISTRY.getKeys().size();
		
		FUSION_RUN = register("block.fusion_run");
		ACCELERATOR_RUN = register("block.accelerator_run");
		WANDERER = register("music.wanderer");
		END_OF_THE_WORLD = register("music.end_of_the_world");
	}
	
	public static SoundEvent register(String name) {
		ResourceLocation location = new ResourceLocation(Global.MOD_ID, name);
		SoundEvent event = new SoundEvent(location);
		
		SoundEvent.REGISTRY.register(size, location, event);
		size++;
		NCUtil.getLogger().info("Registered sound " + name);
		return event;
	}
}

 

sounds.json:

{
	"block.fusion_run": {
		"category": "block",
		"subtitle": "block.fusion_run",
		"sounds": [ { "name": "nuclearcraft:block/fusion_run", "stream": false } ]
	},
	"block.accelerator_run": {
		"category": "block",
		"subtitle": "block.accelerator_run",
		"sounds": [ { "name": "nuclearcraft:block/accelerator_run", "stream": false } ]
	},
	"music.wanderer": {
		"category": "record",
		"subtitle": "music.wanderer",
		"sounds": [ { "name": "nuclearcraft:music/wanderer", "stream": true } ]
	},
	"music.end_of_the_world": {
		"category": "record",
		"subtitle": "music.end_of_the_world",
		"sounds": [ { "name": "nuclearcraft:music/end_of_the_world", "stream": true } ]
	}
}

 

Thanks in advance :)

Edited by turbodiesel4598
Link to comment
Share on other sites

  • Did not know that, but I guess that's good practise if you want to minimise conflits, right? Probably a good idea then.
  • Yeh, it's not great, but the reason it's there is because I just copied it over from my base item class so that I could use the same naming system for the discs (because obviously I can't extent my base class in this case). I'll clean it up at some point. Are you saying it will crash when the language is changed? Because I haven't had any reports of it just crashing servers yet.
  • Yeh, I need to - I know it's bad pracice, and I just keep forgetting.
  • I'll get rid of it.

 

  • No errors show up when I insert the disc. Essentialy, nothing happens. The disc goes in and... silence. I tried using other sound files I know play correctly, and they didn't play either, and I also temporarily swapped out the standard furnace sound effect for the record music, and it did play, so I'm pretty sure that the issue is specifically with the music disc item, but I just don't know where the issue is - I even looked up other mods' classes (Botania and BoP), and they do nothing discernibly different, yet theirs seem to behave.

 

EDIT: Found the issue - I was registering my sounds after my items. The problem has now gone - thanks for the help.

Edited by turbodiesel4598
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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Does it work without natures_spirit and/or spectrum / adventurez?
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system
    • (i originally submitted this report to CurseForge but since we localized the issue to the modloader they pointed us here)  I am the partner of the user, GalaxyReach, assisting them as they are not as tech savvy. We have spent days troubleshooting a very weird issue that none of our other friends have with a certain modloader.  On a curse-forge launched instance of the Minecraft Launcher, clicking "play" throws an error code 1: crash log says EXCEPTION_ACCESS_VIOLATION. This exception happens in a blank, no-mods test pack as well as manually installing Forge. This issue also happens on NeoForge. We tried All of the steps withing this guide: https://support.curseforge.com/en/support/solutions/articles/9000218027-issues-related-to-the-forge-modloader namely: reinstalling the modpack reinstalling minecraft & curseforge deleting curseforge appdata updating the drivers updating the firewall the computer has been restarted several times we have tried running it on different networks manually installing & selecting java manually installing forge I don't think it is a specs/hardware issue, its a pretty good laptop (HP Omen), 16GB RAM & a 3060. It runs windows 11. Further, launching minecraft like normal through the Microsoft Store runs the game just fine. It is solely with trying to use a modded launch with Forge & NeoForge. I also tried different versions of Forge, though the specific instance I am trying to get running is 47.3.0 Is there anything else we can do here or does Forge just truly not work on this laptop?   Thank you MINECRAFT LAUNCHER GAME OUTPUT LOG 10:07:33.755 launcher main Version does not support log configuration, will assume one plaintext entry per line 10:07:36.419 game 2024-08-31 10:07:36,408 main WARN Advanced terminal features are not available in this environment 10:07:36.586 game [10:07:36] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, GalaxyReach, --version, forge-47.3.0, --gameDir, C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server, --assetsDir, C:\Users\Micha\curseforge\minecraft\Install\assets, --assetIndex, 5, --uuid, 7f099235327e4206afdfbc22c7712328, --accessToken, ????????, --clientId, OWEyZTE3Y2MtOTZiOC00MWMwLWFkZjYtNmY2MDU2NmIxNDAz, --xuid, 2535442900827884, --userType, msa, --versionType, release, --width, 854, --height, 480, --quickPlayPath, C:\Users\Micha\curseforge\minecraft\Install\quickPlay\java\1725124053749.json, --launchTarget, forgeclient, --fml.forgeVersion, 47.3.0, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] 10:07:36.593 game [10:07:36] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.11 by Oracle Corporation; OS Windows 11 arch amd64 version 10.0 10:07:37.363 game [10:07:37] [main/INFO] [ne.mi.fm.lo.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow 10:07:37.452 game [10:07:37] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6 10:07:37.503 game # 10:07:37.503 game # A fatal error has been detected by the Java Runtime Environment: 10:07:37.503 game # 10:07:37.503 game # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff8a76f59f0, pid=13980, tid=12732 10:07:37.503 game # 10:07:37.503 game # JRE version: Java(TM) SE Runtime Environment (17.0.11+7) (build 17.0.11+7-LTS-207) 10:07:37.503 game # Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.11+7-LTS-207, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64) 10:07:37.503 game # Problematic frame: 10:07:37.506 game # C [atio6axx.dll+0x1759f0] 10:07:37.507 game # 10:07:37.507 game # No core dump will be written. Minidumps are not enabled by default on client versions of Windows 10:07:37.507 game #   Debug txt:  [31Aug2024 10:07:36.584] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, GalaxyReach, --version, forge-47.3.0, --gameDir, C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server, --assetsDir, C:\Users\Micha\curseforge\minecraft\Install\assets, --assetIndex, 5, --uuid, 7f099235327e4206afdfbc22c7712328, --accessToken, ????????, --clientId, OWEyZTE3Y2MtOTZiOC00MWMwLWFkZjYtNmY2MDU2NmIxNDAz, --xuid, 2535442900827884, --userType, msa, --versionType, release, --width, 854, --height, 480, --quickPlayPath, C:\Users\Micha\curseforge\minecraft\Install\quickPlay\java\1725124053749.json, --launchTarget, forgeclient, --fml.forgeVersion, 47.3.0, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] [31Aug2024 10:07:36.592] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.11 by Oracle Corporation; OS Windows 11 arch amd64 version 10.0 [31Aug2024 10:07:36.640] [main/DEBUG] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Found launch services [fmlclientdev,forgeclient,minecraft,forgegametestserverdev,fmlserveruserdev,fmlclient,fmldatauserdev,forgeserverdev,forgeserveruserdev,forgeclientdev,forgeclientuserdev,forgeserver,forgedatadev,fmlserver,fmlclientuserdev,fmlserverdev,forgedatauserdev,testharness,forgegametestserveruserdev] [31Aug2024 10:07:36.648] [main/DEBUG] [cpw.mods.modlauncher.NameMappingServiceHandler/MODLAUNCHER]: Found naming services : [srgtomcp] [31Aug2024 10:07:36.664] [main/DEBUG] [cpw.mods.modlauncher.LaunchPluginHandler/MODLAUNCHER]: Found launch plugins: [mixin,eventbus,slf4jfixer,object_holder_definalize,runtime_enum_extender,capability_token_subclass,accesstransformer,runtimedistcleaner] [31Aug2024 10:07:36.672] [main/DEBUG] [cpw.mods.modlauncher.TransformationServicesHandler/MODLAUNCHER]: Discovering transformation services [31Aug2024 10:07:36.680] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path GAMEDIR is C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server [31Aug2024 10:07:36.680] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path MODSDIR is C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server\mods [31Aug2024 10:07:36.680] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path CONFIGDIR is C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server\config [31Aug2024 10:07:36.680] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path FMLCONFIG is C:\Users\Micha\curseforge\minecraft\Instances\Liminal Server\config\fml.toml [31Aug2024 10:07:37.354] [main/DEBUG] [cpw.mods.modlauncher.TransformationServicesHandler/MODLAUNCHER]: Found additional transformation services from discovery services: [31Aug2024 10:07:37.362] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow [31Aug2024 10:07:37.450] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6  
    • https://paste.gg/p/anonymous/248d684303f44baaa4ca3aa6fb214643
  • Topics

×
×
  • Create New...

Important Information

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