SteamWar/FightSystem
Archiviert
13
1

HullHider v2 #408

Zusammengeführt
Lixfel hat 9 Commits von hullhiderv2 nach master 2024-01-03 16:26:05 +01:00 zusammengeführt
Nur Änderungen aus Commit ce3384c7e9 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -22,7 +22,6 @@ package de.steamwar.fightsystem.utils;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.techhider.BlockIds;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -144,10 +143,9 @@ public class Hull {
}
});
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> "[HullHider] initialisation finished: " + (System.currentTimeMillis() - start) + " ms, visible blocks: " + visibility.cardinality());
region.forEach(this::printDebug);
}
@SuppressWarnings("deprecation")
public void updateBlockVisibility(Block b, Material changedType) {
IntVector root = new IntVector(b.getX(), b.getY(), b.getZ());
if (root.notInRegion(region))
@ -168,20 +166,19 @@ public class Hull {
}
}
for (IntVector block : uncovered)
printDebug(block.x, block.y, block.z);
if(uncovered.isEmpty())
return;
//TODO uncover entities
}
private final int air = BlockIds.impl.materialToId(Material.AIR);
private final int stone = BlockIds.impl.materialToId(Material.STONE);
private final int red = BlockIds.impl.materialToId(Material.RED_CONCRETE);
private void printDebug(int x, int y, int z) {
int id = new IntVector(x, y, z).toId(region);
BlockIdWrapper.impl.setBlock(Config.world, x, y + Config.BlueExtendRegion.getSizeY(), z, visibility.get(id) ? (occluding.get(id) ? red : air) : stone);
Set<IntVector> uncoveredSet = new HashSet<>(uncovered);
Iterator<Entity> it = entities.iterator();
while(it.hasNext()) {
Entity entity = it.next();
if(uncoveredSet.contains(new IntVector(entity.getLocation()))) { //TODO more precise
it.remove();
for(Player player : players)
player.showEntity(FightSystem.getPlugin(), entity); //TODO 1.15-
}
}
}
private void forEachBorder(BiConsumer<IntVector, IntVector> f) {