Jump to content

Recommended Posts

Posted

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

}

}

 

 

Posted

As far as I have heard on twitter and here, the system ain't working as intended yet.

I'd wait for the next recommended update before trying to make everything work ;)

If you guys dont get it.. then well ya.. try harder...

Posted

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

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



×
×
  • Create New...

Important Information

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