SteamWar/BauSystem2.0
Archiviert
12
0

Trace Refactor #233

Zusammengeführt
YoyoNow hat 121 Commits von TracerGUI nach master 2024-04-21 16:03:26 +02:00 zusammengeführt
Nur Änderungen aus Commit 8a78dcbc78 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -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<TraceEntity> entities) {}
};
public static ViewFlag ADVANCED = new ViewFlag(true, false, "advanced") {
@Override
public List<TNTRecord> filter(List<TNTRecord> records) {return records;}
@Override
public void modify(REntityServer server, List<TraceEntity> 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
*/