From 8a78dcbc7831b1fa702b2a3289c25755af719720 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Wed, 13 Mar 2024 23:14:27 +0100 Subject: [PATCH] Added Advanced flag --- .../features/tracer/rendering/ViewFlag.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java index 16a53943..da6603af 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/rendering/ViewFlag.java @@ -21,7 +21,12 @@ package de.steamwar.bausystem.features.tracer.rendering; import de.steamwar.bausystem.features.tracer.TNTRecord; import de.steamwar.bausystem.features.tracer.rendering.TraceEntity; +import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; +import de.steamwar.entity.RFallingBlockEntity; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.util.Vector; import java.util.ArrayList; import java.util.Iterator; @@ -65,6 +70,39 @@ public abstract class ViewFlag { public void modify(REntityServer server, List entities) {} }; + public static ViewFlag ADVANCED = new ViewFlag(true, false, "advanced") { + @Override + public List filter(List records) {return records;} + + @Override + public void modify(REntityServer server, List entities) { + for(TraceEntity entity: entities) { + TNTRecord example = entity.getRecords().get(0); + + if(example.isExplosion()) continue; + + Location pos = example.getLocation(); + + Vector xVelocity = new Vector(example.getVelocity().getX(), 0, 0); + Vector yVelocity = new Vector(0, example.getVelocity().getY(), 0); + Vector zVelocity = new Vector(0, 0, example.getVelocity().getZ()); + + Vector firstVelocity = xVelocity.getX() >= zVelocity.getZ() ? xVelocity : zVelocity; + Vector secondVelocity = xVelocity.getX() <= zVelocity.getZ() ? xVelocity : zVelocity; + + pos = pos.add(yVelocity); + new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + + pos = pos.add(firstVelocity); + new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + + pos = pos.add(secondVelocity); + new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); + } + } + + }; + /** * Name of the flag */