Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more hand/off-hand issues #51

Closed
Pilvinen opened this issue Apr 10, 2016 · 9 comments
Closed

more hand/off-hand issues #51

Pilvinen opened this issue Apr 10, 2016 · 9 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).

Comments

@Pilvinen
Copy link

on right click with iron hoe:
  event-block is grass or dirt
  cancel event
  1. Switch hoe to off-hand.
  2. Switch placable block, dirt for example, in main hand
  3. Stand on dirt/grass.
  4. Look down at your feet.
  5. Right click to place the dirt block in your hand.
  6. You can't place the dirt block because you are standing on the block where you're trying to place it.
  7. Minecraft tries to use the hoe instead.
  8. Cancel event above fails to work.
@bensku bensku added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Apr 10, 2016
@bensku bensku added this to the V10 milestone Apr 10, 2016
@TheBentoBox
Copy link
Member

I verify this old issue, it is still occurring in 2.2-dev22g.

The problem of course lies in EvtClick.java, but this is a very complicated issue. In this particular situation, there's actually NO right click event being fired by Skript. I tried with this code:

on right click:
	send "%event-item%"

Then put a piece of dirt in my main hand, an iron hoe in my offhand, stood on top of some dirt and looked down, then tried to hoe it -- no message.

For @bensku, something that could help you out is checking out the method summary of the PlayerInteractEvent in detail, most particularly the hasBlock and hasItem functions, especially combining the former with the isBlockInHand function. Really, the issue is Spigot's poor implementation of the dual wielding feature. Realistically, it should just fire one click event -- the one that actually went through. It's such a pain to actually determine which hand's event actually happened as there are so many particular edge cases. For example, if you're standing BARELY inside of a block, and are holding a piece of dirt in your main hand and a small block (e.g. flower pot) in your offhand, the flower pot placement will go through, but any reasonable method of checking would probably tell you that nothing happened as the player tried to place something where they couldn't (since both hands held a block and they were trying to place it inside of themselves).

Not sure of the best way to progress, I'll poke around for any good API-side solutions.

@Snow-Pyon Snow-Pyon added the priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). label Jan 31, 2018
@bensku bensku removed this from the V10 milestone May 21, 2018
@bensku
Copy link
Member

bensku commented May 21, 2018

Someone please verify if this still happens.

@Blueyescat
Copy link
Contributor

Blueyescat commented Jun 4, 2018

@bensku I did what he said in the issue and i can confirm. PaperSpigot 1.12.2 and Skript 2.2-dev36.

@antoinech2
Copy link

Hi, I have the same problem with shulker boxes:

on right click: if clicked block is a shulker box: send "Shulker box clicked!"

If you have any item in your off-hand, and no item in your main hand, the event is not called.
Only for shulker box.
Is there an alternative to do this with skript?

@TheBentoBox
Copy link
Member

What version are you using @antoinech2?

@antoinech2
Copy link

Skript 2.2-dev37c with Paper-1438 in Mc 1.12.2

@Malachiel87
Copy link

Same still happen with firework on 1.12.2

@FranKusmiruk
Copy link
Member

Closing this since most of the things mentioned above were fixed and even then, there are new issues covering it.

Nicofisi referenced this issue in Nicofisi/Skript Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).
Projects
None yet
Development

No branches or pull requests

9 participants