Thecheatgamer1 Posted June 20, 2013 Posted June 20, 2013 Well this is my mod Items class package com.Thecheatgamer1.Annom.Item; import com.Thecheatgamer1.Annom.Lib.ItemIds; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class ModItems { /* Mod item instances */ public static Item ItemFusionIngot; public static Item ItemIredantCrystal; public static Item ItemKI87ElementIngot; public static Item ItemHappyDaysMusicDisk; public static void init() { /* Initialize each mod item individually */ ItemFusionIngot = new ItemFusionIngot(ItemIds.ITEMFUSIONINGOT); ItemIredantCrystal = new ItemIredantCrystal(ItemIds.ITEMIREDANTCRYSTAL); ItemKI87ElementIngot = new ItemKi87ElementIngot(ItemIds.ITEMKI87ELEMENT); ItemHappyDaysMusicDisk = new ItemHappyDaysMusicDisk(ItemIds.ITEMHAPPYDAYSMUSICDISK); LanguageRegistry.addName(ItemFusionIngot, "Fusion Ingot"); LanguageRegistry.addName(ItemIredantCrystal, "Iredant Crystal"); LanguageRegistry.addName(ItemKI87ElementIngot, "Ki87Element Ingot"); LanguageRegistry.addName(ItemHappyDaysMusicDisk, "HappyDays Music Disk"); GameRegistry.addRecipe(new ItemStack(ItemIredantCrystal), new Object[] { "aaa", "aba", "aaa", Character.valueOf('a'), ItemFusionIngot, Character.valueOf('b'), ItemKI87ElementIngot }); } } This is my HappydaysMusic Disk class package com.Thecheatgamer1.Annom.Item; import com.Thecheatgamer1.Annom.Annom.Annom; import com.Thecheatgamer1.Annom.Lib.Sounds; import com.Thecheatgamer1.Annom.Lib.Textures; import net.minecraft.block.Block; import net.minecraft.block.BlockJukeBox; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemHappyDaysMusicDisk extends ItemRecord { public final String recordName; public ItemHappyDaysMusicDisk(int id) { super(id, "HappyDays"); this.setCreativeTab(Annom.tabsAnnom); this.maxStackSize = 1; this.recordName = "HappyDays"; } public String getSoundFile() { return Sounds.HAPPYDAYS; } public String getTextureFile() { return Textures.ITEMHAPPYDAYSMUSICDISK; } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par3World.getBlockId(par4, par5, par6) == Block.jukebox.blockID && par3World.getBlockMetadata(par4, par5, par6) == 0) { if (par3World.isRemote) { return true; } else { ((BlockJukeBox)Block.jukebox).insertRecord(par3World, par4, par5, par6, par1ItemStack); par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, this.itemID); --par1ItemStack.stackSize; return true; } } else { return false; } } } This is my SoundHandler class package com.Thecheatgamer1.Annom.Client.Audio; import java.util.logging.Level; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; import com.Thecheatgamer1.Annom.Core.Util.LogHelper; import com.Thecheatgamer1.Annom.Lib.Sounds; public class SoundHandler { @ForgeSubscribe public void onSoundLoad(SoundLoadEvent event) { // For each custom sound file we have defined in Sounds for (String soundFile : Sounds.soundFiles) { // Try to add the custom sound file to the pool of sounds try { event.manager.soundPoolSounds.addSound(soundFile, this.getClass().getResource("/" + soundFile)); } // If we cannot add the custom sound file to the pool, log the exception catch (Exception e) { LogHelper.log(Level.WARNING, "Failed loading sound file: " + soundFile); } } } } And this is my ClientProxy class package com.Thecheatgamer1.Annom.Core.Proxy; import com.Thecheatgamer1.Annom.Client.Audio.SoundHandler; import net.minecraftforge.common.MinecraftForge; public class ClientProxy extends CommonProxy { @Override public void registerSoundHandler() { MinecraftForge.EVENT_BUS.register(new SoundHandler()); } } And this is my CommonProxy Class package com.Thecheatgamer1.Annom.Core.Proxy; public class CommonProxy { public void registerRenderTickHandler() { } public void registerDrawBlockHighlightHandler() { } public void registerSoundHandler() { } public void initRenderingAndTextures() { } } The Disk Works fine, but the music its supposed to play isnt playing so can someone tell me how to fix it or what i have to add! Quote
Thecheatgamer1 Posted June 20, 2013 Author Posted June 20, 2013 I just tryed loads of fixes but none of them work! Quote
dude22072 Posted June 21, 2013 Posted June 21, 2013 Put this in ItemHappyDaysMusicDisk public String getSoundFile() { return "/resources/mod/streaming/FILENAME.ogg"; } Quote Legend of Zelda Mod[updated September 20th to 3.1.1] Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0] Fancy Cheeses[updated May 8th to 0.5.0]
Thecheatgamer1 Posted June 21, 2013 Author Posted June 21, 2013 Put this in ItemHappyDaysMusicDisk public String getSoundFile() { return "/resources/mod/streaming/FILENAME.ogg"; } Added and not working, sound is not playing at all! Quote
dude22072 Posted June 21, 2013 Posted June 21, 2013 Put this in ItemHappyDaysMusicDisk public String getSoundFile() { return "/resources/mod/streaming/FILENAME.ogg"; } Added and not working, sound is not playing at all! Did you change the return to where your ogg file is located? Quote Legend of Zelda Mod[updated September 20th to 3.1.1] Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0] Fancy Cheeses[updated May 8th to 0.5.0]
Thecheatgamer1 Posted June 21, 2013 Author Posted June 21, 2013 Put this in ItemHappyDaysMusicDisk public String getSoundFile() { return "/resources/mod/streaming/FILENAME.ogg"; } Added and not working, sound is not playing at all! Did you change the return to where your ogg file is located? Yes, i even tryed connecting it to my Sounds.java class what is supposed to direct all sounds Quote
dude22072 Posted June 21, 2013 Posted June 21, 2013 can i see what you put? Quote Legend of Zelda Mod[updated September 20th to 3.1.1] Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0] Fancy Cheeses[updated May 8th to 0.5.0]
Thecheatgamer1 Posted June 21, 2013 Author Posted June 21, 2013 can i see what you put? public class ItemHappyDaysMusicDisk extends ItemRecord { public final String recordName; public ItemHappyDaysMusicDisk(int id) { super(id, "HappyDays"); this.setCreativeTab(Annom.tabsAnnom); this.maxStackSize = 1; this.recordName = "HappyDays"; } public String getSoundFile() { return "/resources/mod/Annom/Sound/HappyDyas.ogg"; } Quote
Chibill Posted June 23, 2013 Posted June 23, 2013 You put happydyas.ogg don't you want happydays.ogg? Quote
coolboy4531 Posted June 24, 2013 Posted June 24, 2013 This is what I use. Main Class: public Item music1; music1 = new ItemRecordMusic(11111, "musicone").setCreativeTab(CreativeTabs.tabMisc).setUnlocalizedName("musicDiskOne"); //The first box is for item ID, and the second box is for file name. //The file would be located in: \resources\mod\streaming\musicone.ogg ItemRecordMusic package com.musicraft.main; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockJukeBox; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemRecordMusic extends ItemRecord { public final String recordName; public ItemRecordMusic(int par1, String par2Str) { super(par1, par2Str); this.recordName = par2Str; this.maxStackSize = 1; this.setCreativeTab(CreativeTabs.tabMisc); } public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par3World.getBlockId(par4, par5, par6) == Block.jukebox.blockID && par3World.getBlockMetadata(par4, par5, par6) == 0) { if (par3World.isRemote) { return true; } else { ((BlockJukeBox)Block.jukebox).insertRecord(par3World, par4, par5, par6, par1ItemStack); par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, this.itemID); --par1ItemStack.stackSize; return true; } } else { return false; } } @SideOnly(Side.CLIENT) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { if (this.recordName == "musicone") { par3List.add("HappyDays - " + this.recordName); } } @SideOnly(Side.CLIENT) @Override public void updateIcons(IconRegister par1IconRegister) { this.iconIndex = par1IconRegister.registerIcon(this.recordName); } @Override public String getRecordTitle() { return "HappyDays"; } } Some fields, you might have to change by yourself, but this is what I use, and it works fine. Remember that the file needs to be in OGG format! Quote
Thecheatgamer1 Posted June 24, 2013 Author Posted June 24, 2013 This is what I use. Main Class: public Item music1; music1 = new ItemRecordMusic(11111, "musicone").setCreativeTab(CreativeTabs.tabMisc).setUnlocalizedName("musicDiskOne"); //The first box is for item ID, and the second box is for file name. //The file would be located in: \resources\mod\streaming\musicone.ogg ItemRecordMusic package com.musicraft.main; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockJukeBox; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemRecordMusic extends ItemRecord { public final String recordName; public ItemRecordMusic(int par1, String par2Str) { super(par1, par2Str); this.recordName = par2Str; this.maxStackSize = 1; this.setCreativeTab(CreativeTabs.tabMisc); } public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par3World.getBlockId(par4, par5, par6) == Block.jukebox.blockID && par3World.getBlockMetadata(par4, par5, par6) == 0) { if (par3World.isRemote) { return true; } else { ((BlockJukeBox)Block.jukebox).insertRecord(par3World, par4, par5, par6, par1ItemStack); par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, this.itemID); --par1ItemStack.stackSize; return true; } } else { return false; } } @SideOnly(Side.CLIENT) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { if (this.recordName == "musicone") { par3List.add("HappyDays - " + this.recordName); } } @SideOnly(Side.CLIENT) @Override public void updateIcons(IconRegister par1IconRegister) { this.iconIndex = par1IconRegister.registerIcon(this.recordName); } @Override public String getRecordTitle() { return "HappyDays"; } } Some fields, you might have to change by yourself, but this is what I use, and it works fine. Remember that the file needs to be in OGG format! Still not working Quote
Recommended Posts
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.