Everything posted by Plgue
-
Playing a sound event when player is in range of an entity
Did this and it's still not working
-
Playing a sound event when player is in range of an entity
Sorry for the late response, but yeah it's being executed
-
Playing a sound event when player is in range of an entity
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
-
Playing a sound event when player is in range of an entity
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.
-
Playing a sound event when player is in range of an entity
So in this case I should be using "World.playsound" ?
-
Playing a sound event when player is in range of an entity
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.
-
Playing a sound event when player is in range of an entity
The priority was just me messing around
-
Playing a sound event when player is in range of an entity
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.
-
Playing a sound event when player is in range of an entity
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
-
Playing a sound event when player is in range of an entity
Isn't that what i'm doing here? I'm playing the sound to the target.
-
Playing a sound event when player is in range of an entity
Still not the issue
-
Playing a sound event when player is in range of an entity
Also, thanks for this idea! This event does exactly what I need it to do.
-
Playing a sound event when player is in range of an entity
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) { } }
-
Playing a sound event when player is in range of an entity
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; } }
-
Can't change player speed
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.
-
Can't change player speed
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.
-
Can't change player speed
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
-
Can't change player speed
Still not working
-
Can't change player speed
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); } }
-
Can't change player speed
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
-
Can't change player speed
I'm struggling on changing player speed, I've used attributes and capabilities, but neither work.
-
[1.12.1]How would one spawn a custom mob with custom armor and a custom weapon?
This whole time the armor and items have been equipped, It's just not rendering for some reason
-
[1.12.1]How would one spawn a custom mob with custom armor and a custom weapon?
I'm sorry about not knowing too much about Minecraft coding, I know basic Java though.
-
[1.12.1]How would one spawn a custom mob with custom armor and a custom weapon?
What method would I put it in?
-
[1.12.1]How would one spawn a custom mob with custom armor and a custom weapon?
Seems to be that the code stops here: if (!(event.getEntity() instanceof EntityMasterJacket)) { return; }
IPS spam blocked by CleanTalk.