Connect up jigsaw pools with pieces

This commit is contained in:
Daniel Mills 2020-12-27 02:01:35 -05:00
parent 6f028eae6e
commit 6f29da1926
3 changed files with 47 additions and 8 deletions

View File

@ -283,7 +283,8 @@ public class IrisProject
schemas.put(getSchemaEntry(IrisRegion.class, dm, "/regions/*.json")); schemas.put(getSchemaEntry(IrisRegion.class, dm, "/regions/*.json"));
schemas.put(getSchemaEntry(IrisGenerator.class,dm, "/generators/*.json")); schemas.put(getSchemaEntry(IrisGenerator.class,dm, "/generators/*.json"));
schemas.put(getSchemaEntry(IrisStructure.class, dm, "/structures/*.json")); schemas.put(getSchemaEntry(IrisStructure.class, dm, "/structures/*.json"));
schemas.put(getSchemaEntry(IrisStructurePiece.class, dm, "/structure-pieces/*.json")); schemas.put(getSchemaEntry(IrisStructurePiece.class, dm, "/jigsaw-pieces/*.json"));
schemas.put(getSchemaEntry(IrisStructurePool.class, dm, "/jigsaw-pools/*.json"));
schemas.put(getSchemaEntry(IrisBlockData.class, dm, "/blocks/*.json")); schemas.put(getSchemaEntry(IrisBlockData.class, dm, "/blocks/*.json"));
schemas.put(getSchemaEntry(IrisLootTable.class, dm, "/loot/*.json")); schemas.put(getSchemaEntry(IrisLootTable.class, dm, "/loot/*.json"));
settings.put("json.schemas", schemas); settings.put("json.schemas", schemas);

View File

@ -393,9 +393,25 @@ public class SchemaBuilder
definitions.put(key, j); definitions.put(key, j);
} }
fancyType = "Iris Structure Piece"; fancyType = "Iris Jigsaw Piece";
prop.put("$ref", "#/definitions/" + key); prop.put("$ref", "#/definitions/" + key);
description.add(SYMBOL_TYPE__N + " Must be a valid Structure Piece (use ctrl+space for auto complete!)"); description.add(SYMBOL_TYPE__N + " Must be a valid Jigsaw Piece (use ctrl+space for auto complete!)");
}
else if(k.isAnnotationPresent(RegistryListStructurePool.class))
{
String key = "enum-reg-structure-pool";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getStructurePoolLoader().getPossibleKeys()));
definitions.put(key, j);
}
fancyType = "Iris Jigsaw Pool";
prop.put("$ref", "#/definitions/" + key);
description.add(SYMBOL_TYPE__N + " Must be a valid Jigsaw Piece (use ctrl+space for auto complete!)");
} }
else if(k.getType().equals(Enchantment.class)) else if(k.getType().equals(Enchantment.class))
@ -783,7 +799,7 @@ public class SchemaBuilder
else if(k.isAnnotationPresent(RegistryListStructurePiece.class)) else if(k.isAnnotationPresent(RegistryListStructurePiece.class))
{ {
fancyType = "List of Iris Structure Pieces"; fancyType = "List of Iris Jigsaw Pieces";
String key = "enum-reg-structure-piece"; String key = "enum-reg-structure-piece";
if(!definitions.containsKey(key)) if(!definitions.containsKey(key))
@ -796,7 +812,25 @@ public class SchemaBuilder
JSONObject items = new JSONObject(); JSONObject items = new JSONObject();
items.put("$ref", "#/definitions/" + key); items.put("$ref", "#/definitions/" + key);
prop.put("items", items); prop.put("items", items);
description.add(SYMBOL_TYPE__N + " Must be a valid Structure Piece (use ctrl+space for auto complete!)"); description.add(SYMBOL_TYPE__N + " Must be a valid Jigsaw Piece (use ctrl+space for auto complete!)");
}
else if(k.isAnnotationPresent(RegistryListStructurePool.class))
{
fancyType = "List of Iris Jigsaw Pools";
String key = "enum-reg-structure-pool";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(data.getStructurePoolLoader().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 Pool (use ctrl+space for auto complete!)");
} }
else if(t.type().equals(Enchantment.class)) else if(t.type().equals(Enchantment.class))

View File

@ -1,8 +1,6 @@
package com.volmit.iris.object; package com.volmit.iris.object;
import com.volmit.iris.util.Desc; import com.volmit.iris.util.*;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.Required;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -31,6 +29,12 @@ public class IrisStructurePieceConnector
@Desc("If set to true, this connector is allowed to place pieces inside of it's own piece. For example if you are adding a light post, or house on top of a path piece, you would set this to true to allow the piece to collide with the path bounding box.") @Desc("If set to true, this connector is allowed to place pieces inside of it's own piece. For example if you are adding a light post, or house on top of a path piece, you would set this to true to allow the piece to collide with the path bounding box.")
private boolean innerConnector = false; private boolean innerConnector = false;
@RegistryListStructurePool
@Desc("Pick piece pools to place onto this connector")
@ArrayType(type = String.class, min = 1)
@Required
private KList<String> pools = new KList<>();
@DontObfuscate @DontObfuscate
@Desc("The relative position this connector is located at for connecting to other pieces") @Desc("The relative position this connector is located at for connecting to other pieces")
@Required @Required