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

Fix jigsaw save locations

This commit is contained in:
Daniel Mills
2020-12-29 05:05:08 -05:00
parent 56ae387f7b
commit 3dc7bd74fe
16 changed files with 212 additions and 62 deletions

View File

@@ -19,8 +19,9 @@ public class IrisDataManager
private ResourceLoader<IrisDimension> dimensionLoader;
private ResourceLoader<IrisGenerator> generatorLoader;
private ResourceLoader<IrisStructure> structureLoader;
private ResourceLoader<IrisJigsawPiece> structurePieceLoader;
private ResourceLoader<IrisJigsawPool> structurePoolLoader;
private ResourceLoader<IrisJigsawPiece> jigsawPieceLoader;
private ResourceLoader<IrisJigsawPool> jigsawPoolLoader;
private ResourceLoader<IrisJigsawStructure> jigsawStructureLoader;
private ResourceLoader<IrisEntity> entityLoader;
private ResourceLoader<IrisBlockData> blockLoader;
private ObjectResourceLoader objectLoader;
@@ -51,9 +52,10 @@ public class IrisDataManager
this.biomeLoader = null;
this.dimensionLoader = null;
this.structureLoader = null;
this.structurePoolLoader = null;
this.structurePieceLoader = null;
this.jigsawPoolLoader = null;
this.jigsawPieceLoader = null;
this.generatorLoader = null;
this.jigsawStructureLoader = null;
this.blockLoader = null;
this.objectLoader = null;
}
@@ -82,8 +84,9 @@ 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.structurePoolLoader = new ResourceLoader<>(packs, this, "jigsaw-pools", "Jigsaw Pool", IrisJigsawPool.class);
this.structurePieceLoader = new ResourceLoader<>(packs, this, "jigsaw-pieces", "Jigsaw Piece", IrisJigsawPiece.class);
this.jigsawPoolLoader = new ResourceLoader<>(packs, this, "jigsaw-pools", "Jigsaw Pool", IrisJigsawPool.class);
this.jigsawStructureLoader = new ResourceLoader<>(packs, this, "jigsaw-structures", "Jigsaw Structure", IrisJigsawStructure.class);
this.jigsawPieceLoader = new ResourceLoader<>(packs, this, "jigsaw-pieces", "Jigsaw Piece", IrisJigsawPiece.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");
@@ -99,8 +102,9 @@ public class IrisDataManager
blockLoader.clearCache();
lootLoader.clearCache();
objectLoader.clearCache();
structurePieceLoader.clearCache();
structurePoolLoader.clearCache();
jigsawPieceLoader.clearCache();
jigsawPoolLoader.clearCache();
jigsawStructureLoader.clearCache();
regionLoader.clearCache();
dimensionLoader.clearCache();
entityLoader.clearCache();
@@ -122,9 +126,10 @@ public class IrisDataManager
regionLoader.clearList();
dimensionLoader.clearList();
generatorLoader.clearList();
jigsawStructureLoader.clearList();
structureLoader.clearList();
structurePoolLoader.clearList();
structurePieceLoader.clearList();
jigsawPoolLoader.clearList();
jigsawPieceLoader.clearList();
objectLoader.clearList();
}
@@ -143,14 +148,14 @@ public class IrisDataManager
return loadAny(key, (dm) -> dm.getStructureLoader().load(key, false));
}
public static IrisJigsawPiece loadAnyStructurePiece(String key)
public static IrisJigsawPiece loadAnyJigsawPiece(String key)
{
return loadAny(key, (dm) -> dm.getStructurePieceLoader().load(key, false));
return loadAny(key, (dm) -> dm.getJigsawPieceLoader().load(key, false));
}
public static IrisJigsawPool loadAnyStructurePool(String key)
public static IrisJigsawPool loadAnyJigsawPool(String key)
{
return loadAny(key, (dm) -> dm.getStructurePoolLoader().load(key, false));
return loadAny(key, (dm) -> dm.getJigsawPoolLoader().load(key, false));
}
public static IrisEntity loadAnyEntity(String key)
@@ -178,6 +183,11 @@ public class IrisDataManager
return loadAny(key, (dm) -> dm.getDimensionLoader().load(key, false));
}
public static IrisJigsawStructure loadAnyJigsawStructure(String key)
{
return loadAny(key, (dm) -> dm.getJigsawStructureLoader().load(key, false));
}
public static IrisGenerator loadAnyGenerator(String key)
{
return loadAny(key, (dm) -> dm.getGeneratorLoader().load(key, false));

View File

@@ -285,6 +285,7 @@ public class IrisProject
schemas.put(getSchemaEntry(IrisStructure.class, dm, "/structures/*.json"));
schemas.put(getSchemaEntry(IrisJigsawPiece.class, dm, "/jigsaw-pieces/*.json"));
schemas.put(getSchemaEntry(IrisJigsawPool.class, dm, "/jigsaw-pools/*.json"));
schemas.put(getSchemaEntry(IrisJigsawStructure.class, dm, "/jigsaw-structures/*.json"));
schemas.put(getSchemaEntry(IrisBlockData.class, dm, "/blocks/*.json"));
schemas.put(getSchemaEntry(IrisLootTable.class, dm, "/loot/*.json"));
settings.put("json.schemas", schemas);
@@ -325,7 +326,7 @@ public class IrisProject
blocks.add(dm.getBlockLoader().load(i));
}
//TODO: EXPORT STRUCTURE PIECES FROM STRUCTURES
//TODO: EXPORT JIGSAW 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,14 +382,14 @@ 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))
else if(k.isAnnotationPresent(RegistryListJigsawPiece.class))
{
String key = "enum-reg-structure-piece";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getStructurePieceLoader().getPossibleKeys()));
j.put("enum", new JSONArray(data.getJigsawPieceLoader().getPossibleKeys()));
definitions.put(key, j);
}
@@ -398,14 +398,30 @@ public class SchemaBuilder
description.add(SYMBOL_TYPE__N + " Must be a valid Jigsaw Piece (use ctrl+space for auto complete!)");
}
else if(k.isAnnotationPresent(RegistryListStructurePool.class))
else if(k.isAnnotationPresent(RegistryListJigsaw.class))
{
String key = "enum-reg-jigsaw";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getJigsawStructureLoader().getPossibleKeys()));
definitions.put(key, j);
}
fancyType = "Iris Jigsaw";
prop.put("$ref", "#/definitions/" + key);
description.add(SYMBOL_TYPE__N + " Must be a valid Jigsaw (use ctrl+space for auto complete!)");
}
else if(k.isAnnotationPresent(RegistryListJigsawPool.class))
{
String key = "enum-reg-structure-pool";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getStructurePoolLoader().getPossibleKeys()));
j.put("enum", new JSONArray(data.getJigsawPoolLoader().getPossibleKeys()));
definitions.put(key, j);
}
@@ -797,7 +813,7 @@ 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))
else if(k.isAnnotationPresent(RegistryListJigsawPiece.class))
{
fancyType = "List of Iris Jigsaw Pieces";
String key = "enum-reg-structure-piece";
@@ -805,7 +821,7 @@ public class SchemaBuilder
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getStructurePieceLoader().getPossibleKeys()));
j.put("enum", new JSONArray(data.getJigsawPieceLoader().getPossibleKeys()));
definitions.put(key, j);
}
@@ -815,7 +831,7 @@ public class SchemaBuilder
description.add(SYMBOL_TYPE__N + " Must be a valid Jigsaw Piece (use ctrl+space for auto complete!)");
}
else if(k.isAnnotationPresent(RegistryListStructurePool.class))
else if(k.isAnnotationPresent(RegistryListJigsawPool.class))
{
fancyType = "List of Iris Jigsaw Pools";
String key = "enum-reg-structure-pool";
@@ -823,7 +839,7 @@ public class SchemaBuilder
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getStructurePoolLoader().getPossibleKeys()));
j.put("enum", new JSONArray(data.getJigsawPoolLoader().getPossibleKeys()));
definitions.put(key, j);
}
@@ -833,6 +849,24 @@ public class SchemaBuilder
description.add(SYMBOL_TYPE__N + " Must be a valid Jigsaw Pool (use ctrl+space for auto complete!)");
}
else if(k.isAnnotationPresent(RegistryListJigsaw.class))
{
fancyType = "List of Iris Jigsaw Structures";
String key = "enum-reg-jigsaw";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getJigsawStructureLoader().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 Jigsaw (use ctrl+space for auto complete!)");
}
else if(t.type().equals(Enchantment.class))
{
fancyType = "List of Enchantment Types";

View File

@@ -42,7 +42,7 @@ public class CommandIrisJigsawEdit extends MortarCommand
}
IrisJigsawPiece piece = IrisDataManager.loadAnyStructurePiece(args[0]);
IrisJigsawPiece piece = IrisDataManager.loadAnyJigsawPiece(args[0]);
if(piece != null)
{

View File

@@ -48,7 +48,7 @@ public class CommandIrisJigsawNew extends MortarCommand
}
IrisObject object = IrisDataManager.loadAnyObject(args[2]);
File dest = Iris.instance.getDataFile("packs", args[1], "structure-pieces", args[0] + ".json");
File dest = Iris.instance.getDataFile("packs", args[1], "jigsaw-pieces", args[0] + ".json");
new JigsawEditor(sender.player(), null, object, dest);
sender.sendMessage("* Right Click blocks to make them connectors");
sender.sendMessage("* Right Click connectors to orient them");