ElTotisPro50 Posted February 16, 2022 Posted February 16, 2022 in the version 1.12.2 there is a event called "PlayerEmptyClickEvent.LeftClick" but obviusly mojang change the names and i cant find that event(i guess different called) i need an event to detect left click of items(maybe blocks if the event let you) Quote
ElTotisPro50 Posted February 16, 2022 Author Posted February 16, 2022 (edited) 7 hours ago, diesieben07 said: Events are added by Forge, Mojang has nothing to do with them. You are looking for PlayerInteractEvent.LeftClickEmpty. diesieben why im trying to shoot a fireball with left click event but is not working ("is not working" i mean that the fireball DOESNT appear/add to the world/spawn) @SubscribeEvent public static void leftClickItemEvent(PlayerInteractEvent.LeftClickEmpty event) { PlayerEntity player = event.getPlayer(); World world = player.world; ItemStack stack = player.getHeldItemMainhand(); if(stack.getItem() instanceof MYITEM) { //or if(stack.getItem() == ModItems.MYITEM.get()) none of those works FireballEntity fireball = new FireballEntity(EntityType.FIREBALL,world); Vector3d aim = player.getLookVec(); fireball.setPositionAndUpdate(player.getPosX() + aim.x * 1.7, player.getPosY() + aim.y * 1.7, player.getPosZ() + aim.z * 1.7); fireball.accelerationX = aim.x * 0.6; fireball.accelerationY = aim.y * 0.6; fireball.accelerationZ = aim.z * 0.6; world.addEntity(fireball); } } Edited February 16, 2022 by ElTotisPro50 Quote
Recommended Posts
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.