PaperMC / Paper

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

Entities moved by piston doesn't trigger move events. #8325

Open UsainSrht opened 2 years ago

UsainSrht commented 2 years ago

Expected behavior

Events triggering

Observed/Actual behavior

Events not triggering

Steps/models to reproduce

Listen io.papermc.paper.event.entity.EntityMoveEvent or org.bukkit.event.player.PlayerMoveEvent Push an entity or a player with piston see the event not triggering

Plugin and Datapack List

[16:34:19 INFO]: Plugins (6): DecentHolograms, LuckPerms, PlaceholderAPI, ProtocolLib, Vault, XConomy

Paper version

[16:35:24 INFO]: This server is running Paper version git-Paper-132 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: a76998d) You are running the latest version Previous version: git-Paper-120 (MC: 1.19.2)

Other

No response

lynxplay commented 2 years ago

I can replicate this. However this is kind of a rough spot, specifically for players as the movements are triggered either from client side induced player movement or from client side induced vehicle movement.

For entities this is a different question, tho their move events are part of their tick logic which, pistons are not nor are any other events that directly move an entity outside of its tick.

UsainSrht commented 2 years ago

I can replicate this. However this is kind of a rough spot, specifically for players as the movements are triggered either from client side induced player movement or from client side induced vehicle movement.

For entities this is a different question, tho their move events are part of their tick logic which, pistons are not nor are any other events that directly move an entity outside of its tick.

Is there anything I can do about this right now? Players can get into restricted ares with pushing themselves with pistons.

lynxplay commented 2 years ago

I mean, it depends. Generally one alternative to player move events is a tick based check, tho I don't know if you are a plugin author or a server administrator. From a server admins point of view, I don't think there is much you can do here right now ?

If you are developing your own plugin, I'd suggest to use a task timer to check each players position every 1-2 ticks to ensure they are 100% not in the area.

mikimasn commented 2 years ago

You could use BlockPistonExtendEvent and with World. getNearbyEntities detect that entity will be moved

UsainSrht commented 2 years ago

You could use BlockPistonExtendEvent and with World. getNearbyEntities detect that entity will be moved

It's kinda hard to make that because of the enviroment. I can get entities and I can get piston direction but how do I know that player is pushed or hit a wall. I'm pretty sure it'll be bunch of "if else"

electronicboy commented 2 years ago

PistonMovingBlockEntity, which does call entity#move, but this gets into weird areas around how the client and server interact with one another, and this really falls into the fact that the movement events don't track actual movements, they track a position change over a certain piece of logic which pistons do not fall into;

as for detecting where the player would end up, I'd imagine that you'd basically need to see if they're in the block which would be where the head ends up, and if so, you can generally assume that they're gonna be pushed over 1 block directionally from the piston

UsainSrht commented 1 year ago

I found minecraft's methods for pushing entities with piston? Maybe this could be helpful for you to solve this problem :P

https://nms.screamingsandals.org/1.19.2/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.html

image