-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cancelling PlayerInteractAtEntityEvent causes impossible entities #11496
Comments
This is kind of just a very funny minecraft bug that is exposed by us resending all entity data to correctly sync entities. TDLR is that the "correct" state you are describing is completely incorrect. I think this is still a worthwhile fix/compliance with mojang logic (mostly because it should be easy) but be aware that the existing code does not actively define the eyeheight of interaction entities to be 0, hence you are relying on a bug. |
Is there a way to set eyeheight to 0/0? Or can I manually send client data on how to display it? I don't really care too much where the eyeheight will be. All I really need is to make it consistent after spawning and after clicking it, is there something that might help? |
The client computes the eyeheight as 85% of the height when it refreshes its dimension. Alternatively, a quick hack fix might be diff --git a/patches/server/1013-Properly-resend-entities.patch b/patches/server/1013-Properly-resend-entities.patch
index 148750ed5..671b436cb 100644
--- a/patches/server/1013-Properly-resend-entities.patch
+++ b/patches/server/1013-Properly-resend-entities.patch
@@ -102,7 +102,7 @@ index 0034483685ba626e5883b857de96ffd36e57e150..4c04eb531b6989f7e618d201ecaa8429
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
-index 3a90dd1289d393426151d4457edaf99731cc34db..ec058eb6a10500831f173dcb47576c32c7516318 100644
+index 65f2cad4b5df6a89373fb69edfc7d488d0fdcbed..613e66e1abb2cddb9f39f8ac255b1eb493915beb 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -393,7 +393,7 @@ public abstract class PlayerList {
@@ -134,7 +134,7 @@ index 3a90dd1289d393426151d4457edaf99731cc34db..ec058eb6a10500831f173dcb47576c32
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index 52f3d0d4ce28cc6566166ae9a5a1b236ff8c027d..74231cb1c89079473d1727aa3ae2a539d4250317 100644
+index b83599c873aad58c23d96f20f93ed171a73de6c4..08644404bb1d64328e03fb713094b20360be4b13 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -684,13 +684,45 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -142,7 +142,7 @@ index 52f3d0d4ce28cc6566166ae9a5a1b236ff8c027d..74231cb1c89079473d1727aa3ae2a539
// CraftBukkit start
public void refreshEntityData(ServerPlayer to) {
- List<SynchedEntityData.DataValue<?>> list = this.getEntityData().getNonDefaultValues();
-+ List<SynchedEntityData.DataValue<?>> list = this.entityData.packAll(); // Paper - Update EVERYTHING not just not default
++ List<SynchedEntityData.DataValue<?>> list = this.type == EntityType.INTERACTION ? getEntityData().getNonDefaultValues() : this.entityData.packAll(); // Paper - Update EVERYTHING not just not default
- if (list != null) {
+ if (list != null && to.getBukkitEntity().canSee(this.getBukkitEntity())) { // Paper |
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:
Observed/Actual behavior
It does this:
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
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);}
}
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
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)
The text was updated successfully, but these errors were encountered: