Jump to content

Plgue

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by Plgue

  1. Did this and it's still not working
  2. Sorry for the late response, but yeah it's being executed
  3. 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
  4. 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.
  5. So in this case I should be using "World.playsound" ?
  6. 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.
  7. The priority was just me messing around
  8. 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.
  9. 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
  10. Isn't that what i'm doing here? I'm playing the sound to the target.
  11. Also, thanks for this idea! This event does exactly what I need it to do.
  12. 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) { } }
  13. 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; } }
  14. 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.
  15. Yeah, the other events in the same class are getting called, and it's not a stupid question, as that could have been the problem.
  16. By no means am I trying to disrespect, but that's really not the problem, I've tried on player right click event, without checking what item they were holding, and it still did not work
  17. Still not working
  18. I'll try, I will update on progress also I posted my outdated code, this is my newer code @SubscribeEvent public void onPlayerTick(PlayerTickEvent event) { EntityPlayer p = event.player; if(p.getHeldItem(EnumHand.MAIN_HAND).equals(new ItemStack(ModItems.DransFeather))); { p.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(5.0); //p.capabilities.setPlayerWalkSpeed(2); } }
  19. This is what I have @SubscribeEvent public void onPlayerTick(PlayerTickEvent event) { EntityPlayer p = event.player; if(p.getHeldItem(EnumHand.MAIN_HAND).equals(ModItems.DransFeather)); { //p.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(5.0); p.capabilities.setPlayerWalkSpeed(2); } } The other methods in my events class work, just not this one, I've also tried this without the if statement. Edit: The "p.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(5.0);" is the other thing I tried
  20. I'm struggling on changing player speed, I've used attributes and capabilities, but neither work.
  21. This whole time the armor and items have been equipped, It's just not rendering for some reason
  22. I'm sorry about not knowing too much about Minecraft coding, I know basic Java though.
  23. Seems to be that the code stops here: if (!(event.getEntity() instanceof EntityMasterJacket)) { return; }
×
×
  • Create New...

Important Information

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