package ru.dbotthepony.kstarbound.world.entities

import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
import ru.dbotthepony.kommons.io.BinaryStringCodec
import ru.dbotthepony.kommons.io.StreamCodec
import ru.dbotthepony.kommons.util.getValue
import ru.dbotthepony.kommons.util.setValue
import ru.dbotthepony.kstarbound.network.syncher.InternedStringCodec
import ru.dbotthepony.kstarbound.network.syncher.NetworkedGroup
import ru.dbotthepony.kstarbound.network.syncher.networkedData
import java.util.function.Consumer

class EffectEmitter(val entity: AbstractEntity) {
	val networkGroup = NetworkedGroup()

	// stoopid
	var currentEffects by networkGroup.add(networkedData(setOf(), pairCodec))
		private set

	companion object {
		private val pairCodec = StreamCodec.Collection(StreamCodec.Pair(InternedStringCodec, InternedStringCodec), ::ObjectOpenHashSet) as StreamCodec<Set<Pair<String, String>>>
	}
}
