Jump to content

1.7.10 Music disk event problem.


BottleFact

Recommended Posts

I get the following message when I put in the disc:

[10:47:37] [Client thread/WARN]: Unable to play empty soundEvent: starfield:Bliss

 

I have the file set up correctly I believe, but I'm not sure about the class and sounds.json.

 

sounds.json is in assets/starfield. The ogg file is in assets/starfield/records

 

sounds.json:

{
"Bliss": {"category": "master","records": [{"name": "Bliss","stream": true}]}
}

 

MusicDisc.class:

package sqm.minecraft.starfield.items;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import sqm.minecraft.starfield.common.Starfield;
import net.minecraft.block.BlockJukebox;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

public class MusicDisc extends ItemRecord
{
private static final Map records = new HashMap();


public final String recordName;


public MusicDisc(String recordName)
{
super(recordName);


this.recordName = recordName;
this.maxStackSize = 1;




records.put(recordName, this);
}


@Override
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon(Starfield.MODID + ":" + "record_" + recordName);
}


@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
{
//TODO: world.getBlock()
if (world.getBlock(x, y, z) == Blocks.jukebox && world.getBlockMetadata(x, y, z) == 0)
{
if (world.isRemote)
return true;
else
{
//TODO: .insertRecord()
((BlockJukebox)Blocks.jukebox).func_149926_b(world, x, y, z, itemStack);
//TODO: Item.getIdFromItem()
world.playAuxSFXAtEntity((EntityPlayer)null, 1005, x, y, z, Item.getIdFromItem(this));
--itemStack.stackSize;
return true;
}
} 
else
return false;
}


@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add(this.getRecordNameLocal());
}


@Override
//TODO: getRecordTitle()
public String getRecordNameLocal()
{
return StatCollector.translateToLocal(this.getUnlocalizedName() + ".desc");
}


@Override
public EnumRarity getRarity(ItemStack itemStack)
{
return EnumRarity.rare;
}


public static MusicDisc getRecord(String par0Str)
{
return (MusicDisc)records.get(par0Str);
}


@Override
public ResourceLocation getRecordResource(String name)
{
return new ResourceLocation("starfield:"+this.recordName);
}
}

Creator of the Starfield Mod.

Link to comment
Share on other sites

my first advice in use all lowercase for filenames, disk names mod id etc. only use uppercase in the lang file as translated text

 

these are sections of my records mod (no ogg files provided)

the main class of the mod is LoonRecords

 

definition of LoonRecords.modid

public static final String modid="loonrecords";

 

public static ItemGoldRecord diskadeline=new ItemGoldRecord("adeline");

// called during FMLPreInitializationEvent
GameRegistry.registerItem(diskadeline, "record_adeline");

 

here is the ItemGoldRecord class

import java.util.ArrayList;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;

public class ItemGoldRecord extends ItemRecord {
public static ArrayList<ItemGoldRecord> list=new ArrayList<ItemGoldRecord>();
private String recordname;

protected ItemGoldRecord(String name) {
	super(name);
	list.add(this);
	setUnlocalizedName("record");
	setTextureName("record_"+name);
	setCreativeTab(CreativeTabs.tabMisc);
	recordname=name;
}

@Override
public ResourceLocation getRecordResource(String arg0) {
	ResourceLocation r=super.getRecordResource(LoonRecords.modid+":"+arg0);
	return r;
}

@Override
public void registerIcons(IIconRegister reg) {
	itemIcon=reg.registerIcon(LoonRecords.modid+":record_"+recordname);
}

@Override
public String getUnlocalizedName() {
	return "record."+recordname;
}

@Override
public String getUnlocalizedName(ItemStack arg0) {
	return getUnlocalizedName();
}
}

this class keeps a list of all records added with it (i use the list for the villager that sells them in my mod)

 

 

thats the code side of it , you will notice all text is lowercase

 

in  resources  assetts.loonrecords sounds.json file

{
  "records.adeline": {
    "category": "record",
    "sounds": [
      {
        "name": "records/adeline",
        "stream": true
      }
    ]
  },

this file needs to be carefully written,

to add more records repeat all but the first "{"

when finished remove the lase "," and put a "}" on the last line

use spaces not tabs

 

 

 

in  resources  assetts.loonrecords.lang in en_US.lang file

record.adeline.name=Music Disk Adeline
item.record.adeline.desc=Balad for Adeline

 

in  resources  assetts.loonrecords.sounds.records is the adaline.oog  file

 

 

hope this helps

 

Link to comment
Share on other sites

  • 3 months later...

Sorry for my English I'm using google translator

 

When I put the disc in the jukebox music does not sound.

 

On the console:

 

[23:59:23] [thread Client / WARN]: Unable to play unknown SoundEvent: mineprueba: records.adeline

Link to comment
Share on other sites

I would :

 

1) change record name Bliss to lower case bliss;

2) change your sounds json to read : records.bliss instead of Bliss;  change the Bliss after name to bliss;

3) delete the "+record_  from the itemIcon method;

4) in the resource location method change this.recordName to just name;

5) move the record to new package assets.starfield.sounds.

 

That will work for you.  I know it does because I typed it all in my mod like that to test it and it works.

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

    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • OLXTOTO adalah situs bandar togel online resmi terbesar dan terpercaya di Indonesia. Bergabunglah dengan OLXTOTO dan nikmati pengalaman bermain togel yang aman dan terjamin. Koleksi toto 4D dan togel toto terlengkap di OLXTOTO membuat para member memiliki pilihan taruhan yang lebih banyak. Sebagai situs togel terpercaya, OLXTOTO menjaga keamanan dan kenyamanan para membernya dengan sistem keamanan terbaik dan enkripsi data. Transaksi yang cepat, aman, dan terpercaya merupakan jaminan dari OLXTOTO. Nikmati layanan situs toto terbaik dari OLXTOTO dengan tampilan yang user-friendly dan mudah digunakan. Layanan pelanggan tersedia 24/7 untuk membantu para member. Bergabunglah dengan OLXTOTO sekarang untuk merasakan pengalaman bermain togel yang menyenangkan dan menguntungkan.
    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
  • Topics

×
×
  • Create New...

Important Information

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