@@ -0,0 +1,1324 @@
+package com.edicatad.emvi.handlers;%0A%0Aimport com.edicatad.emvi.world.storage.VillagerData;%0A%0Aimport net.minecraft.world.World;%0A%0Apublic class NBTDataHandler %7B%0A%09private static VillagerData villagerData;%0A%09%0A%09private static final String tagName = %22EmVi%22;%0A%09%0A%09public static void init(World world)%7B%0A%09%09if(villagerData == null)%7B%0A%09%09%09villagerData = (VillagerData) world.getPerWorldStorage().getOrLoadData(VillagerData.class, tagName);%0A%09%09%09%0A%09%09%09if(villagerData == null)%7B%0A%09%09%09%09villagerData = new VillagerData(tagName);%0A%09%09%09%09world.getPerWorldStorage().setData(tagName, villagerData);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static int getVillagersSpawnedForChunk(int chunkX, int chunkZ)%7B%0A%09%09// this returns 0 if no villagers have spawned or if there is no data stored - functionally the same%0A%09%09return villagerData.getData().getInteger(String.format(%22x%25iz%25i%22, chunkX, chunkZ));%0A%09%7D%0A%09%0A%09public static void incrementVillagersSpawnedForChunk(int chunkX, int chunkZ)%7B%0A%09%09villagerData.getData().setInteger(String.format(%22x%25iz%25i%22, chunkX, chunkZ), getVillagersSpawnedForChunk(chunkX, chunkZ) + 1);%0A%09%7D%0A%09%0A%09public static void decrementVillagersSpawnedForChunk(int chunkX, int chunkZ)%7B%0A%09%09if(getVillagersSpawnedForChunk(chunkX, chunkZ) %3E 0)%7B%0A%09%09%09villagerData.getData().setInteger(String.format(%22x%25iz%25i%22, chunkX, chunkZ), getVillagersSpawnedForChunk(chunkX, chunkZ) - 1);%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add NBTDataHandler for interacting with data stored in VillagerData