PaperMC / PaperMC/Paper

cancelling PlayerInteractAtEntityEvent causes impossible entities

Open
#11,496 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: accepted type: bug version: 1.21.1 version: 1.21.11
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

To not get some wierd entities. To be precise I want nothing to happen with my "minecraft:interaction" so it will stay as it spawned, like this: Image

Observed/Actual behavior

It does this:
Image
In normal game its impossible to spawn this kind of interaction, and in my case it really matters as the eye line(or whatever this blue line is) is where passengers sit, and after this wierd rotation they go up.

Steps/models to reproduce
  1. setup server and any plugin that cancels the PlayerInteractAtEntityEvent , for example this plugin:
    package com.example.bug;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerInteractAtEntityEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    public final class Bug extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
    getServer().getPluginManager().registerEvents(this, this);
    }
    @Override
    public void onDisable() {}
    @EventHandler
    public void onEvent(PlayerInteractAtEntityEvent event){event.setCancelled(true);}
    }
  2. interact with any "minecraft:interaction"
  3. done. now this entity is bugged.
    Intresting fact:
    If you reload chunks in which entity is, it will go back to normal, I couldn't find other way to fix this bug.
Plugin and Datapack List

only one plugin, which code is above, no datapacks

Paper version

version
[15:55:18 INFO]: Checking version, please wait...
[15:55:18 INFO]: This server is running Paper version 1.21.1-122-master@4430e96 (2024-10-12T21:18:42Z) (Implementing API version 1.21.1-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.1-2324-e12a4de (MC: 1.21.1)

Other

I'm not sure that cancelling event is what causes the bug, as in another plugin I do not cancel event, but it still happening, but cancelling is one way of doing it, so If you will fix it, then my original bug will probably go away anyway. I also checked it on spigot and it worked as intended and no entity was rotated (at least in my 5 minute check)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce on Paper 1.21.1-122 with the minimal plugin that cancels PlayerInteractAtEntityEvent, then interact with a minecraft:interaction entity and compare its rotation before and after chunk reload. Trace the server handling for PlayerInteractAtEntityEvent and minecraft:interaction entities; done means cancelling the event leaves the entity unchanged, as on Spigot.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.