mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
RN to jigsaw
This commit is contained in:
parent
6f29da1926
commit
3d00e96f89
@ -19,8 +19,8 @@ public class IrisDataManager
|
|||||||
private ResourceLoader<IrisDimension> dimensionLoader;
|
private ResourceLoader<IrisDimension> dimensionLoader;
|
||||||
private ResourceLoader<IrisGenerator> generatorLoader;
|
private ResourceLoader<IrisGenerator> generatorLoader;
|
||||||
private ResourceLoader<IrisStructure> structureLoader;
|
private ResourceLoader<IrisStructure> structureLoader;
|
||||||
private ResourceLoader<IrisStructurePiece> structurePieceLoader;
|
private ResourceLoader<IrisJigsawPiece> structurePieceLoader;
|
||||||
private ResourceLoader<IrisStructurePool> structurePoolLoader;
|
private ResourceLoader<IrisJigsawPool> structurePoolLoader;
|
||||||
private ResourceLoader<IrisEntity> entityLoader;
|
private ResourceLoader<IrisEntity> entityLoader;
|
||||||
private ResourceLoader<IrisBlockData> blockLoader;
|
private ResourceLoader<IrisBlockData> blockLoader;
|
||||||
private ObjectResourceLoader objectLoader;
|
private ObjectResourceLoader objectLoader;
|
||||||
@ -82,8 +82,8 @@ public class IrisDataManager
|
|||||||
this.biomeLoader = new ResourceLoader<>(packs, this, "biomes", "Biome", IrisBiome.class);
|
this.biomeLoader = new ResourceLoader<>(packs, this, "biomes", "Biome", IrisBiome.class);
|
||||||
this.dimensionLoader = new ResourceLoader<>(packs, this, "dimensions", "Dimension", IrisDimension.class);
|
this.dimensionLoader = new ResourceLoader<>(packs, this, "dimensions", "Dimension", IrisDimension.class);
|
||||||
this.structureLoader = new ResourceLoader<>(packs, this, "structures", "Structure", IrisStructure.class);
|
this.structureLoader = new ResourceLoader<>(packs, this, "structures", "Structure", IrisStructure.class);
|
||||||
this.structurePoolLoader = new ResourceLoader<>(packs, this, "jigsaw-pools", "Jigsaw Pool", IrisStructurePool.class);
|
this.structurePoolLoader = new ResourceLoader<>(packs, this, "jigsaw-pools", "Jigsaw Pool", IrisJigsawPool.class);
|
||||||
this.structurePieceLoader = new ResourceLoader<>(packs, this, "jigsaw-pieces", "Jigsaw Piece", IrisStructurePiece.class);
|
this.structurePieceLoader = new ResourceLoader<>(packs, this, "jigsaw-pieces", "Jigsaw Piece", IrisJigsawPiece.class);
|
||||||
this.generatorLoader = new ResourceLoader<>(packs, this, "generators", "Generator", IrisGenerator.class);
|
this.generatorLoader = new ResourceLoader<>(packs, this, "generators", "Generator", IrisGenerator.class);
|
||||||
this.blockLoader = new ResourceLoader<>(packs,this, "blocks", "Block", IrisBlockData.class);
|
this.blockLoader = new ResourceLoader<>(packs,this, "blocks", "Block", IrisBlockData.class);
|
||||||
this.objectLoader = new ObjectResourceLoader(packs, this, "objects", "Object");
|
this.objectLoader = new ObjectResourceLoader(packs, this, "objects", "Object");
|
||||||
@ -143,12 +143,12 @@ public class IrisDataManager
|
|||||||
return loadAny(key, (dm) -> dm.getStructureLoader().load(key, false));
|
return loadAny(key, (dm) -> dm.getStructureLoader().load(key, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IrisStructurePiece loadAnyStructurePiece(String key)
|
public static IrisJigsawPiece loadAnyStructurePiece(String key)
|
||||||
{
|
{
|
||||||
return loadAny(key, (dm) -> dm.getStructurePieceLoader().load(key, false));
|
return loadAny(key, (dm) -> dm.getStructurePieceLoader().load(key, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IrisStructurePool loadAnyStructurePool(String key)
|
public static IrisJigsawPool loadAnyStructurePool(String key)
|
||||||
{
|
{
|
||||||
return loadAny(key, (dm) -> dm.getStructurePoolLoader().load(key, false));
|
return loadAny(key, (dm) -> dm.getStructurePoolLoader().load(key, false));
|
||||||
}
|
}
|
||||||
|
@ -283,8 +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, "/jigsaw-pieces/*.json"));
|
schemas.put(getSchemaEntry(IrisJigsawPiece.class, dm, "/jigsaw-pieces/*.json"));
|
||||||
schemas.put(getSchemaEntry(IrisStructurePool.class, dm, "/jigsaw-pools/*.json"));
|
schemas.put(getSchemaEntry(IrisJigsawPool.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);
|
||||||
|
@ -4,7 +4,7 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.IrisSettings;
|
import com.volmit.iris.IrisSettings;
|
||||||
import com.volmit.iris.manager.IrisDataManager;
|
import com.volmit.iris.manager.IrisDataManager;
|
||||||
import com.volmit.iris.manager.edit.JigsawEditor;
|
import com.volmit.iris.manager.edit.JigsawEditor;
|
||||||
import com.volmit.iris.object.IrisStructurePiece;
|
import com.volmit.iris.object.IrisJigsawPiece;
|
||||||
import com.volmit.iris.util.KList;
|
import com.volmit.iris.util.KList;
|
||||||
import com.volmit.iris.util.MortarCommand;
|
import com.volmit.iris.util.MortarCommand;
|
||||||
import com.volmit.iris.util.MortarSender;
|
import com.volmit.iris.util.MortarSender;
|
||||||
@ -42,7 +42,7 @@ public class CommandIrisJigsawEdit extends MortarCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IrisStructurePiece piece = IrisDataManager.loadAnyStructurePiece(args[0]);
|
IrisJigsawPiece piece = IrisDataManager.loadAnyStructurePiece(args[0]);
|
||||||
|
|
||||||
if(piece != null)
|
if(piece != null)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ public class JigsawEditor implements Listener {
|
|||||||
private final Player player;
|
private final Player player;
|
||||||
private final IrisObject object;
|
private final IrisObject object;
|
||||||
private final File targetSaveLocation;
|
private final File targetSaveLocation;
|
||||||
private final IrisStructurePiece piece;
|
private final IrisJigsawPiece piece;
|
||||||
private final Location origin;
|
private final Location origin;
|
||||||
private final Cuboid cuboid;
|
private final Cuboid cuboid;
|
||||||
private final int ticker;
|
private final int ticker;
|
||||||
@ -32,7 +32,7 @@ public class JigsawEditor implements Listener {
|
|||||||
private final KMap<IrisPosition, Runnable> falling = new KMap<>();
|
private final KMap<IrisPosition, Runnable> falling = new KMap<>();
|
||||||
private final ChronoLatch cl = new ChronoLatch(100);
|
private final ChronoLatch cl = new ChronoLatch(100);
|
||||||
|
|
||||||
public JigsawEditor(Player player, IrisStructurePiece piece, IrisObject object, File saveLocation)
|
public JigsawEditor(Player player, IrisJigsawPiece piece, IrisObject object, File saveLocation)
|
||||||
{
|
{
|
||||||
if(editors.containsKey(player))
|
if(editors.containsKey(player))
|
||||||
{
|
{
|
||||||
@ -45,7 +45,7 @@ public class JigsawEditor implements Listener {
|
|||||||
origin = player.getLocation().clone().add(0, 7, 0);
|
origin = player.getLocation().clone().add(0, 7, 0);
|
||||||
target = origin;
|
target = origin;
|
||||||
this.targetSaveLocation = saveLocation;
|
this.targetSaveLocation = saveLocation;
|
||||||
this.piece = piece == null ? new IrisStructurePiece() : piece;
|
this.piece = piece == null ? new IrisJigsawPiece() : piece;
|
||||||
this.piece.setObject(object.getLoadKey());
|
this.piece.setObject(object.getLoadKey());
|
||||||
cuboid = new Cuboid(origin.clone(), origin.clone().add(object.getW()-1, object.getH()-1, object.getD()-1));
|
cuboid = new Cuboid(origin.clone(), origin.clone().add(object.getW()-1, object.getH()-1, object.getD()-1));
|
||||||
ticker = J.sr(this::onTick, 0);
|
ticker = J.sr(this::onTick, 0);
|
||||||
@ -93,8 +93,8 @@ public class JigsawEditor implements Listener {
|
|||||||
{
|
{
|
||||||
Vector v = e.getClickedBlock().getLocation().clone().subtract(origin.clone()).toVector();
|
Vector v = e.getClickedBlock().getLocation().clone().subtract(origin.clone()).toVector();
|
||||||
IrisPosition pos = new IrisPosition(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
IrisPosition pos = new IrisPosition(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
||||||
IrisStructurePieceConnector connector = null;
|
IrisJigsawPieceConnector connector = null;
|
||||||
for(IrisStructurePieceConnector i : piece.getConnectors())
|
for(IrisJigsawPieceConnector i : piece.getConnectors())
|
||||||
{
|
{
|
||||||
if(i.getPosition().equals(pos))
|
if(i.getPosition().equals(pos))
|
||||||
{
|
{
|
||||||
@ -105,7 +105,7 @@ public class JigsawEditor implements Listener {
|
|||||||
|
|
||||||
if(!player.isSneaking() && connector == null)
|
if(!player.isSneaking() && connector == null)
|
||||||
{
|
{
|
||||||
connector = new IrisStructurePieceConnector();
|
connector = new IrisJigsawPieceConnector();
|
||||||
connector.setDirection(IrisDirection.getDirection(e.getBlockFace()));
|
connector.setDirection(IrisDirection.getDirection(e.getBlockFace()));
|
||||||
connector.setPosition(pos);
|
connector.setPosition(pos);
|
||||||
piece.getConnectors().add(connector);
|
piece.getConnectors().add(connector);
|
||||||
@ -149,7 +149,7 @@ public class JigsawEditor implements Listener {
|
|||||||
|
|
||||||
f: for(IrisPosition i : falling.k())
|
f: for(IrisPosition i : falling.k())
|
||||||
{
|
{
|
||||||
for(IrisStructurePieceConnector j : piece.getConnectors())
|
for(IrisJigsawPieceConnector j : piece.getConnectors())
|
||||||
{
|
{
|
||||||
if(j.getPosition().equals(i))
|
if(j.getPosition().equals(i))
|
||||||
{
|
{
|
||||||
@ -160,7 +160,7 @@ public class JigsawEditor implements Listener {
|
|||||||
falling.remove(i).run();
|
falling.remove(i).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(IrisStructurePieceConnector i : piece.getConnectors())
|
for(IrisJigsawPieceConnector i : piece.getConnectors())
|
||||||
{
|
{
|
||||||
IrisPosition pos = i.getPosition();
|
IrisPosition pos = i.getPosition();
|
||||||
Location at = origin.clone().add(new Vector(pos.getX()+1, pos.getY()+1, pos.getZ()+1));
|
Location at = origin.clone().add(new Vector(pos.getX()+1, pos.getY()+1, pos.getZ()+1));
|
||||||
|
@ -14,7 +14,7 @@ import lombok.experimental.Accessors;
|
|||||||
@Desc("Represents a structure tile")
|
@Desc("Represents a structure tile")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class IrisStructurePiece extends IrisRegistrant
|
public class IrisJigsawPiece extends IrisRegistrant
|
||||||
{
|
{
|
||||||
@RegistryListObject
|
@RegistryListObject
|
||||||
@Required
|
@Required
|
||||||
@ -28,7 +28,7 @@ public class IrisStructurePiece extends IrisRegistrant
|
|||||||
|
|
||||||
@Required
|
@Required
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@ArrayType(type = IrisStructurePieceConnector.class, min = 1)
|
@ArrayType(type = IrisJigsawPieceConnector.class, min = 1)
|
||||||
@Desc("The connectors this object contains")
|
@Desc("The connectors this object contains")
|
||||||
private KList<IrisStructurePieceConnector> connectors = new KList<>();
|
private KList<IrisJigsawPieceConnector> connectors = new KList<>();
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ import lombok.experimental.Accessors;
|
|||||||
@Desc("Represents a structure tile")
|
@Desc("Represents a structure tile")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class IrisStructurePieceConnector
|
public class IrisJigsawPieceConnector
|
||||||
{
|
{
|
||||||
@Required
|
@Required
|
||||||
@DontObfuscate
|
@DontObfuscate
|
@ -14,7 +14,7 @@ import lombok.experimental.Accessors;
|
|||||||
@Desc("Represents a structure piece pool")
|
@Desc("Represents a structure piece pool")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class IrisStructurePool extends IrisRegistrant
|
public class IrisJigsawPool extends IrisRegistrant
|
||||||
{
|
{
|
||||||
@RegistryListStructurePiece
|
@RegistryListStructurePiece
|
||||||
@Required
|
@Required
|
Loading…
x
Reference in New Issue
Block a user