Jump to content

Recommended Posts

Posted

Hi, so I attempted to make a custom music disc, but whenever I attempt to play the disc I always get the error "Unable to play unknown soundEvent: cm:music/Peacock.ogg". I keep the song in assets.cm.music How can I fix this?

 

Music Disc Code

 

package com.crystal.item;

 

import net.minecraft.item.ItemRecord;

import net.minecraft.util.ResourceLocation;

 

import com.crystal.creativetab.CreativeTabsManager;

import com.crystal.lib.StringLibrary;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class RecordPeacock extends ItemRecord {

 

private String setRecordName;

protected RecordPeacock(String p_i45350_1_) {

super(p_i45350_1_);

// TODO Auto-generated constructor stub

}

{

this.setRecordName = "Peacock";

this.maxStackSize = 1;

this.setCreativeTab(CreativeTabsManager.tabI);

this.setUnlocalizedName("Peacock");

}

@SideOnly(Side.CLIENT)

    public String getRecordTitle()

    {

        return "7 Minutes Dead - " + this.recordName;

    }

@Override

public ResourceLocation getRecordResource(String name)

{

return new ResourceLocation(StringLibrary.MODID + ":music/Peacock.ogg");

}

}

 

 

Posted

I made the sounds.json, but I am still getting the same error. Did I make it wrong?

sounds.json

 

{

"records.peacock": {

    "category": "record",

    "sounds": [

      "cm:music/Peacock",

      "stream": true

    ]

  }

 

Posted

what exactly do you mean by the resource domain? I thought you were just supposed to add the path to the song.

IIRC, domain is the part of a resource location string preceding the colon. In general, a fully qualified resource location is <domain>:<path within domain>. Resource domain (in this case) is "cm" (and then you need a colon). It's an important part of mod terminology, so remember the concept for all resources in all mods.

 

It can be confusing, figuring out what is needed where. In context, you might need only a path within domain (just the path, or even just a filename), because other parts of the resource location are known. It appears that there is no such context for this file, so the full resource location string would be required.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.