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

Use object placement options for jigsaw pieces

This commit is contained in:
Daniel Mills
2021-01-12 18:33:02 -05:00
parent 2869a2157b
commit 658b0595ff
4 changed files with 51 additions and 16 deletions

View File

@@ -1,6 +1,5 @@
package com.volmit.iris.object;
import com.google.gson.Gson;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
@@ -33,13 +32,9 @@ public class IrisJigsawPiece extends IrisRegistrant
@Desc("The connectors this object contains")
private KList<IrisJigsawPieceConnector> connectors = new KList<>();
@Desc("Change how this object places depending on the terrain height map.")
@DontObfuscate
private ObjectPlaceMode placeMode = ObjectPlaceMode.FAST_MAX_HEIGHT;
@Desc("Configure everything about the object placement. Please don't define this unless you actually need it as using this option will slow down the jigsaw deign stage. Use this where you need it, just avoid using it everywhere to keep things fast.")
@DontObfuscate
private IrisObjectPlacement placementOverrides;
private IrisObjectPlacement placementOptions = new IrisObjectPlacement().setMode(ObjectPlaceMode.FAST_MAX_HEIGHT);
private transient AtomicCache<Integer> max2dDim = new AtomicCache<>();
private transient AtomicCache<Integer> max3dDim = new AtomicCache<>();
@@ -88,14 +83,8 @@ public class IrisJigsawPiece extends IrisRegistrant
p.setLoader(getLoader());
p.setLoadKey(getLoadKey());
p.setLoadFile(getLoadFile());
p.setPlaceMode(getPlaceMode());
p.setConnectors(new KList<>());
if(getPlacementOverrides() != null)
{
// God fucking dammit
p.setPlacementOverrides(new Gson().fromJson(new Gson().toJson(getPlacementOverrides()), IrisObjectPlacement.class));
}
p.setPlacementOptions(getPlacementOptions());
for(IrisJigsawPieceConnector i : getConnectors())
{
@@ -108,4 +97,8 @@ public class IrisJigsawPiece extends IrisRegistrant
public boolean isTerminal() {
return connectors.size() == 1;
}
public ObjectPlaceMode getPlaceMode() {
return getPlacementOptions().getMode();
}
}