I am currently running
- SpongeVanilla version: 7.2.1, also tested with 7.1.8
- Java version: 1.8
- Operating System: Windows 10
- Plugins: My testing plugin exclusively
Issue Description
This is a bug that can be consistently reproduced. The nature of the issue is simple: InteractItemEvent.Primary is not fired in some specific cases, though it should be.
From what I've understood from this, this event should be fired when a player left clicks with an item, without aiming at a block (meaning, aiming either at the air or at an entity). In case I'm targetting a block, then InteractBlockEvent.Primary will be fired instead. The item is of course held in my main hand. And to prevent InteractBlockEvent.Primary from being fired along with InteractItemEvent.Primary, I used the following code:
if(event.getTargetBlock().getState().getType() == BlockTypes.AIR) {
// Meaning that InteractItemEvent.Primary is already being fired
return;
}
So far so good. In most cases, the InteractItemEvent.Primary event works perfectly fine. However, there is an issue in a very specific case: when I'm interacting with an item and almost targetting a block, but still too far for actually reaching it (proof that I'm too far is: the black lines indicating which block I'm targetting don't appear). In this case, neither InteractItemEvent not InteractBlockEvent are fired. Here is a gif showing an example: particles are fired when the event is called. As you can see, I start by clicking on the grass, firing the InteractBlock.Primary event. Then, I aim at the sky, firing the InteractItemEvent.Primary. But eventually, when I aim at those grass blocks while being too far to reach them, nothing is fired.
I don't believe there is any need for including code samples, let me know if you disagree, I'll post my code.
I am currently running
Issue Description
This is a bug that can be consistently reproduced. The nature of the issue is simple:
InteractItemEvent.Primaryis not fired in some specific cases, though it should be.From what I've understood from this, this event should be fired when a player left clicks with an item, without aiming at a block (meaning, aiming either at the air or at an entity). In case I'm targetting a block, then
InteractBlockEvent.Primarywill be fired instead. The item is of course held in my main hand. And to preventInteractBlockEvent.Primaryfrom being fired along withInteractItemEvent.Primary, I used the following code:So far so good. In most cases, the
InteractItemEvent.Primaryevent works perfectly fine. However, there is an issue in a very specific case: when I'm interacting with an item and almost targetting a block, but still too far for actually reaching it (proof that I'm too far is: the black lines indicating which block I'm targetting don't appear). In this case, neither InteractItemEvent not InteractBlockEvent are fired. Here is a gif showing an example: particles are fired when the event is called. As you can see, I start by clicking on the grass, firing theInteractBlock.Primaryevent. Then, I aim at the sky, firing theInteractItemEvent.Primary. But eventually, when I aim at those grass blocks while being too far to reach them, nothing is fired.I don't believe there is any need for including code samples, let me know if you disagree, I'll post my code.