From a5b90be2dbd147ec929ec16972175bcd343e6e58 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 22 Apr 2024 18:37:04 +0200 Subject: [PATCH] Final fix --- .../tracer/rendering/TraceEntity.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java index 090f3026..0f785468 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/TraceEntity.java @@ -19,20 +19,16 @@ package de.steamwar.bausystem.features.tracer.rendering; -import com.comphenix.tinyprotocol.Reflection; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tracer.TNTPoint; import de.steamwar.bausystem.features.tracer.Trace; import de.steamwar.bausystem.features.tracer.TraceManager; -import de.steamwar.core.Core; -import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; -import de.steamwar.techhider.BlockIds; +import de.steamwar.entity.RFallingBlockEntity; import lombok.Getter; import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import java.util.List; @@ -41,9 +37,7 @@ import java.util.stream.Collectors; /** * Wrapper for the rendering of a record bundle */ -public class TraceEntity extends REntity { - - private static final Reflection.MethodInvoker addEntityMethod = Reflection.getMethod(REntityServer.class, "addEntity", REntity.class); +public class TraceEntity extends RFallingBlockEntity { /** * The records represented by this REntity @@ -59,11 +53,10 @@ public class TraceEntity extends REntity { private final Trace trace; public TraceEntity(REntityServer server, Location location, boolean isExplosion, List records, Trace trace) { - super(server, EntityType.FALLING_BLOCK, location, BlockIds.impl.materialToId(isExplosion ? Material.RED_STAINED_GLASS : Material.TNT) >> (Core.getVersion() <= 12 ? 4 : 0)); + 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(" ")); - addEntityMethod.invoke(server, (REntity) this); setNoGravity(true); } @@ -85,11 +78,4 @@ public class TraceEntity extends REntity { BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_VELOCITY_Z", player, representative.getVelocity().getZ() + ""); BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_ISOLATE", player, BauSystem.MESSAGE.parse("TRACE_MESSAGE_CLICK_ISOLATE", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/trace isolate " + TraceManager.instance.getId(trace) + " " + uniqueTntIdsString)); } - - @Override - public boolean equals(Object object) { - if (!(object instanceof TraceEntity)) return false; - TraceEntity entity = (TraceEntity) object; - return records.get(0).equals(entity.getRecords().get(0)); - } }