Fix data managers

This commit is contained in:
Daniel Mills
2020-09-18 15:28:54 -04:00
parent 6e430861d7
commit 03f3b4f8d3
42 changed files with 3480 additions and 951 deletions

View File

@@ -40,35 +40,10 @@ public class IrisDataManager
private ResourceLoader<IrisBlockData> blockLoader;
private ObjectResourceLoader objectLoader;
public void hotloaded()
{
if(prod)
{
return;
}
File packs = this.packs.getName().equals("packs") ? this.packs : dataFolder;
packs.mkdirs();
this.lootLoader = new ResourceLoader<>(packs, "loot", "Loot", IrisLootTable.class);
this.entityLoader = new ResourceLoader<>(packs, "entities", "Entity", IrisEntity.class);
this.regionLoader = new ResourceLoader<>(packs, "regions", "Region", IrisRegion.class);
this.biomeLoader = new ResourceLoader<>(packs, "biomes", "Biome", IrisBiome.class);
this.dimensionLoader = new ResourceLoader<>(packs, "dimensions", "Dimension", IrisDimension.class);
this.structureLoader = new ResourceLoader<>(packs, "structures", "Structure", IrisStructure.class);
this.generatorLoader = new ResourceLoader<>(packs, "generators", "Generator", IrisGenerator.class);
this.blockLoader = new ResourceLoader<>(packs, "blocks", "Block", IrisBlockData.class);
this.objectLoader = new ObjectResourceLoader(packs, "objects", "Object");
if(packs.getName().equals("packs"))
{
writeExamples();
}
}
public IrisDataManager(File dataFolder)
{
this.dataFolder = dataFolder;
this.packs = new File(dataFolder, "packs");
this.packs = new File(dataFolder, ProjectManager.workspaceName);
boolean pr = false;
if(!packs.exists())
{
@@ -83,6 +58,31 @@ public class IrisDataManager
prod = pr;
}
public void hotloaded()
{
if(prod)
{
return;
}
File packs = this.packs.getName().equals(ProjectManager.workspaceName) ? this.packs : dataFolder;
packs.mkdirs();
this.lootLoader = new ResourceLoader<>(packs, "loot", "Loot", IrisLootTable.class);
this.entityLoader = new ResourceLoader<>(packs, "entities", "Entity", IrisEntity.class);
this.regionLoader = new ResourceLoader<>(packs, "regions", "Region", IrisRegion.class);
this.biomeLoader = new ResourceLoader<>(packs, "biomes", "Biome", IrisBiome.class);
this.dimensionLoader = new ResourceLoader<>(packs, "dimensions", "Dimension", IrisDimension.class);
this.structureLoader = new ResourceLoader<>(packs, "structures", "Structure", IrisStructure.class);
this.generatorLoader = new ResourceLoader<>(packs, "generators", "Generator", IrisGenerator.class);
this.blockLoader = new ResourceLoader<>(packs, "blocks", "Block", IrisBlockData.class);
this.objectLoader = new ObjectResourceLoader(packs, "objects", "Object");
if(packs.getName().equals(ProjectManager.workspaceName))
{
writeExamples();
}
}
public void dump()
{
biomeLoader.clearCache();