Jump to content

Plgue

Members
  • Posts

    28
  • Joined

  • Last visited

Recent Profile Visitors

1198 profile views

Plgue's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Sorry for the late response, but yeah it's being executed
  2. Never mind, this is what i'm currently using entity.world.playSound(null, entity.chunkCoordX, entity.chunkCoordY, entity.chunkCoordZ, ModSounds.BATTLE_MUSIC, SoundCategory.MUSIC, 100, 1); But it still does not work
  3. Again i'm really sorry if I sound like an idiot, but I don't know how to get the sound to play using "World.playsound()" Because I don't know how to get my method non static, I did not set it as static though.
  4. So in this case I should be using "World.playsound" ?
  5. But this code should work right? I'm playing a sound from an entity, vanilla Minecraft does the same thing. So I don't know why it does not work.
  6. So after everything I've seen in this thread, this is what I came up with: @SubscribeEvent(priority = EventPriority.HIGHEST) public void playBattleSong(LivingSetAttackTargetEvent event) { EntityLivingBase entity = event.getEntityLiving().getAttackingEntity(); entity.playSound(ModSounds.BATTLE_MUSIC, 75, 1); } It still does not play the sound.
  7. I do understand it to an extent, but I don't know how I would use it here. And sorry if I sound ignorant or like an idiot, I'm still learning
  8. Isn't that what i'm doing here? I'm playing the sound to the target.
  9. Also, thanks for this idea! This event does exactly what I need it to do.
  10. So I updated my code: @SubscribeEvent public void livingSetAttacktargetEvent(LivingSetAttackTargetEvent event) { EntityLivingBase player = event.getTarget(); System.out.println("Set attack target"); if(event.getTarget() == player) { System.out.println("Battle Music Play"); player.playSound(ModSounds.BATTLE_MUSIC, 100, 1); } else { } } It's still a work in progress, but no matter what I do I can't seem to get the event to start my method. The System.out.println's don't even go off, I'm really stumped here. Edit: This is my common proxy, just in case you wanna see it: public class CommonProxy { public void preInit(FMLPreInitializationEvent e) { ModItems.init(); ModItems.register();; ModEntities.init(); } public void init(FMLInitializationEvent e) { MinecraftForge.EVENT_BUS.register(ModSounds.class); MinecraftForge.EVENT_BUS.register(EventHandler.class); } public void postInit(FMLPostInitializationEvent e) { } }
  11. Title says a lot. Also, the "System.out.println("PlayerTickEvent Working");" does not print every tick. Here's my code: @SubscribeEvent public void entitiesInRadius(PlayerTickEvent event) { EntityPlayer player = event.player; int monsterCount = player.world.getEntitiesWithinAABB(EntityMob.class, new AxisAlignedBB(player.posX - 16, player.posY - 8, player.posZ - 16, player.posX + 16, player.posY + 8, player.posZ + 16)).size(); boolean isplayerinrange = false; System.out.println("PlayerTickEvent Working"); if(monsterCount > 0) { System.out.println("isplayerinrange is true"); isplayerinrange = true; if(isplayerinrange = true) { System.out.println("Battle Music Initiated"); player.playSound(ModSounds.BATTLE_MUSIC, 1, 1); } } else { isplayerinrange = false; } }
  12. Also would there be a more efficient way of checking if a player is holding an item, without having to check every tick? I feel like having too many "Check every tick" methods would cause lag.
×
×
  • Create New...

Important Information

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