Search in sources :

Example 1 with ClientChunkUpdatedEvent

use of com.minecolonies.api.colony.event.ClientChunkUpdatedEvent in project minecolonies by ldtteam.

the class ChunkClientDataHelper method applyCap.

/**
 * Applies the data tuple to the respective chunk
 *
 * @param chunkCapData colony data to apply
 * @param chunk        the chunk to apply to
 */
public static void applyCap(final ChunkCapData chunkCapData, final Chunk chunk) {
    final IColonyTagCapability cap = chunk.getCapability(CLOSE_COLONY_CAP, null).orElseGet(null);
    if (cap != null) {
        cap.setOwningColony(chunkCapData.owningColony, chunk);
        cap.setCloseColonies(chunkCapData.closeColonies);
    }
    MinecraftForge.EVENT_BUS.post(new ClientChunkUpdatedEvent(chunk));
}
Also used : ClientChunkUpdatedEvent(com.minecolonies.api.colony.event.ClientChunkUpdatedEvent) IColonyTagCapability(com.minecolonies.api.colony.IColonyTagCapability)

Example 2 with ClientChunkUpdatedEvent

use of com.minecolonies.api.colony.event.ClientChunkUpdatedEvent in project minecolonies by Minecolonies.

the class ChunkClientDataHelper method applyCap.

/**
 * Applies the data tuple to the respective chunk
 *
 * @param chunkCapData colony data to apply
 * @param chunk        the chunk to apply to
 */
public static void applyCap(final ChunkCapData chunkCapData, final Chunk chunk) {
    final IColonyTagCapability cap = chunk.getCapability(CLOSE_COLONY_CAP, null).orElseGet(null);
    if (cap != null) {
        cap.setOwningColony(chunkCapData.owningColony, chunk);
        cap.setCloseColonies(chunkCapData.closeColonies);
    }
    MinecraftForge.EVENT_BUS.post(new ClientChunkUpdatedEvent(chunk));
}
Also used : ClientChunkUpdatedEvent(com.minecolonies.api.colony.event.ClientChunkUpdatedEvent) IColonyTagCapability(com.minecolonies.api.colony.IColonyTagCapability)

Aggregations

IColonyTagCapability (com.minecolonies.api.colony.IColonyTagCapability)2 ClientChunkUpdatedEvent (com.minecolonies.api.colony.event.ClientChunkUpdatedEvent)2