Paper icon indicating copy to clipboard operation
Paper copied to clipboard

VehicleBlockCollisionEvent not firing.

Open Jaskowicz1 opened this issue 5 years ago • 8 comments

What behaviour is expected:

The console print "test" upon hitting colliding with a block whilst a player is inside a boat.

What behaviour is observed:

Nothing being outputted.

Steps/models to reproduce:

Add the Event "VehicleBlockCollisionEvent" with a debug line, enter in-game, enter a boat and collide with a block whilst in the boat.

Plugin list:

Plugins (8): Boattesting, Citizens, ExileCore, ImageOnMap, LuckPerms, Multiverse-Core, Vault, WorldEdit

Paper build number:

This server is running Paper version git-Paper-136 (MC: 1.16.1) (Implementing API version 1.16.1-R0.1-SNAPSHOT)

Anything else:

I have no other information.

Jaskowicz1 avatar Aug 20 '20 23:08 Jaskowicz1

Issue is in Entity#move: this.positionChanged = !MathHelper.b(vec3d.x, vec3d1.x) || !MathHelper.b(vec3d.z, vec3d1.z); (Vanilla) is never true, resulting in if (positionChanged && getBukkitEntity() instanceof Vehicle) { (CraftBukkit) failing.

MathHelper#b in this case seems to be something alike #isWithinSameBlock. EDIT: That method is called MathHelper#approximatelyEquals in yarn.

Proximyst avatar Aug 22 '20 20:08 Proximyst

ive first tried messing with this event like 2 years and could never get it to fire. tried it again on and off over the years, but always always thought i mustve been doing something wrong and didnt keep bothering because it wasnt that important to what i was trying to do.

hope this info helps; tldr: this may have been broken for 2+ years

jaylawl avatar Sep 18 '20 19:09 jaylawl

ive first tried messing with this event like 2 years and could never get it to fire. tried it again on and off over the years, but always always thought i mustve been doing something wrong and didnt keep bothering because it wasnt that important to what i was trying to do.

hope this info helps; tldr: this may have been broken for 2+ years

It only fires when anything but a player hits. I did further testing with a pig and it fired when the pig in a boat hit a wall.

Jaskowicz1 avatar Sep 18 '20 19:09 Jaskowicz1

Any further updates on this? It's been so long without any updates and it's causing projects to force into being abandoned 😢

Jaskowicz1 avatar Jan 15 '21 17:01 Jaskowicz1

bump

Jaskowicz1 avatar Apr 06 '21 23:04 Jaskowicz1

Please avoid pointlessly bumping issues. Something something if you don't like the progress the volunteer devs have made so far, PR it yourself.

Chew avatar Apr 07 '21 00:04 Chew

Please avoid pointlessly bumping issues. Something something if you don't like the progress the volunteer devs have made so far, PR it yourself.

Didn't say I didn't like anything, was just asking if there was any updates. Thanks for the notice though.

Jaskowicz1 avatar Apr 07 '21 11:04 Jaskowicz1

The problem looks like it is because the client never sends any movement packets that would cause the boat to collide, which never triggers the server's collision code and therefore never triggers this event. The event is fired when a player is not in the boat because in that case the boat's movement is purely server-side and does result in collisions.

I think that this issue should be closed as it is not possible to distinguish packets from the client that involve a collision between packets that just don't have any movement on the X or Z axes, at least not without some very hacky code that looks at the boat's direction to see if the direction it is facing would've resulted in a collision - something best left to plugins.

I think the best approach is to just update the documentation, although that might be a more spigot-related thing. (spigot bug: https://hub.spigotmc.org/jira/browse/SPIGOT-5463)

okx-code avatar Apr 23 '23 00:04 okx-code