Posted August 9, 20214 yr Hi, Is there any way to get player's targeted block? I read below topic about 1.7. https://forums.minecraftforge.net/topic/21107-1710sloved-help-how-do-i-get-a-players-target-block/ But objectMouseOver is not found at 1.16.5. I'm trying to create a mod that explode at targeted block on PlayerInteractEvent.LeftClickEmpty event occurred. @Mod(ExampleMod.MOD_ID) class ExampleMod { private val logger: Logger = LogManager.getLogger(MOD_ID) init { MinecraftForge.EVENT_BUS.register(this) } @SubscribeEvent fun on(event: PlayerInteractEvent.LeftClickEmpty) { val pos = // get player's target block logger.info("${pos.x} ${pos.y} ${pos.z} ") event.world.explode( event.player, pos.x.toDouble(), pos.y.toDouble(), pos.z.toDouble(), 4.0F, Explosion.Mode.DESTROY ) } companion object { const val MOD_ID: String = "examplemod" } } Thanks Edited August 9, 20214 yr by nshmura
August 9, 20214 yr Author hitResult worked fine! > LeftClickEmpty is a client-side event, so creating an explosion will do nothing meaningful I'm new to forge, and it's a little surprising. Thank you!
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.