use of com.irtimaled.bbor.common.BoundingBoxCache in project BoundingBoxOutlineReloaded by irtimaled.
the class CacheProvider method get.
@Override
public Iterable<AbstractBoundingBox> get(DimensionId dimensionId) {
Boolean outerBoxesOnly = ConfigManager.outerBoxesOnly.get();
Set<AbstractBoundingBox> boundingBoxes = new HashSet<>();
BoundingBoxCache cache = getCache.apply(dimensionId);
if (cache != null) {
for (Map.Entry<AbstractBoundingBox, Set<AbstractBoundingBox>> entry : cache.getBoundingBoxes().entrySet()) {
AbstractBoundingBox key = entry.getKey();
if (BoundingBoxTypeHelper.shouldRender(key.getType()) && isWithinRenderDistance(key)) {
if (!outerBoxesOnly) {
Set<AbstractBoundingBox> children = entry.getValue();
if (children != null && children.size() > 0) {
boundingBoxes.addAll(children);
continue;
}
}
boundingBoxes.add(key);
}
}
}
return boundingBoxes;
}
use of com.irtimaled.bbor.common.BoundingBoxCache in project BoundingBoxOutlineReloaded by irtimaled.
the class ClientProxy method addBoundingBox.
private void addBoundingBox(AddBoundingBoxReceived event) {
BoundingBoxCache cache = getOrCreateCache(event.getDimensionId());
if (cache == null)
return;
cache.addBoundingBoxes(event.getKey(), event.getBoundingBoxes());
}
Aggregations