use of com.minecolonies.coremod.network.messages.client.colony.ColonyViewBuildingViewMessage in project minecolonies by Minecolonies.
the class BuildingManager method sendFieldPackets.
/**
* Sends packages to update the fields.
*
* @param closeSubscribers the current event subscribers.
* @param newSubscribers the new event subscribers.
*/
private void sendFieldPackets(final Set<ServerPlayerEntity> closeSubscribers, final Set<ServerPlayerEntity> newSubscribers) {
if (isFieldsDirty || !newSubscribers.isEmpty()) {
final Set<ServerPlayerEntity> players = new HashSet<>();
if (isFieldsDirty) {
players.addAll(closeSubscribers);
}
players.addAll(newSubscribers);
for (final IBuilding building : buildings.values()) {
if (building instanceof BuildingFarmer) {
players.forEach(player -> Network.getNetwork().sendToPlayer(new ColonyViewBuildingViewMessage(building), player));
}
}
}
}
use of com.minecolonies.coremod.network.messages.client.colony.ColonyViewBuildingViewMessage in project minecolonies by ldtteam.
the class BuildingManager method sendBuildingPackets.
/**
* Sends packages to update the buildings.
*
* @param closeSubscribers the current event subscribers.
* @param newSubscribers the new event subscribers.
*/
private void sendBuildingPackets(final Set<ServerPlayerEntity> closeSubscribers, final Set<ServerPlayerEntity> newSubscribers) {
if (isBuildingsDirty || !newSubscribers.isEmpty()) {
final Set<ServerPlayerEntity> players = new HashSet<>();
if (isBuildingsDirty) {
players.addAll(closeSubscribers);
}
players.addAll(newSubscribers);
for (@NotNull final IBuilding building : buildings.values()) {
if (building.isDirty() || !newSubscribers.isEmpty()) {
players.forEach(player -> Network.getNetwork().sendToPlayer(new ColonyViewBuildingViewMessage(building), player));
}
}
}
}
use of com.minecolonies.coremod.network.messages.client.colony.ColonyViewBuildingViewMessage in project minecolonies by Minecolonies.
the class BuildingManager method sendBuildingPackets.
/**
* Sends packages to update the buildings.
*
* @param closeSubscribers the current event subscribers.
* @param newSubscribers the new event subscribers.
*/
private void sendBuildingPackets(final Set<ServerPlayerEntity> closeSubscribers, final Set<ServerPlayerEntity> newSubscribers) {
if (isBuildingsDirty || !newSubscribers.isEmpty()) {
final Set<ServerPlayerEntity> players = new HashSet<>();
if (isBuildingsDirty) {
players.addAll(closeSubscribers);
}
players.addAll(newSubscribers);
for (@NotNull final IBuilding building : buildings.values()) {
if (building.isDirty() || !newSubscribers.isEmpty()) {
players.forEach(player -> Network.getNetwork().sendToPlayer(new ColonyViewBuildingViewMessage(building), player));
}
}
}
}
use of com.minecolonies.coremod.network.messages.client.colony.ColonyViewBuildingViewMessage in project minecolonies by ldtteam.
the class BuildingManager method sendFieldPackets.
/**
* Sends packages to update the fields.
*
* @param closeSubscribers the current event subscribers.
* @param newSubscribers the new event subscribers.
*/
private void sendFieldPackets(final Set<ServerPlayerEntity> closeSubscribers, final Set<ServerPlayerEntity> newSubscribers) {
if (isFieldsDirty || !newSubscribers.isEmpty()) {
final Set<ServerPlayerEntity> players = new HashSet<>();
if (isFieldsDirty) {
players.addAll(closeSubscribers);
}
players.addAll(newSubscribers);
for (final IBuilding building : buildings.values()) {
if (building instanceof BuildingFarmer) {
players.forEach(player -> Network.getNetwork().sendToPlayer(new ColonyViewBuildingViewMessage(building), player));
}
}
}
}
Aggregations