Jump to content

Music Disk Not Playing Music! Sounds Not loading i think !


Thecheatgamer1

Recommended Posts

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!

Link to comment
Share on other sites

Put this in ItemHappyDaysMusicDisk

public String getSoundFile()
    {
            return "/resources/mod/streaming/FILENAME.ogg";
    }

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]

Link to comment
Share on other sites

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?

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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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";

        }

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • no this one https://pastebin.com/5uMxHeWf
    • I am in such a mess. I have lost over 4.7m due to a scammer... It started as bank wires and then bitcoin. it is hard to imagine but it is true and can send any proof, then I tried to use a couple of recovery companies and was as well. Graphic design has been more than just a hobby for me since high school—it has become a thriving career. Starting in my parents' garage, I eventually expanded to my office, running a successful graphic design business. However, like many, I faced the need to diversify my investments due to inflation. This led me to invest 60.16 in Bitcoin, a decision that paid off handsomely as my investment grew to 4.7m over time. This financial windfall allowed me to upgrade my equipment and take on more ambitious projects, furthering the growth of my business. Unfortunately, my excitement was abruptly cut short when I fell victim to a hacking incident. Malware infected my computer, giving hackers access to my Bitcoin wallet. The devastation of potentially losing all my hard-earned savings and plans weighed heavily on me. At this dire moment, a fellow designer suggested Linux Cyber Security Company as a potential solution. Desperate for a lifeline, I reached out to them, hoping for a miracle. The response from Linux Cyber Security Company was prompt, incredibly professional, and effective. Their team quickly traced the hacker’s activities and recovered most of my funds, alleviating a significant amount of stress and uncertainty. Beyond the recovery, they took the time to educate me on essential practices to secure my Bitcoin holdings better. They emphasized using antivirus software to prevent malware infections, avoiding suspicious downloads, and the added security provided by hardware wallets. This experience served as a critical wake-up call for me. It highlighted the vulnerabilities inherent in digital assets and underscored the importance of robust security measures. Thanks to the guidance and expertise of Linux Cyber Security Company, I now feel more equipped to protect my digital assets proactively. Their insights have empowered me to implement stronger security protocols in my business operations and personal finances alike. With my Bitcoin funds securely recovered and a newfound understanding of digital security best practices, I am more confident in navigating future challenges. This journey has reinforced my commitment to safeguarding my hard-earned assets and leveraging technology responsibly. I am optimistic about the growth opportunities ahead, creatively in graphic design and prudently in investment strategies. In conclusion, while the hacking incident was a setback, it ultimately became a catalyst for enhancing my digital security awareness and resilience. I am grateful to Linux Cyber Security Company for their expertise and support during a challenging time, enabling me to continue pursuing my passion for graphic design with renewed confidence and financial stability. Contact a professional company I am sure they can help you with your case too, Website [www.linuxcybersecurity.com Email the team; info@)(linuxcybersecurity.com
    • https://pastebin.com/B2HnBZTa
    • it was easy villager mate, thanks ill see how to do it without that mod! thanks
  • Topics

×
×
  • Create New...

Important Information

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