Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

(1.16.5 MCP) detect LEFT click in items

Featured Replies

Posted

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)

  • Author
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 by ElTotisPro50

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.