Registry for jigsaw

This commit is contained in:
Daniel Mills 2020-12-26 05:00:26 -05:00
parent 5487cd7858
commit 5f50fa4202
3 changed files with 50 additions and 1 deletions

View File

@ -20,6 +20,7 @@ public class IrisDataManager
private ResourceLoader<IrisGenerator> generatorLoader;
private ResourceLoader<IrisStructure> structureLoader;
private ResourceLoader<IrisStructurePiece> structurePieceLoader;
private ResourceLoader<IrisStructurePool> structurePoolLoader;
private ResourceLoader<IrisEntity> entityLoader;
private ResourceLoader<IrisBlockData> blockLoader;
private ObjectResourceLoader objectLoader;
@ -50,6 +51,7 @@ public class IrisDataManager
this.biomeLoader = null;
this.dimensionLoader = null;
this.structureLoader = null;
this.structurePoolLoader = null;
this.structurePieceLoader = null;
this.generatorLoader = null;
this.blockLoader = null;
@ -80,7 +82,8 @@ 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.structurePoolLoader = new ResourceLoader<>(packs, this, "jigsaw-pools", "Jigsaw Pool", IrisStructurePool.class);
this.structurePieceLoader = new ResourceLoader<>(packs, this, "jigsaw-pieces", "Jigsaw 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");
@ -97,6 +100,7 @@ public class IrisDataManager
lootLoader.clearCache();
objectLoader.clearCache();
structurePieceLoader.clearCache();
structurePoolLoader.clearCache();
regionLoader.clearCache();
dimensionLoader.clearCache();
entityLoader.clearCache();
@ -119,6 +123,7 @@ public class IrisDataManager
dimensionLoader.clearList();
generatorLoader.clearList();
structureLoader.clearList();
structurePoolLoader.clearList();
structurePieceLoader.clearList();
objectLoader.clearList();
}
@ -143,6 +148,11 @@ public class IrisDataManager
return loadAny(key, (dm) -> dm.getStructurePieceLoader().load(key, false));
}
public static IrisStructurePool loadAnyStructurePool(String key)
{
return loadAny(key, (dm) -> dm.getStructurePoolLoader().load(key, false));
}
public static IrisEntity loadAnyEntity(String key)
{
return loadAny(key, (dm) -> dm.getEntityLoader().load(key, false));

View File

@ -0,0 +1,25 @@
package com.volmit.iris.object;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@DontObfuscate
@Desc("Represents a structure piece pool")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisStructurePool extends IrisRegistrant
{
@RegistryListStructurePiece
@Required
@DontObfuscate
@ArrayType(min = 1,type = String.class)
@Desc("A list of structure piece pools")
private KList<String> pieces = new KList<>();
}

View File

@ -0,0 +1,14 @@
package com.volmit.iris.util;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)
@Target({PARAMETER, TYPE, FIELD})
public @interface RegistryListStructurePool
{
}