Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

}

}

 

 

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.