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

Sound Files


LurgyCoder
 Share

Recommended Posts

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

Heylo!

I am Lurgypai, but my coder name is LurgyCoder (I have an account under the same name on minecraft forums)

The name is not supposed to reference lurgy, I just came up with it.

Link to comment
Share on other sites

now it has an error:

 

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

 

I use Eclipse

Heylo!

I am Lurgypai, but my coder name is LurgyCoder (I have an account under the same name on minecraft forums)

The name is not supposed to reference lurgy, I just came up with it.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Heylo!

I am Lurgypai, but my coder name is LurgyCoder (I have an account under the same name on minecraft forums)

The name is not supposed to reference lurgy, I just came up with it.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

No luck...

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

Heylo!

I am Lurgypai, but my coder name is LurgyCoder (I have an account under the same name on minecraft forums)

The name is not supposed to reference lurgy, I just came up with it.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Heylo!

I am Lurgypai, but my coder name is LurgyCoder (I have an account under the same name on minecraft forums)

The name is not supposed to reference lurgy, I just came up with it.

Link to comment
Share on other sites

  • 3 weeks later...

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

 

Heylo!

I am Lurgypai, but my coder name is LurgyCoder (I have an account under the same name on minecraft forums)

The name is not supposed to reference lurgy, I just came up with it.

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

    • Hazmat Suit from Mekanism is the problem. I just found it populating itself to the max over and over raising havok in my Refined storage. Not sure why but i deleted it through transmutation and then unistalled it again. This was in Vault hunters
    • [19mai2022 11:08:54.412] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, Bee_Lytho, --version, 1.16.5-forge-36.2.34, --gameDir, C:\Users\vivie\AppData\Roaming\.minecraft, --assetsDir, C:\Users\vivie\AppData\Roaming\.minecraft\assets, --assetIndex, 1.16, --uuid, 9ca0e0921a5c4760809353131bad1432, --accessToken, ????????, --userType, msa, --versionType, release, --launchTarget, fmlclient, --fml.forgeVersion, 36.2.34, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20210115.111550] [19mai2022 11:08:54.421] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 8.1.3+8.1.3+main-8.1.x.c94d18ec starting: java version 1.8.0_51 by Oracle Corporation [19mai2022 11:08:54.475] [main/WARN] [cpw.mods.modlauncher.SecureJarHandler/]: LEGACY JDK DETECTED, SECURED JAR HANDLING DISABLED [19mai2022 11:08:54.814] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFineTransformationService.onLoad [19mai2022 11:08:54.817] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFine ZIP file URL: file:/C:/Users/vivie/AppData/Roaming/.minecraft/mods/OptiFine_1.18.1_HD_U_H4.jar [19mai2022 11:08:54.819] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFine ZIP file: C:\Users\vivie\AppData\Roaming\.minecraft\mods\OptiFine_1.18.1_HD_U_H4.jar [19mai2022 11:08:54.824] [main/INFO] [optifine.OptiFineTransformer/]: Target.PRE_CLASS is available [19mai2022 11:08:55.172] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust [19mai2022 11:08:55.296] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.4 Source=file:/C:/Users/vivie/AppData/Roaming/.minecraft/libraries/org/spongepowered/mixin/0.8.4/mixin-0.8.4.jar Service=ModLauncher Env=CLIENT [19mai2022 11:08:55.321] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFineTransformationService.initialize [19mai2022 11:08:56.863] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: java.lang.AbstractMethodError: Method optifine/OptiFineTransformationService.beginScanning(Lcpw/mods/modlauncher/api/IEnvironment;)V is abstract [19mai2022 11:08:56.863] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at optifine.OptiFineTransformationService.beginScanning(OptiFineTransformationService.java) [19mai2022 11:08:56.863] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.api.ITransformationService.runScan(ITransformationService.java:74) [19mai2022 11:08:56.867] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:114) [19mai2022 11:08:56.870] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:115) [19mai2022 11:08:56.870] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.TransformationServicesHandler$$Lambda$204/901205084.apply(Unknown Source) [19mai2022 11:08:56.871] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267) [19mai2022 11:08:56.872] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1612) [19mai2022 11:08:56.873] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) [19mai2022 11:08:56.874] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) [19mai2022 11:08:56.874] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) [19mai2022 11:08:56.875] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [19mai2022 11:08:56.876] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) [19mai2022 11:08:56.877] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:116) [19mai2022 11:08:56.877] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:63) [19mai2022 11:08:56.878] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.Launcher.run(Launcher.java:76) [19mai2022 11:08:56.879] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)     Thank you  
    • So something like this is what you meant right? I tested it and this setup works I just wanna make sure I did it correctly New Tile: https://pastebin.com/XHduUJcA InputStackHandler: https://pastebin.com/JKZiSska
    • This is how I fixed it not sure this is the correct way, but it works boolean flag = fluidstate.getType() != Fluids.EMPTY; boolean flag = fluidstate.getType() != Fluids.EMPTY; Added this method @Override public boolean canPlaceLiquid(BlockGetter p_54325_, BlockPos p_54326_, BlockState p_54327_, Fluid p_54328_) { return false; }  
    • Hello, I also want to increase the reach attack of some tools. I would like you to help me especially with the PacketHandler and put it in the tools
  • Topics

×
×
  • Create New...

Important Information

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