minecraftdotjarrr Posted August 5, 2013 Posted August 5, 2013 Ok so last time I posted, Mazetar helped me out with adding sword sound but.... that was in 1.5 now its 1.6. I've been trying really hard to add these sounds but this is the only thing I have seen on the inter webs. sound file package brenden.viking; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; public class vikingsound { @ForgeSubscribe public void onSound(SoundLoadEvent event) { try { event.manager.addSound("attacking.wav"); event.manager.addSound("medieval:fireshot2.wav"); event.manager.addSound("medieval:fireshot3.wav"); } catch (Exception e) { System.err.println("Fire sounds error"); } } } In sword class public ItemStack onItemLeftClick(ItemStack ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --ItemStack.stackSize; } par2World.playSoundAtEntity(par3EntityPlayer, "brenden:attacking", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new VikingSword_Entity(par2World, par3EntityPlayer)); } return ItemStack; } I dont know what to do now with this. If anyone could help a noob that would be lovely! thanks a million Quote
GotoLink Posted August 5, 2013 Posted August 5, 2013 Well this is quite simple. addSound("attacking.wav"); playSoundAtEntity(par3EntityPlayer, "brenden:attacking" Doesn't match. Quote
hydroflame Posted August 6, 2013 Posted August 6, 2013 ); Quote how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
minecraftdotjarrr Posted August 6, 2013 Author Posted August 6, 2013 Well this is quite simple. addSound("attacking.wav"); playSoundAtEntity(par3EntityPlayer, "brenden:attacking" Doesn't match. addSound("attacking.wav"); playSoundAtEntity(par3EntityPlayer, "attacking.wav" doesn't work. Quote
Squawkers13 Posted August 8, 2013 Posted August 8, 2013 Why don't you use .ogg files? I think they work better. Quote
minecraftdotjarrr Posted August 8, 2013 Author Posted August 8, 2013 Let us see your new code then. Idk know if im not implementing this right or what, but... sword class! public boolean hitEntity (ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par3EntityLiving.worldObj.playSoundAtEntity(par3EntityLiving, "brenden:attacking", 1.0F, 1.0F); { par1ItemStack.damageItem(1, par3EntityLiving); return true; } } public ItemStack onItemLeftClick(ItemStack ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --ItemStack.stackSize; } par2World.playSoundAtEntity(par3EntityPlayer, "brenden:attacking", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new VikingSword_Entity(par2World, par3EntityPlayer)); } return ItemStack; } sound class package brenden.viking; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; public class vikingsound { @ForgeSubscribe public void onSound(SoundLoadEvent event) { try { event.manager.addSound("brenden:attacking.wav"); } catch (Exception e) { System.err.println("Fire sounds error"); } } } Thanks for your time! Quote
GotoLink Posted August 8, 2013 Posted August 8, 2013 Your sound should be placed like this: mcp/src/minecraft/assets/brenden/sound/attacking.wav Quote
minecraftdotjarrr Posted August 8, 2013 Author Posted August 8, 2013 Your sound should be placed like this: mcp/src/minecraft/assets/brenden/sound/attacking.wav do you think this may be the problem? par2World.spawnEntityInWorld(new VikingSword_Entity(par2World, par3EntityPlayer));? Quote
GotoLink Posted August 8, 2013 Posted August 8, 2013 No, actually the main problem is that those methods are not used by Minecraft any more: public boolean hitEntity (ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) public ItemStack onItemLeftClick(ItemStack ItemStack, World par2World, EntityPlayer par3EntityPlayer) You have to update them. Quote
Mazetar Posted August 8, 2013 Posted August 8, 2013 If you add @Override above methods, you will get warnings and errors when they are removed/replaced/renamed! Use @Override above any method which overrides a parents method. then you will at least not encounter this again Quote If you guys dont get it.. then well ya.. try harder...
Recommended Posts
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.