Jump to content

Recommended Posts

Posted

Hello there! I want to add my custom sound to game and then play it. I have .ogg file (vorbis 2.0 codec) in assets.flintstonetools.sound folder in project.

 

 

[spoiler=My Base of mod]

package platon.mods.flintstonetools;

import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.NetServerHandler;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod (modid = FlintBase.modid, name = "Flintstone Tools", version = "1.1.1a") 
@NetworkMod (clientSideRequired = true, serverSideRequired = false)

public class FlintBase {
public static final String modid = "flintstonetools";
@Instance(FlintBase.modid)
public static FlintBase instance;
public static Item flintpickaxe;
static int flintpickaxeid;
public static Item flintshovel;
static int flintshovelid;
public static Item flintaxe;
static int flintaxeid;
public static Item flinthoe;
static int flinthoeid;
public static Item flintsword;
static int flintswordid;
@EventHandler
public void reg(FMLPreInitializationEvent event)
{
MinecraftForge.EVENT_BUS.register(new SoundLoader());
}
@EventHandler
public void preLoad(FMLPreInitializationEvent event)
{
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
config.defaultEncoding="windows-1251";
flintpickaxeid = config.get("Mod IDs", "flintpickaxeid", 650).getInt();
flintshovelid = config.get("Mod IDs", "flintshovelid", 651).getInt();
flintaxeid = config.get("Mod IDs", "flintaxeid", 652).getInt();
flinthoeid = config.get("Mod IDs", "flinthoeid", 653).getInt();
flintswordid = config.get("Mod IDs", "flintswordid", 654).getInt();
SetBlockOnFire.fireableids = config.get("flintstonetools", "fireableids", SetBlockOnFire.deffireableids).getIntList();
config.addCustomCategoryComment("flintstonetools", "Here is the list of IDs of blocks that can be setted on fire by the flint pickaxe.\nThat list can be modified. Just add the Ids you want in column.\n\nЗдесь в столбик указаны ID блоков, которые можно поджигать кремневой киркой.\nВы можете изменять его. Просто добавьте свои ID в колонку с новой строки");
config.save();
}
@EventHandler
public void load(FMLInitializationEvent event)
{
flintpickaxe = new ItemFlintPickAxe(flintpickaxeid).setUnlocalizedName("flintpickaxe");
GameRegistry.addRecipe(new ItemStack(FlintBase.flintpickaxe, 1), new Object[]{ "XXX", " # ", " # ",
Character.valueOf('X'), Item.flint, ('#'), Item.stick});
LanguageRegistry.instance().addNameForObject(flintpickaxe, "en_US", "Flint Pickaxe");
LanguageRegistry.instance().addNameForObject(flintpickaxe, "ru_RU", "Кремневая Кирка");

flintshovel = new ItemFlintShovel(flintshovelid).setUnlocalizedName("flintshovel");
GameRegistry.addRecipe(new ItemStack(FlintBase.flintshovel, 1), new Object[]{ " X ", " # ", " # ",
Character.valueOf('X'), Item.flint, ('#'), Item.stick});
LanguageRegistry.instance().addNameForObject(flintshovel, "en_US", "Flint Shovel");
LanguageRegistry.instance().addNameForObject(flintshovel, "ru_RU", "Кремневая Лопата");

flintaxe = new ItemFlintAxe(flintaxeid).setUnlocalizedName("flintaxe");
GameRegistry.addRecipe(new ItemStack(FlintBase.flintaxe, 1), new Object[]{ " XX", " #X", " # ",
Character.valueOf('X'), Item.flint, ('#'), Item.stick});
LanguageRegistry.instance().addNameForObject(flintaxe, "en_US", "Flint Axe");
LanguageRegistry.instance().addNameForObject(flintaxe, "ru_RU", "Кремневый Топор");

flinthoe = new ItemFlintHoe(flinthoeid).setUnlocalizedName("flinthoe");
GameRegistry.addRecipe(new ItemStack(FlintBase.flinthoe, 1), new Object[]{ " XX", " # ", " # ",
Character.valueOf('X'), Item.flint, ('#'), Item.stick});
LanguageRegistry.instance().addNameForObject(flinthoe, "en_US", "Flint Hoe");
LanguageRegistry.instance().addNameForObject(flinthoe, "ru_RU", "Кремневая Мотыга");

flintsword = new ItemFlintSword(flintswordid).setUnlocalizedName("flintsword");
GameRegistry.addRecipe(new ItemStack(FlintBase.flintsword, 1), new Object[]{ " X ", " X ", " # ",
Character.valueOf('X'), Item.flint, ('#'), Item.stick});
LanguageRegistry.instance().addNameForObject(flintsword, "en_US", "Flint Sword");
LanguageRegistry.instance().addNameForObject(flintsword, "ru_RU", "Кремневый Меч");
}
static EnumToolMaterial FLINT = EnumHelper.addToolMaterial("FLINT", 2, 150, 5.0F, 2.0F, 10);
}

 

 

 

[spoiler=SoundLoader]

package platon.mods.flintstonetools;

import net.minecraft.client.audio.SoundManager;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;

public class SoundLoader
{
@ForgeSubscribe
public void onSoundsLoaded(SoundLoadEvent event)
{

event.manager.soundPoolSounds.addSound("flintstonetools/sound/stonestrike.ogg");

}
}

 

 

 

[spoiler=My item i want to play this sound]

package platon.mods.flintstonetools;

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.entity.player.EntityPlayer;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.Property;

import java.util.Random;

public class ItemFlintPickAxe extends ItemPickaxe{

public ItemFlintPickAxe(int par1)
{
super(par1,FlintBase.FLINT);
	this.setCreativeTab(CreativeTabs.tabTools);
}
@Override
public void registerIcons(IconRegister reg){
this.itemIcon = reg.registerIcon("flintstonetools:ItemFlintPickAxe");
}

public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{

par3World.playSoundAtEntity(par2EntityPlayer, "flintstonetools.sound.stonestrike", 1.0F, 1.0F);
return true;

}
}

 

 

 

Please help me!!! What should i do to make it work??? Minecraft 1.6.2 Forge 804

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Posted

event.manager.soundPoolSounds.addSound("flintstonetools:stonestrike.ogg");

par3World.playSoundAtEntity(par2EntityPlayer, "flintstonetools:stonestrike", 1.0F, 1.0F);

 

 

Posted

I already tried this and its wasnt work but now i guessed that this is eclipse's problem i compiled my code and put it to minecraft mods folder and all get work but now in eclipse it doesn't works anyway.

When i use my tool, all sounds are disappearing and minecraft writes the error code:

2013-08-18 22:00:04 [iNFO] [sTDERR] Exception in thread "Thread-15" java.lang.NullPointerException
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.codecs.CodecJOrbis.readHeader(CodecJOrbis.java:448)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.codecs.CodecJOrbis.initialize(CodecJOrbis.java:301)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.libraries.LibraryLWJGLOpenAL.loadSound(LibraryLWJGLOpenAL.java:392)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.libraries.LibraryLWJGLOpenAL.newSource(LibraryLWJGLOpenAL.java:640)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.SoundSystem.CommandNewSource(SoundSystem.java:1800)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2415)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.CommandThread.run(CommandThread.java:121)

 

In what package in eclipe my sound must to be?

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Posted

maybe common package?

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Posted

There are tutorials on this, if you have trouble finding them you could try my website (self promoting, I know :P ):

mazetar.com/mctuts/displayTutorials.php

 

For sounds I wrote a tutorial which may aid you:

www.minecraftforum.net/topic/1886370-forge16x-mazs-tutorials-working-custom-sounds-w-random-sound-from-soundpool-190713/

  Quote

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

Posted

I already get mod works but not in eclipse. Where must assets/modname/sound directory must to be in eclipse, say please. I would be glad to some screenshot.

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Posted

it must be inside ANY src folder in the project.

if you have multiple source folders for your project you can have it inside ANY of them.

  Quote

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

Posted

I just copied all i need to the src folder which in the mcp's home (where is files recomp and reobf). And it doesn't works and gives me an error described upper

hsWn6OW.png

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Posted
  On 8/18/2013 at 6:07 PM, PlatonCraft said:

I already tried this and its wasnt work but now i guessed that this is eclipse's problem i compiled my code and put it to minecraft mods folder and all get work but now in eclipse it doesn't works anyway.

When i use my tool, all sounds are disappearing and minecraft writes the error code:

2013-08-18 22:00:04 [iNFO] [sTDERR] Exception in thread "Thread-15" java.lang.NullPointerException
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.codecs.CodecJOrbis.readHeader(CodecJOrbis.java:448)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.codecs.CodecJOrbis.initialize(CodecJOrbis.java:301)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.libraries.LibraryLWJGLOpenAL.loadSound(LibraryLWJGLOpenAL.java:392)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.libraries.LibraryLWJGLOpenAL.newSource(LibraryLWJGLOpenAL.java:640)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.SoundSystem.CommandNewSource(SoundSystem.java:1800)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2415)
2013-08-18 22:00:04 [iNFO] [sTDERR] 	at paulscode.sound.CommandThread.run(CommandThread.java:121)

 

In what package in eclipe my sound must to be?

Looks like a codec error.

Can you try with a .wav file ?

Posted

If you mean code - yes, all the code here, too. in mcp/src/minecraft

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Posted

@Gotolink

Just another error, and as I said if i compiling mod and put it to minecraft mods folder, all works

 

  Reveal hidden contents

 

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Posted

In a sence? I just copied this sound to src. I tried to create package and folder named assets.flintstonetools.sound but the result is same - error

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Posted

YEAH!!! I fixed it. I put the sound in mcp/eclipse folder.

My sound is very bad. I need the sound of flint scratching stone. Can anyone help me with that?

at least give me a link to site with different sounds.

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello , when I try to launch the forge installer it just crash with a message for 0,5 secondes. I'm using java 17 to launch it. Here's the link of the error :https://cdn.corenexis.com/view/?img=d/ma24/qs7u4U.jpg  
    • You will find the crash-report or log in your minecraft directory (crash-report or logs folder)
    • Use a modpack which is using these 2 mods as working base:   https://www.curseforge.com/minecraft/modpacks/life-in-the-village-3
    • inicie un mundo donde instale Croptopia y Farmer's Delight, entonces instale el addon Croptopia Delight pero no funciona. es la version 1.18.2
    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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