use of com.minecolonies.api.colony.managers.interfaces.IBuildingManager in project AdvancedPeripherals by Seniorendi.
the class ColonyPeripheral method getBuildings.
@LuaFunction(mainThread = true)
public final Object getBuildings() throws LuaException {
IColony colony = getColony();
IBuildingManager manager = colony.getBuildingManager();
List<Object> buildingData = new ArrayList<>();
for (Map.Entry<BlockPos, IBuilding> building : manager.getBuildings().entrySet()) {
buildingData.add(MineColonies.buildingToObject(manager, building.getValue(), building.getKey()));
}
return buildingData;
}
use of com.minecolonies.api.colony.managers.interfaces.IBuildingManager in project minecolonies by ldtteam.
the class AbstractSchematicProvider method getChildren.
@Override
public Set<BlockPos> getChildren() {
// Validate childs existance
final IBuildingManager manager = colony.getBuildingManager();
List<BlockPos> toRemove = null;
for (final BlockPos pos : childSchematics) {
if (manager.getBuilding(pos) == null) {
if (toRemove == null) {
toRemove = new ArrayList<>();
}
toRemove.add(pos);
}
}
if (toRemove != null) {
final Set<BlockPos> oldPositions = new HashSet<>(this.childSchematics);
oldPositions.removeAll(toRemove);
this.childSchematics = ImmutableSet.copyOf(oldPositions);
}
return childSchematics;
}
Aggregations