SteamWar/BauSystem2.0
Archiviert
12
0

Improved Advanced-Flag to backtrack instead of going forward
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
D4rkr34lm 2024-05-10 18:34:50 +02:00
Ursprung 67f6363852
Commit f054710a95

Datei anzeigen

@ -26,10 +26,7 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.ArrayList; import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -120,26 +117,30 @@ public abstract class ViewFlag {
@Override @Override
public void modify(REntityServer server, List<TraceEntity> entities) { public void modify(REntityServer server, List<TraceEntity> entities) {
for (TraceEntity entity : entities) { for (TraceEntity entity : entities) {
TNTPoint current = entity.getRecords().get(0); TNTPoint representative = entity.getRecords().get(0);
if (current.isExplosion()) continue; Optional<TNTPoint> prev = representative.getPrevious();
TNTPoint next = current.getNext().orElse(null);
if (next == null) continue;
Location pos = current.getLocation().clone(); if (prev.isEmpty()) continue;
pos.setY(next.getLocation().getY());
if (pos.distanceSquared(current.getLocation()) >= 1.0 / 256.0) { TNTPoint previous = prev.get();
RFallingBlockEntity y = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS);
Location delta = representative.getLocation().clone().subtract(previous.getLocation());
Location yLocation = previous.getLocation().clone().add(0, delta.getY(), 0);
if (yLocation.distanceSquared(representative.getLocation()) >= 1.0 / 256.0 && yLocation.distanceSquared(previous.getLocation()) >= 1.0 / 256.0) {
RFallingBlockEntity y = new RFallingBlockEntity(server, yLocation, Material.WHITE_STAINED_GLASS);
y.setNoGravity(true); y.setNoGravity(true);
} }
if (current.getVelocity().getX() >= current.getVelocity().getZ()) { Location secoundLocation;
pos.setX(next.getLocation().getX()); if (delta.getX() >= delta.getZ()) {
secoundLocation = previous.getLocation().clone().add(delta.getX(), delta.getY(), 0);
} else { } else {
pos.setZ(next.getLocation().getZ()); secoundLocation = previous.getLocation().clone().add(0, delta.getY(), delta.getZ());
} }
if (pos.distanceSquared(next.getLocation()) >= 1.0 / 256.0) {
RFallingBlockEntity second = new RFallingBlockEntity(server, pos, Material.WHITE_STAINED_GLASS); if (secoundLocation.distanceSquared(representative.getLocation()) >= 1.0 / 256.0 && secoundLocation.distanceSquared(previous.getLocation()) >= 1.0 / 256.0) {
RFallingBlockEntity second = new RFallingBlockEntity(server, secoundLocation, Material.WHITE_STAINED_GLASS);
second.setNoGravity(true); second.setNoGravity(true);
} }
} }