use of com.irtimaled.bbor.common.models.DimensionId 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);
}
}
}
use of com.irtimaled.bbor.common.models.DimensionId in project BoundingBoxOutlineReloaded by irtimaled.
the class CommonProxy method structuresLoaded.
private void structuresLoaded(StructuresLoaded event) {
DimensionId dimensionId = event.getDimensionId();
StructureProcessor structureProcessor = getStructureProcessor(dimensionId);
structureProcessor.process(event.getStructures());
}
use of com.irtimaled.bbor.common.models.DimensionId in project BoundingBoxOutlineReloaded by irtimaled.
the class CommonProxy method worldLoaded.
private void worldLoaded(WorldLoaded event) {
DimensionId dimensionId = event.getDimensionId();
long seed = event.getSeed();
if (dimensionId == DimensionId.OVERWORLD) {
setSeed(seed);
setWorldSpawn(event.getSpawnX(), event.getSpawnZ());
}
Logger.info("create world dimension: %s (seed: %d)", dimensionId, seed);
}
use of com.irtimaled.bbor.common.models.DimensionId in project BoundingBoxOutlineReloaded by irtimaled.
the class CustomSphereProvider method add.
public static void add(Point center, double radius) {
DimensionId dimensionId = Player.getDimensionId();
int cacheKey = center.hashCode();
BoundingBoxSphere sphere = new BoundingBoxSphere(center, radius, BoundingBoxType.Custom);
getCache(dimensionId).put(cacheKey, sphere);
}
use of com.irtimaled.bbor.common.models.DimensionId in project BoundingBoxOutlineReloaded by irtimaled.
the class CustomSphereProvider method remove.
public static boolean remove(Point center) {
DimensionId dimensionId = Player.getDimensionId();
int cacheKey = center.hashCode();
return getCache(dimensionId).remove(cacheKey) != null;
}
Aggregations