From 6c89fec5a122deb1ef891b0e76d838b9ddd25073 Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 27 Dec 2020 15:10:26 +0100 Subject: [PATCH] Simplify TraceEntity_12 --- .../bausystem/tracer/TraceEntity_12.java | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/BauSystem_12/src/de/steamwar/bausystem/tracer/TraceEntity_12.java b/BauSystem_12/src/de/steamwar/bausystem/tracer/TraceEntity_12.java index 292d514..cbf48d4 100644 --- a/BauSystem_12/src/de/steamwar/bausystem/tracer/TraceEntity_12.java +++ b/BauSystem_12/src/de/steamwar/bausystem/tracer/TraceEntity_12.java @@ -50,21 +50,10 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity { @Override public AbstractTraceEntity display(Player player) { - PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0); - // Todo: - // Reflection needed? - setValue("c", packetPlayOutSpawnEntity, position.getX()); - setValue("d", packetPlayOutSpawnEntity, position.getY()); - setValue("e", packetPlayOutSpawnEntity, position.getZ()); - setValue("f", packetPlayOutSpawnEntity, 0); - setValue("g", packetPlayOutSpawnEntity, 0); - setValue("h", packetPlayOutSpawnEntity, 0); + PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0, 0); PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; playerConnection.sendPacket(packetPlayOutSpawnEntity); - PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this); - playerConnection.sendPacket(packetPlayOutEntityTeleport); - if (tnt) { PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true); playerConnection.sendPacket(packetPlayOutEntityMetadata); @@ -81,14 +70,4 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity { return this; } - private static void setValue(String field, Object object, Object value) { - try { - Field f = object.getClass().getDeclaredField(field); - f.setAccessible(true); - f.set(object, value); - } catch (NoSuchFieldException | IllegalAccessException e) { - throw new SecurityException(e); - } - } - }