use of com.irtimaled.bbor.common.messages.PayloadBuilder in project BoundingBoxOutlineReloaded by irtimaled.
the class CommonProxy method sendToPlayer.
private void sendToPlayer(int playerId, ServerPlayer player) {
for (Map.Entry<DimensionId, BoundingBoxCache> entry : dimensionCache.entrySet()) {
DimensionId dimensionId = entry.getKey();
BoundingBoxCache boundingBoxCache = entry.getValue();
if (boundingBoxCache == null)
return;
Set<AbstractBoundingBox> playerBoundingBoxes = playerBoundingBoxesCache.computeIfAbsent(playerId, k -> new HashSet<>());
Map<AbstractBoundingBox, Set<AbstractBoundingBox>> boundingBoxMap = boundingBoxCache.getBoundingBoxes();
for (AbstractBoundingBox key : boundingBoxMap.keySet()) {
if (playerBoundingBoxes.contains(key)) {
continue;
}
Set<AbstractBoundingBox> boundingBoxes = boundingBoxMap.get(key);
PayloadBuilder payload = AddBoundingBox.getPayload(dimensionId, key, boundingBoxes);
if (payload != null)
player.sendPacket(payload);
playerBoundingBoxes.add(key);
}
}
}
Aggregations