well, actually the mod is not mine, I just help the creator, and he has the sounds.json file in 1 line per music:
"records.Birth by Sleep -A Link to the Future-": {"category": "record", "sounds": [{"name": "records/Birth by Sleep -A Link to the Future-", "stream": "true"}]},
It doesn't matter how many lines the file is in, all it does is make it more organised. I'll even try using a 25 minute long file to see if theres any lag spikes with my format.
Edit: Just tried it and no obnoxious lag spikes. And no I do not have some fancy gaming computer.
If you are probably on this thread you want to add a custom music disc to your mod. I'll Cut to the chase.
What you need:
A Main Class
A sounds.json
A sound or song you would like.
A texture for the disc
What you need to know:
How to create an Item
How the sound.json works
how to register sounds with the sounds.json
And thats all.
If you don't know how to register a sound, There are many great tutorials online, I prefer Nealegamings, they are simple and sometimes funny.
register your sound. If you don't know, look up a tutorial.
you should name it "records.Kitten"
or whatever kind of Music "records.HipHop"
make sure you already have
public static record_Kitten;
put this line of code in your Pre Init.
know we go back to the error on Music Disc. whe create an new class. heres what you put inside it.
we will start from top to bottom.
public class MusicDisc extends ItemRecord
basicaly fills in all the extra code from ItemRecord that we don't manually want to add.
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("dragonborn:" + "record_" + recordName);
}
this means that you will need to name your record's Texture record_Kitten, or record_HipHop, depending on what you used.
@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;
}
this is basically all the code for using the disc on the jukebox.
@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");
}
these two work on the NBT tags. so in your en_US, you will have to register both:
item.record_Kitten.name=Music Disc
item.record_Kitten.desc=Ramin Djawadi - Game of Thrones: Main Title
@Override
public EnumRarity getRarity(ItemStack itemStack)
{
return EnumRarity.rare;
}
this one Basically makes the name of the Item Blue, like most music discs.
public static MusicDisc getRecord(String par0Str)
{
return (MusicDisc)records.get(par0Str);
}
gets the sound.
@Override
public ResourceLocation getRecordResource(String name)
{
return new ResourceLocation("Dragonborn:" + name);
}
}
finds the sound. if you registered your sound like record.Kitten or record.HipHop, this will work perfectly.
Turn "Stream" to True in your sounds.json!
your record should work perfectly now! Go and enjoy!
note:
1.If you have a long sound, You may get a lagspike when you use your music disc. I am currently trying to fix this.
If you liked this tutorial, please press the arrow button on the bottom.
thanks for reading!
no, I have been trying to find one but I think it is just a problem with minecraft itself.
In sounds.json, change "stream" to true.
Monoblocks and Vehicular Movement: The greatest additions to a modern Minecraft city. Grab them here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2236322-goldensilver853s-mod-hub
You are now breathing manually.
I will ad this to the tutorial soon!
Monoblocks and Vehicular Movement: The greatest additions to a modern Minecraft city. Grab them here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2236322-goldensilver853s-mod-hub
You are now breathing manually.
Hmm, that's weird. I made pretty much this mod a couple weeks ago and it doesn't cause massive lag spikes for me.
This is mine in case you'd like to see. https://github.com/goldensilver853/Additional-Records/blob/master/src/main/resources/assets/records/sounds.json
Edit: I noticed yours was set to "true" and mine is just true. Try that.
Monoblocks and Vehicular Movement: The greatest additions to a modern Minecraft city. Grab them here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2236322-goldensilver853s-mod-hub
You are now breathing manually.
"records.Birth by Sleep -A Link to the Future-": {"category": "record", "sounds": [{"name": "records/Birth by Sleep -A Link to the Future-", "stream": "true"}]},
Edit: Just tried it and no obnoxious lag spikes. And no I do not have some fancy gaming computer.
Monoblocks and Vehicular Movement: The greatest additions to a modern Minecraft city. Grab them here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2236322-goldensilver853s-mod-hub
You are now breathing manually.
Monoblocks and Vehicular Movement: The greatest additions to a modern Minecraft city. Grab them here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2236322-goldensilver853s-mod-hub
You are now breathing manually.
https://github.com/Wehavecookies56/Kingdom-Keys-1.7-/blob/master/resources/assets/kk/sounds.json
Monoblocks and Vehicular Movement: The greatest additions to a modern Minecraft city. Grab them here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2236322-goldensilver853s-mod-hub
You are now breathing manually.
It works Thank you a lot.
Monoblocks and Vehicular Movement: The greatest additions to a modern Minecraft city. Grab them here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2236322-goldensilver853s-mod-hub
You are now breathing manually.
Thank you.
this should work. he made it so that his custom mob made noises, but you can register all sounds the same.
Modid
Monoblocks and Vehicular Movement: The greatest additions to a modern Minecraft city. Grab them here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2236322-goldensilver853s-mod-hub
You are now breathing manually.