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.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.techhider.BlockIds;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; 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()); 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) { public void updateBlockVisibility(Block b, Material changedType) {
IntVector root = new IntVector(b.getX(), b.getY(), b.getZ()); IntVector root = new IntVector(b.getX(), b.getY(), b.getZ());
if (root.notInRegion(region)) if (root.notInRegion(region))
@ -168,20 +166,19 @@ public class Hull {
} }
} }
for (IntVector block : uncovered) if(uncovered.isEmpty())
printDebug(block.x, block.y, block.z); return;
//TODO uncover entities Set<IntVector> uncoveredSet = new HashSet<>(uncovered);
} Iterator<Entity> it = entities.iterator();
while(it.hasNext()) {
private final int air = BlockIds.impl.materialToId(Material.AIR); Entity entity = it.next();
private final int stone = BlockIds.impl.materialToId(Material.STONE); if(uncoveredSet.contains(new IntVector(entity.getLocation()))) { //TODO more precise
private final int red = BlockIds.impl.materialToId(Material.RED_CONCRETE); it.remove();
for(Player player : players)
private void printDebug(int x, int y, int z) { player.showEntity(FightSystem.getPlugin(), entity); //TODO 1.15-
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);
} }
private void forEachBorder(BiConsumer<IntVector, IntVector> f) { private void forEachBorder(BiConsumer<IntVector, IntVector> f) {