From 9711b48f2f91a1f19407d3ff16485831f11612e7 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 25 May 2026 18:20:42 +0200 Subject: [PATCH 1/3] Fix interaction with trace entity not showing detail text --- .../tracer/rendering/TraceEntity.java | 18 ++++++ .../src/de/steamwar/entity/REntityServer.java | 4 +- .../steamwar/entity/RInteractionEntity.java | 55 +++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RInteractionEntity.java diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index c00d976d..c14ff6d6 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -24,6 +24,11 @@ import de.steamwar.bausystem.configplayer.Config; import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.bausystem.features.tracer.Trace; import de.steamwar.bausystem.features.tracer.TraceManager; +<<<<<<< Updated upstream +======= +import de.steamwar.entity.RBlockDisplay; +import de.steamwar.entity.RInteractionEntity; +>>>>>>> Stashed changes import de.steamwar.entity.REntityServer; import de.steamwar.entity.RFallingBlockEntity; import lombok.Getter; @@ -55,13 +60,26 @@ public class TraceEntity extends RFallingBlockEntity { private final String uniqueTntIdsString; private final Trace trace; + private final RInteractionEntity hitbox; public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records, Trace trace) { super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT); this.records = records; this.trace = trace; uniqueTntIdsString = records.stream().map(TNTPoint::getTntId).distinct().map(Object::toString).collect(Collectors.joining(" ")); +<<<<<<< Updated upstream setNoGravity(true); +======= + hitbox = new RInteractionEntity(server, location, TNT_VISUAL_SCALE, TNT_VISUAL_SCALE, this); + setTransform(TNT_VISUAL_TRANSFORM); + setBlock(material.createBlockData()); +>>>>>>> Stashed changes + } + + @Override + public void die() { + hitbox.die(); + super.die(); } /** diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java index 1372ed17..051e8f9b 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java @@ -57,14 +57,16 @@ public class REntityServer implements Listener { private final BiFunction filter = (player, packet) -> { REntity entity = entityMap.get(packet.getEntityId()); if (entity == null) return packet; + REntity targetEntity = entity instanceof RInteractionEntity ? ((RInteractionEntity) entity).getOwner() : entity; if (playersThatClicked.contains(player)) return null; playersThatClicked.add(player); EntityAction action = packet.isAttack() ? EntityAction.ATTACK : EntityAction.INTERACT; + Bukkit.getScheduler().runTask(Core.getInstance(), () -> { playersThatClicked.remove(player); - callback.onAction(player, entity, action); + callback.onAction(player, targetEntity, action); }); return null; }; diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RInteractionEntity.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RInteractionEntity.java new file mode 100644 index 00000000..ee97ac26 --- /dev/null +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RInteractionEntity.java @@ -0,0 +1,55 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2025 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.entity; + +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; + +import java.util.function.Consumer; + +public class RInteractionEntity extends REntity { + + private static final EntityDataAccessor widthWatcher = new EntityDataAccessor<>(8, EntityDataSerializers.FLOAT); + private static final EntityDataAccessor heightWatcher = new EntityDataAccessor<>(9, EntityDataSerializers.FLOAT); + + private float width; + private float height; + private final REntity owner; + + public RInteractionEntity(REntityServer server, Location location, float width, float height, REntity owner) { + super(server, EntityType.INTERACTION, location, 0); + this.width = width; + this.height = height; + this.owner = owner; + server.addEntity(this); + } + + @Override + protected void postSpawn(Consumer packetSink) { + super.postSpawn(packetSink); + packetSink.accept(getDataWatcherPacket(widthWatcher, width, heightWatcher, height)); + } + + public REntity getOwner() { + return owner; + } +} From ea9d7ac584cc33b0d0398afb7b9ed035fbea1be2 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 30 May 2026 13:29:50 +0200 Subject: [PATCH 2/3] Refactor to use better impl of interaction entity in REntity system --- .../bausystem/features/tracer/Trace.java | 16 ------ .../tracer/rendering/TraceEntity.java | 14 ++++- .../steamwar/entity/RInteractionEntity.java | 55 ------------------- 3 files changed, 11 insertions(+), 74 deletions(-) delete mode 100644 SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RInteractionEntity.java diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index 5179eead..95107761 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -144,14 +144,6 @@ public class Trace { } else { entityServer = new REntityServer(); entityServer.addPlayer(player); - entityServer.setCallback((p, rEntity, entityAction) -> { - if (entityAction != REntityAction.INTERACT) { - return; - } - if (rEntity instanceof TraceEntity) { - ((TraceEntity) rEntity).printIntoChat(p); - } - }); entityServerMap.put(player, entityServer); } render(getRecords(), entityServer, playerTraceShowData); @@ -168,14 +160,6 @@ public class Trace { REntityServer entityServer = entityServerMap.computeIfAbsent(player, k -> { REntityServer newEntityServer = new REntityServer(); newEntityServer.addPlayer(k); - newEntityServer.setCallback((p, rEntity, entityAction) -> { - if (entityAction != REntityAction.INTERACT) { - return; - } - if (rEntity instanceof TraceEntity) { - ((TraceEntity) rEntity).printIntoChat(p); - } - }); return newEntityServer; }); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index 204dcbc4..e2be5eb9 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -25,8 +25,9 @@ import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.bausystem.features.tracer.Trace; import de.steamwar.bausystem.features.tracer.TraceManager; import de.steamwar.entity.RBlockDisplay; -import de.steamwar.entity.RInteractionEntity; +import de.steamwar.entity.REntityAction; import de.steamwar.entity.REntityServer; +import de.steamwar.entity.RInteraction; import lombok.Getter; import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.Location; @@ -68,7 +69,7 @@ public class TraceEntity extends RBlockDisplay { private final String uniqueTntIdsString; private final Trace trace; - private final RInteractionEntity hitbox; + private final RInteraction hitbox; public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records, Trace trace) { super(server, location); @@ -76,7 +77,14 @@ public class TraceEntity extends RBlockDisplay { this.records = records; this.trace = trace; uniqueTntIdsString = records.stream().map(TNTPoint::getTntId).distinct().map(Object::toString).collect(Collectors.joining(" ")); - hitbox = new RInteractionEntity(server, location, TNT_VISUAL_SCALE, TNT_VISUAL_SCALE, this); + hitbox = new RInteraction(server, location); + hitbox.setInteractionHeight(TNT_VISUAL_SCALE); + hitbox.setInteractionWidth(TNT_VISUAL_SCALE); + hitbox.setCallback((player, action) -> { + if (action == REntityAction.INTERACT) { + printIntoChat(player); + } + }); setTransform(TNT_VISUAL_TRANSFORM); setBlock(material.createBlockData()); diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RInteractionEntity.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RInteractionEntity.java deleted file mode 100644 index ee97ac26..00000000 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RInteractionEntity.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.entity; - -import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.network.syncher.EntityDataSerializers; -import org.bukkit.Location; -import org.bukkit.entity.EntityType; - -import java.util.function.Consumer; - -public class RInteractionEntity extends REntity { - - private static final EntityDataAccessor widthWatcher = new EntityDataAccessor<>(8, EntityDataSerializers.FLOAT); - private static final EntityDataAccessor heightWatcher = new EntityDataAccessor<>(9, EntityDataSerializers.FLOAT); - - private float width; - private float height; - private final REntity owner; - - public RInteractionEntity(REntityServer server, Location location, float width, float height, REntity owner) { - super(server, EntityType.INTERACTION, location, 0); - this.width = width; - this.height = height; - this.owner = owner; - server.addEntity(this); - } - - @Override - protected void postSpawn(Consumer packetSink) { - super.postSpawn(packetSink); - packetSink.accept(getDataWatcherPacket(widthWatcher, width, heightWatcher, height)); - } - - public REntity getOwner() { - return owner; - } -} From 89e05cd10963a19bdc9b789468549587d40e612a Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sat, 30 May 2026 13:30:47 +0200 Subject: [PATCH 3/3] Remove remnatn of old impl --- .../SpigotCore_Main/src/de/steamwar/entity/REntityServer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java index b6e3d2d4..d980d439 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java @@ -59,7 +59,6 @@ public class REntityServer implements Listener { private final BiFunction filter = (player, packet) -> { REntity entity = entityMap.get(packet.getEntityId()); if (entity == null) return packet; - REntity targetEntity = entity instanceof RInteractionEntity ? ((RInteractionEntity) entity).getOwner() : entity; if (playersThatClicked.contains(player)) return null;