use of hellfirepvp.astralsorcery.common.data.sync.base.AbstractData in project AstralSorcery by HellFirePvP.
the class SyncDataHolder method tick.
@Override
public void tick(TickEvent.Type type, Object... context) {
if (dirtyData.isEmpty()) {
return;
}
Map<ResourceLocation, CompoundNBT> pktData = new HashMap<>();
synchronized (lck) {
for (ResourceLocation key : dirtyData) {
AbstractData dat = serverData.get(key);
if (dat != null) {
CompoundNBT nbt = new CompoundNBT();
dat.writeDiffDataToPacket(nbt);
pktData.put(key, nbt);
}
}
dirtyData.clear();
}
PktSyncData dataSync = new PktSyncData(pktData);
PacketChannel.CHANNEL.sendToAll(dataSync);
}
Aggregations