9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-29 12:09:07 +00:00

Bugfixes for generation

This commit is contained in:
Daniel Mills
2020-12-20 21:04:11 -05:00
parent 70ae1cce4b
commit 1cf60544e1
11 changed files with 721 additions and 284 deletions

View File

@@ -19,6 +19,7 @@ public class IrisDataManager
private ResourceLoader<IrisDimension> dimensionLoader;
private ResourceLoader<IrisGenerator> generatorLoader;
private ResourceLoader<IrisStructure> structureLoader;
private ResourceLoader<IrisStructurePiece> structurePieceLoader;
private ResourceLoader<IrisEntity> entityLoader;
private ResourceLoader<IrisBlockData> blockLoader;
private ObjectResourceLoader objectLoader;
@@ -49,6 +50,7 @@ public class IrisDataManager
this.biomeLoader = null;
this.dimensionLoader = null;
this.structureLoader = null;
this.structurePieceLoader = null;
this.generatorLoader = null;
this.blockLoader = null;
this.objectLoader = null;
@@ -78,6 +80,7 @@ public class IrisDataManager
this.biomeLoader = new ResourceLoader<>(packs, this, "biomes", "Biome", IrisBiome.class);
this.dimensionLoader = new ResourceLoader<>(packs, this, "dimensions", "Dimension", IrisDimension.class);
this.structureLoader = new ResourceLoader<>(packs, this, "structures", "Structure", IrisStructure.class);
this.structurePieceLoader = new ResourceLoader<>(packs, this, "structure-pieces", "Structure Piece", IrisStructurePiece.class);
this.generatorLoader = new ResourceLoader<>(packs, this, "generators", "Generator", IrisGenerator.class);
this.blockLoader = new ResourceLoader<>(packs,this, "blocks", "Block", IrisBlockData.class);
this.objectLoader = new ObjectResourceLoader(packs, this, "objects", "Object");
@@ -93,6 +96,7 @@ public class IrisDataManager
blockLoader.clearCache();
lootLoader.clearCache();
objectLoader.clearCache();
structurePieceLoader.clearCache();
regionLoader.clearCache();
dimensionLoader.clearCache();
entityLoader.clearCache();
@@ -115,6 +119,7 @@ public class IrisDataManager
dimensionLoader.clearList();
generatorLoader.clearList();
structureLoader.clearList();
structurePieceLoader.clearList();
objectLoader.clearList();
}
@@ -133,6 +138,11 @@ public class IrisDataManager
return loadAny(key, (dm) -> dm.getStructureLoader().load(key, false));
}
public static IrisStructurePiece loadAnyStructurePiece(String key)
{
return loadAny(key, (dm) -> dm.getStructurePieceLoader().load(key, false));
}
public static IrisEntity loadAnyEntity(String key)
{
return loadAny(key, (dm) -> dm.getEntityLoader().load(key, false));

View File

@@ -283,6 +283,7 @@ public class IrisProject
schemas.put(getSchemaEntry(IrisRegion.class, dm, "/regions/*.json"));
schemas.put(getSchemaEntry(IrisGenerator.class,dm, "/generators/*.json"));
schemas.put(getSchemaEntry(IrisStructure.class, dm, "/structures/*.json"));
schemas.put(getSchemaEntry(IrisStructurePiece.class, dm, "/structure-pieces/*.json"));
schemas.put(getSchemaEntry(IrisBlockData.class, dm, "/blocks/*.json"));
schemas.put(getSchemaEntry(IrisLootTable.class, dm, "/loot/*.json"));
settings.put("json.schemas", schemas);
@@ -323,6 +324,7 @@ public class IrisProject
blocks.add(dm.getBlockLoader().load(i));
}
//TODO: EXPORT STRUCTURE PIECES FROM STRUCTURES
dimension.getRegions().forEach((i) -> regions.add(dm.getRegionLoader().load(i)));
dimension.getLoot().getTables().forEach((i) -> loot.add(dm.getLootLoader().load(i)));
regions.forEach((i) -> biomes.addAll(i.getAllBiomes(null)));

View File

@@ -382,6 +382,22 @@ public class SchemaBuilder
description.add(SYMBOL_TYPE__N + " Must be a valid Structure Tileset (use ctrl+space for auto complete!)");
}
else if(k.isAnnotationPresent(RegistryListStructurePiece.class))
{
String key = "enum-reg-structure-piece";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getStructurePieceLoader().getPossibleKeys()));
definitions.put(key, j);
}
fancyType = "Iris Structure Piece";
prop.put("$ref", "#/definitions/" + key);
description.add(SYMBOL_TYPE__N + " Must be a valid Structure Piece (use ctrl+space for auto complete!)");
}
else if(k.getType().equals(Enchantment.class))
{
String key = "enum-enchantment";
@@ -765,6 +781,24 @@ public class SchemaBuilder
description.add(SYMBOL_TYPE__N + " Must be a valid Structure Tileset (use ctrl+space for auto complete!)");
}
else if(k.isAnnotationPresent(RegistryListStructurePiece.class))
{
fancyType = "List of Iris Structure Pieces";
String key = "enum-reg-structure-piece";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getStructurePieceLoader().getPossibleKeys()));
definitions.put(key, j);
}
JSONObject items = new JSONObject();
items.put("$ref", "#/definitions/" + key);
prop.put("items", items);
description.add(SYMBOL_TYPE__N + " Must be a valid Structure Piece (use ctrl+space for auto complete!)");
}
else if(t.type().equals(Enchantment.class))
{
fancyType = "List of Enchantment Types";