PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
10.06k stars 2.34k forks source link

VehicleBlockCollisionEvent not firing. #4163

Open Jaskowicz1 opened 4 years ago

Jaskowicz1 commented 4 years ago

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.

Proximyst commented 4 years ago

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.

jaylawl commented 4 years ago

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

Jaskowicz1 commented 4 years ago

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 commented 3 years ago

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

Jaskowicz1 commented 3 years ago

bump

Chew commented 3 years ago

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

Jaskowicz1 commented 3 years ago

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.

okx-code commented 1 year ago

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)