Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

1.6.1 sounds register, but wont play


GhostSnyperRecon
 Share

Recommended Posts

hey guys, im trying to get my custom sounds to play when i right click an item. when i right click it, i get no errors, but also no audio, can anyone help me out here?

 

my sound reg code

 

 

package naturemod.common.handlers;

 

import net.minecraft.client.audio.SoundManager;

import net.minecraftforge.client.event.sound.SoundLoadEvent;

import net.minecraftforge.event.ForgeSubscribe;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class EventSounds

 

{

@SideOnly(Side.CLIENT)

    @ForgeSubscribe

public void onSoundsLoaded(SoundLoadEvent event)

{

    SoundManager manager = event.manager;

        String [] soundFiles = {

                "rasta.wav"};

        for (int i = 0; i < soundFiles.length; i++){

          manager.soundPoolSounds.addSound("/assets/nature/resource/sound/" + soundFiles);

        }

}

}

 

 

 

 

my item code

 

 

package naturemod.common.items;

 

import java.util.List;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import naturemod.common.Nature;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.enchantment.Enchantment;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.EnumRarity;

import net.minecraft.item.EnumToolMaterial;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemTool;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.world.World;

 

public class ItemSpliff extends Item

{

    public ItemSpliff(int id)

    {

        super(id);

        maxStackSize = 1;

        this.setCreativeTab(Nature.natureTabItem);

    }

   

    @SideOnly(Side.CLIENT)

 

    /**

    * Returns True is the item is renderer in full 3D when hold.

    */

    public boolean isFull3D()

    {

        return true;

    }

 

    @SideOnly(Side.CLIENT)

 

    /**

    * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities

    * hands.

    */

    public boolean shouldRotateAroundWhenRendering()

    {

        return true;

    }

   

    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)

    {

    if (!par3EntityPlayer.capabilities.isCreativeMode)

        {

            --par1ItemStack.stackSize;

        }

    par2World.playSoundAtEntity(par3EntityPlayer, "rasta", 1F, 1F);

   

        if (!par2World.isRemote)

        {

        if(!this.isDamaged(par1ItemStack))

        {

        //par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.blindness.id, 600, 9));

        par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.confusion.id, 600, 9));

        //par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() + 1);

        }

    }

    return par1ItemStack;

    }

 

   

 

    public EnumRarity getRarity(ItemStack stack)

    {

                    return EnumRarity.epic;

    }

   

    public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)

    {

        par3List.add("\u00a77Good Times Guaranteed");

    }

 

   

@Override

@SideOnly(Side.CLIENT)

public void registerIcons(IconRegister par1IconRegister) {

        this.itemIcon = par1IconRegister.registerIcon("Nature:spliff");

}

}

 

 

Link to comment
Share on other sites

Anyone know if this lack of sound issue is fixed in latest forge yet? If so, what is the correct formatting for registering and playing sounds now that the URL parameter is dropped. Got my textures working, but still no sound effects  :(

 

UPDATE: Forge 784 is current recommended as of an hour ago

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
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hello, i've had this happen today with the appleskin mod particularly, i had been able to play without any major issues, however when i attempted to launch today, i keep getting the following error: "AppleSkin (appleskin) has failed to load correctly java.lang.reflect.InvocationTargetException: null" Here's a paste of the crash report And here's a paste of the latest log to be noted, my game has been extremely laggy and crashing quite often (although i assume its because of the mods, which are many, despite them being mostly QoL stuff)  any help would be welcome, thank you very much!
    • https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html *Solved* download the java se environment : )
    • Hello all! Title says it all, looking for help on how to downgrade my java version. Updated and now my minecraft server won't boot up correctky. Every download link I find it contains the most updated version, is there a way around this? Thanks for any help : )
    • how to deal it?  ---- Minecraft Crash Report ---- // I bet Cylons wouldn't have this problem. Time: 1/24/22 10:16 AM Description: FML will not run in demo mode java.lang.RuntimeException     at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:225)     at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:467)     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)     at net.minecraft.client.main.Main.main(SourceFile:123)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)     at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.12.2     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_51, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 708405712 bytes (675 MB) / 842006528 bytes (803 MB) up to 3817865216 bytes (3641 MB)     JVM Flags: 3 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx4096m -Xms256m     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0     FML:      Loaded coremods (and transformers):      GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 462.42' Renderer: 'GeForce GTX 1050 Ti/PCIe/SSE2'
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.