Posted December 28, 20186 yr How do I detect (on the server) if a player is swinging a sword? I want to make an enchantment that lets you deflect arrows like ghast fireballs, but I can't find an event that fires when the player left clicks. I looked into sending a packet from the client to the server when there's a left click on the client side, but I couldn't figure out how to send the server an event object for the left click event. If theres an easier way to do this, I'd love to hear it.
December 28, 20186 yr I think you want the PlayerInteractEvent.LeftClickEmpty and AttackEntityEvent events About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
December 28, 20186 yr Author Will attackEntityEvents work with projectiles? Also, leftclickempty only works on the client. Edited December 28, 20186 yr by theishiopian events
December 28, 20186 yr IIRC all projectiles are entities except for eggs About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
December 28, 20186 yr Thats the only reference to it I could find, I think its been changed in newer versions tho Edit: https://bugs.mojang.com/browse/MC-31338 yeah, it was changed ages ago Edited December 28, 20186 yr by Cadiboo About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
December 28, 20186 yr Author Lol, this codebase scares me sometimes with how janky it is. I seem to recall arrows not responding to being hit with a sword, but I'll test again and report back.
December 28, 20186 yr Author @Cadiboo I just tested and AttackEntityEvent event by firing arrows at myself from a dispenser and swinging a sword at them. It appears that arrows dont fire the event. Code: @SubscribeEvent public static void event(AttackEntityEvent event) { if(event.getEntity() instanceof IProjectile) { System.out.println("x"); } } EDIT: Holy shit I'm dumb, I forgot to register the event. EDIT2: After registering the event, it still doesn't work. Edited December 28, 20186 yr by theishiopian im dumb
December 30, 20186 yr Try the onProjectileImpact event maybe? You could also check the arrow code & possibly submit a PR to forge About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
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.