Performance Improvements

This commit is contained in:
Daniel Mills 2021-01-10 08:48:58 -05:00
parent 6bf65c7c74
commit 3884af64a7
4 changed files with 39 additions and 8 deletions

View File

@ -1,6 +1,5 @@
package com.volmit.iris.object;
import com.google.gson.Gson;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -23,16 +22,16 @@ public class IrisJigsawPiece extends IrisRegistrant
@Desc("The object this piece represents")
private String object = "";
@DontObfuscate
@Desc("Options for placement")
private IrisObjectPlacementOptions placementOptions = new IrisObjectPlacementOptions();
@Required
@DontObfuscate
@ArrayType(type = IrisJigsawPieceConnector.class, min = 1)
@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;
public IrisJigsawPieceConnector getConnector(IrisPosition relativePosition) {
for(IrisJigsawPieceConnector i : connectors)
{
@ -46,6 +45,19 @@ public class IrisJigsawPiece extends IrisRegistrant
}
public IrisJigsawPiece copy() {
return new Gson().fromJson(new Gson().toJson(this), getClass());
IrisJigsawPiece p = new IrisJigsawPiece();
p.setObject(getObject());
p.setLoader(getLoader());
p.setLoadKey(getLoadKey());
p.setLoadFile(getLoadFile());
p.setPlaceMode(getPlaceMode());
p.setConnectors(new KList<>());
for(IrisJigsawPieceConnector i : getConnectors())
{
p.getConnectors().add(i.copy());
}
return p;
}
}

View File

@ -21,7 +21,6 @@ public class IrisJigsawPieceConnector
@Desc("The name of this connector, such as entry, or table node. This is a name for organization. Other connectors can specifically use targetName to target a specific connector type. Multiple connectors can use the same name.")
private String name = "";
@Required
@DontObfuscate
@Desc("Target a piece's connector with the specified name. For any piece's connector, define * or don't define it.")
@ -55,4 +54,16 @@ public class IrisJigsawPieceConnector
{
return direction.getFace().name() + "@(" + position.getX() + "," + position.getY() + "," + position.getZ() + ")";
}
public IrisJigsawPieceConnector copy() {
IrisJigsawPieceConnector c = new IrisJigsawPieceConnector();
c.setInnerConnector(isInnerConnector());
c.setTargetName(getTargetName());
c.setPosition(getPosition().copy());
c.setDirection(getDirection());
c.setRotateConnector(isRotateConnector());
c.setName(getName());
c.setPools(getPools().copy());
return c;
}
}

View File

@ -53,4 +53,8 @@ public class IrisPosition
public Location toLocation(World world) {
return new Location(world, x,y,z);
}
public IrisPosition copy() {
return new IrisPosition(x,y,z);
}
}

View File

@ -36,5 +36,9 @@ public enum ObjectPlaceMode
@Desc("Samples the height of the terrain at every x,z position of your object and pushes it down to the surface. It's pretty much like a melt function over the terrain.")
@DontObfuscate
PAINT;
PAINT,
@Desc("Applies multiple terrain features into the parallax layer before this object places to distort the height, essentially vacuuming the terrain's heightmap closer to the bottom of this object.")
@DontObfuscate
VACUUM;
}