Added Advanced flag
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
D4rkr34lm 2024-03-13 23:14:27 +01:00
Ursprung 04b49fe827
Commit 8a78dcbc78

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
*/