Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Sound Files
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
LurgyCoder

Sound Files

By LurgyCoder, April 22, 2014 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 22, 2014

Heylo!

 

I'm am working on a mod, and everything has been going great till I got to the sounds. I tried tutorials, and checked other posts. Please HELP ME!!! It's probably something stupid, but please find and fix it!

 

Mob file:

package Lurgypais.ModMud;

import net.minecraft.block.Block;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class EntityMudChucker extends EntityMob implements IRangedAttackMob
{
    public EntityMudChucker(World par1World)
    {
        super(par1World);
        this.getNavigator().setAvoidsWater(true);
        this.tasks.addTask(1, new EntityAIArrowAttack(this, 1.25D, 20, 10.0F));
        this.tasks.addTask(2, new EntityAIWander(this, 1.0D));
        this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
        this.tasks.addTask(4, new EntityAILookIdle(this));
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false));
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMudBlobTest.class, 0, false));
    }

    /**
     * Returns true if the newer Entity AI code should be run
     */
    public boolean isAIEnabled()
    {
        return true;
    }

    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(13.0D);
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.20000000298023224D);
    }

    /**
     * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
     * use this to react to sunlight and start to burn.
     */
    public void onLivingUpdate()
    {
        super.onLivingUpdate();

        if (this.isWet())
        {
            this.attackEntityFrom(DamageSource.drown, 1.0F);
        }

        int i = MathHelper.floor_double(this.posX);
        int j = MathHelper.floor_double(this.posZ);

        for (i = 0; i < 4; ++i)
        {
            j = MathHelper.floor_double(this.posX + (double)((float)(i % 2 * 2 - 1) * 0.25F));
            int k = MathHelper.floor_double(this.posY);
            int l = MathHelper.floor_double(this.posZ + (double)((float)(i / 2 % 2 * 2 - 1) * 0.25F));
        }
    }

    /**
     * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param
     * par2 - Level of Looting used to kill this mob.
     */
    protected void dropRareDrop(int par1)
    {
        this.entityDropItem(new ItemStack(ModMud.mud_golden.itemID, 1, 1), 0.0F);
    }
    
    protected String getHurtSound()
    {
        return "modmud:mud_chucker.hurt";
    }

    /**
     * Attack the specified entity using a ranged attack.
     */
    public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
    {
        EntityMud entitymud = new EntityMud(this.worldObj, this);
        double d0 = par1EntityLivingBase.posX - this.posX;
        double d1 = par1EntityLivingBase.posY + (double)par1EntityLivingBase.getEyeHeight() - 1.100000023841858D - entitymud.posY;
        double d2 = par1EntityLivingBase.posZ - this.posZ;
        float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2) * 0.2F;
        entitymud.setThrowableHeading(d0, d1 + (double)f1, d2, 1.6F, 12.0F);
        this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
        this.worldObj.spawnEntityInWorld(entitymud);
    }
}

 

Client Proxy:

 

package Lurgypais.ModMud;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ClientProxyModMud extends CommonProxyModMud
{
@Override
public void registerRenderThings()
    {
	RenderingRegistry.registerEntityRenderingHandler(EntityMudBlobTest.class, new MudBlobRenderer(new ModelMudBlob(), 0.5F));
	RenderingRegistry.registerEntityRenderingHandler(EntityMudChucker.class, new MudChuckerRenderer(new ModelMudChucker(), 0.5F));
	RenderingRegistry.registerEntityRenderingHandler(EntityMudBoss.class, new MudBossRenderer(new ModelMudBoss(), 0.5F));
	RenderingRegistry.registerEntityRenderingHandler(EntityMole.class, new MoleRenderer(new ModelMole(), 0.5F));
	RenderingRegistry.registerEntityRenderingHandler(EntityMudBunny.class, new MudBunnyRenderer(new ModelMudBunny(), 0.5F));
    }

@Override
public int addArmor(String armor)
{
return RenderingRegistry.addNewArmourRendererPrefix(armor);
}

@Override
public void registerRenderers()
{
	RenderingRegistry.registerEntityRenderingHandler(EntityMud.class, new RenderSnowball(ModMud.mud));
	RenderingRegistry.registerEntityRenderingHandler(EntityMudWarp.class, new RenderSnowball(Item.netherStar));
	RenderingRegistry.registerEntityRenderingHandler(EntityMudBossProjectile.class, new RenderSnowball(Item.appleRed));
	RenderingRegistry.registerEntityRenderingHandler(EntityMudBossProjectile2.class, new RenderSnowball(Item.appleGold));
	RenderingRegistry.registerEntityRenderingHandler(EntityMudBossEgg.class, new RenderSnowball(ModMud.mud_bossEgg));
}
@Override
public void registerSound()
{
	MinecraftForge.EVENT_BUS.register(new SoundEvent());
}
}

 

Sound Event:

 

package Lurgypais.ModMud;

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

public class SoundEvent
{
@ForgeSubscribe
    public void onSoundLoad(SoundLoadEvent event)
    {
	event.manager.addSound("modmud:mud_chucker/hurt.ogg");
    }
}

 

If you find the error, please explain why it's there. I wish to understand this. I am very new to modding, and use it to help me study Java.

 

If you find anything else to fix, and make better, tell me.

 

Thanks to all!!!

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 22, 2014

Oh, its 1.6.4 forge!

  • Quote

Share this post


Link to post
Share on other sites

coolAlias    745

coolAlias

coolAlias    745

  • Reality Controller
  • coolAlias
  • Members
  • 745
  • 2805 posts
Posted April 22, 2014

It looks to me like your slash is backwards, based on how texture paths and such are written.

 

Try: "modmud:mud_chucker\hurt.ogg"

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 22, 2014

now it has an error:

 

Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )

 

I use Eclipse

  • Quote

Share this post


Link to post
Share on other sites

coolAlias    745

coolAlias

coolAlias    745

  • Reality Controller
  • coolAlias
  • Members
  • 745
  • 2805 posts
Posted April 22, 2014

now it has an error:

 

Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )

 

I use Eclipse

Er, heh, totally derped on that one, sorry. Yeah, the slash was in the right direction originally.

 

Well, I don't know how to register sub-foldered sounds in 1.6.4, but in 1.7.2, I use the sound names without specifying directory (note that 1.7.2 doesn't register sounds, but I was using the same format in 1.6.4 without subfolders):

event.manager.addSound("modmud:hurt.ogg");
// use the same string for playing the sound

Sorry if that's a bit confusing. If that doesn't work, I suggest trying to get your sound to work just in the base "assets/modid/sounds/" directory first, and then go from there. I never used subfolders for my sounds in 1.6.4, but they worked fine using the exact same format as I showed above when I ported to 1.7.2 and DID put them in subfolders.

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 22, 2014

You see, I already had it just in the sound folder, but when it didn't work, tried putting it in a sub folder. I'll try what you said, than try without the subfolder again.

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 22, 2014

I tried and...

 

nothing. Well I gtg, back tomorrow

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 22, 2014

Can someone help me?

  • Quote

Share this post


Link to post
Share on other sites

GotoLink    381

GotoLink

GotoLink    381

  • World Shaper
  • GotoLink
  • Members
  • 381
  • 2012 posts
Posted April 22, 2014

I am not sure the underscore is going to work...but the file path should be:

assets/modmud/sound/mud_chucker/hurt.ogg

 

iirc, i used

@ForgeSubscribe
    public void onSoundLoad(SoundLoadEvent event)
    {
	event.manager.soundPoolSound.addSound("stuff");
}

Back in 1.6 days.

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 22, 2014

Thanks, I'll try it.

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 23, 2014

No luck...

I tried to install the latest forge 1.6to see if that would fix it, but after I finished, minecraft had errors...

  • Quote

Share this post


Link to post
Share on other sites

coolAlias    745

coolAlias

coolAlias    745

  • Reality Controller
  • coolAlias
  • Members
  • 745
  • 2805 posts
Posted April 23, 2014

We need more information to help you: what is your full file path to the sound? Do you get an error message in the console or a crash when you try to play the sound and it cannot be found, and what does that say? Are you using only one sound file, or are there multiple "hurt" sounds?

 

If you have multiple sound files named "hurt1.ogg", "hurt2.ogg", etc., you must add them all during the sound load event:

for (int i = 1; i <= number_of_sounds; ++i) {
event.manager.soundPoolSound.addSound("modmud:hurt" + i + ".ogg");
}

And play it normally, using "modmud.hurt" without any number on it.

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 23, 2014

its just hurt.ogg. Thats the only file I have

The full path is:

forge/mcp/src/assets/modmud/mud_chucker/hurt.ogg

there is noerror or crash, It just doesn't play.

 

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted April 23, 2014

Help...

  • Quote

Share this post


Link to post
Share on other sites

coolAlias    745

coolAlias

coolAlias    745

  • Reality Controller
  • coolAlias
  • Members
  • 745
  • 2805 posts
Posted April 24, 2014

its just hurt.ogg. Thats the only file I have

The full path is:

forge/mcp/src/assets/modmud/mud_chucker/hurt.ogg

there is noerror or crash, It just doesn't play.

It needs to be in a "sound" directory:

 

forge/mcp/src/assets/modmud/sound/mud_chucker/hurt.ogg

  • Quote

Share this post


Link to post
Share on other sites

LurgyCoder    0

LurgyCoder

LurgyCoder    0

  • Tree Puncher
  • LurgyCoder
  • Members
  • 0
  • 22 posts
Posted May 10, 2014

Sry, I been gone a while

 

Anyway, I derped, I have one in forge/mcp/src/assets/modmud/sound/mud_chucker/hurt.ogg

 

I also put one in forge/mcp/src/assets/modmud/sound/hurt.ogg, just to double check

 

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • darkgreenminer
      [1.12.2] Multiple Structure Generation

      By darkgreenminer · Posted 3 minutes ago

      Someone else had that same problem of their mod only spawning the last structure added to WorldGenCustomStructures, and I remembered that the solution I found was what a commentor named Redstone Tim mentioned, that in WorldGenStructure you have to remove 'static'.  I'm happy to email my version of these two classes to you if you want to have a look.  It took me hours and hours to get them working.  I have no idea what might cause the cascading gen lag, but fixing the multiple structure problem might help.    
    • troyvs
      problems starting with modding

      By troyvs · Posted 47 minutes ago

      what command did you run to set up?  
    • MightyAhmed
      Immediate Crash On Any Version Of Forge

      By MightyAhmed · Posted 1 hour ago

      ok so its been a while but it was workling fine before somehow but now minecraft still works it just freezes and lagspikes every 5 seconds please help me on this issue i cant find anything on the internet also ihave 4GB ram total in my computer and i have dedicated 2gb ram to minecraft in the JVM arguments section also i have 125 mods installed.
    • deanvangreunen
      Custom Armor Item - Help - MC/Forge 1.14.4/1.14.3

      By deanvangreunen · Posted 2 hours ago

      Hello, I'm in progress of making a Minecraft 1.14.4 Mod using Forge. Needing some help, Could you please look at the following Class File and Explain what I'm doing wrong or what I should be doing?.   The "OnArmorTick" and other ".....Tick" functions don't work.   My intent: - if water is below and near player by 1 block while the boots are on then turn the water into ice. I'm trying to implement "Frost Walking Boots"   Code: - FrostBootsItem.java <- File I need help with - My Project Repo  <- Repo, So if you want to see how my mod is setup. (includes my world saves, etc)   Dev Details: - Minecraft Version: 1.14.4 - Minecraft Snapshot: 20191020-1.14.3 - Forge Version: 1.14.4-28.1.61   Notes: - I've followed a tutorial for 1.14.4 modding by MCJty on youtube (The author of RFTools) - I'm new to minecraft modding. I have expeirenced as a software developer/engineer.   ❤️❤️❤️❤️❤️❤️❤️❤️❤️  ❤️  .Thanks in advance. ❤️  ❤️❤️❤️❤️❤️❤️❤️❤️❤️ 
    • DragonITA
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA · Posted 2 hours ago

      please see the screenshoot above.
  • Topics

    • Merthew
      8
      [1.12.2] Multiple Structure Generation

      By Merthew
      Started November 7, 2018

    • coolian
      1
      problems starting with modding

      By coolian
      Started October 9

    • MightyAhmed
      83
      Immediate Crash On Any Version Of Forge

      By MightyAhmed
      Started November 10

    • deanvangreunen
      0
      Custom Armor Item - Help - MC/Forge 1.14.4/1.14.3

      By deanvangreunen
      Started 2 hours ago

    • DragonITA
      48
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA
      Started December 9

  • Who's Online (See full list)

    • GttiqwT
    • ricoc90
    • darkgreenminer
    • Choonster
    • bitman
    • Ommina
    • ericgolde555
    • AkosM
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Sound Files
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community