Im trying to make a biome tracker that tracks what specific biomes you have visited and how many you have visited in total.
i am currently gettiung this error message
[Server thread/ERROR]:biome_tracker.js#28: Error in 'PlayerEvents.tick': TypeError: Cannot find function add in object [object Object].
i am pretty new to java script so i would appreciate the help:
````js
const checkInterval = 20
let biomeCache = {}
PlayerEvents.loggedIn(event => {
const player = event.player
const name = player.username
let saved = player.persistentData.biomesVisited
let biomeList = []
if (saved) biomeList = JSON.parse(JSON.stringify(saved))
biomeCache[name] = new Set(biomeList)
player.persistentData.biomeCount = biomeCache[name].size
console.log(biomeCache[name])
})
PlayerEvents.tick(event => {
const player = event.player
const name = player.username
if (player.age % checkInterval !== 0) return
const currentBiome = player.level.getBiome(player.blockPosition()).unwrapKey().get().location()
if (!currentBiome) return
if (!biomeCache[name].has(currentBiome)) {
biomeCache.add(currentBiome)
player.persistentData.biomesVisited = Array.from(biomeCache[name])
player.persistentData.biomeCount = biomeCache[name].size
player.tell(Text.green("New Biome Discovered" + currentBiome))
player.tell(Text.green("Biome Count" + biomeCount))
}
})