mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Allow placement options for pieces
This commit is contained in:
parent
b7b15a8f7b
commit
1493beb79b
@ -1,5 +1,6 @@
|
||||
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;
|
||||
@ -36,6 +37,10 @@ public class IrisJigsawPiece extends IrisRegistrant
|
||||
@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 transient AtomicCache<Integer> max2dDim = new AtomicCache<>();
|
||||
private transient AtomicCache<Integer> max3dDim = new AtomicCache<>();
|
||||
|
||||
@ -86,6 +91,12 @@ public class IrisJigsawPiece extends IrisRegistrant
|
||||
p.setPlaceMode(getPlaceMode());
|
||||
p.setConnectors(new KList<>());
|
||||
|
||||
if(getPlacementOverrides() != null)
|
||||
{
|
||||
// God fucking dammit
|
||||
p.setPlacementOverrides(new Gson().fromJson(new Gson().toJson(getPlacementOverrides()), IrisObjectPlacement.class));
|
||||
}
|
||||
|
||||
for(IrisJigsawPieceConnector i : getConnectors())
|
||||
{
|
||||
p.getConnectors().add(i.copy());
|
||||
|
@ -64,8 +64,21 @@ public class PlannedStructure {
|
||||
return after;
|
||||
}
|
||||
|
||||
public void place(PlannedPiece i, int startHeight, IrisObjectPlacement options, IObjectPlacer placer, EngineParallaxManager e)
|
||||
public void place(PlannedPiece i, int startHeight, IrisObjectPlacement o, IObjectPlacer placer, EngineParallaxManager e)
|
||||
{
|
||||
IrisObjectPlacement options = o;
|
||||
|
||||
if(i.getPiece().getPlacementOverrides() != null)
|
||||
{
|
||||
options= i.getPiece().getPlacementOverrides();
|
||||
options.getRotation().setEnabled(false);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
options.setMode(i.getPiece().getPlaceMode());
|
||||
}
|
||||
|
||||
IrisObject v = i.getObject();
|
||||
int sx = (v.getW()/2);
|
||||
int sz = (v.getD()/2);
|
||||
@ -73,7 +86,6 @@ public class PlannedStructure {
|
||||
int zz = i.getPosition().getZ() + sz;
|
||||
int offset = i.getPosition().getY() - startHeight;
|
||||
int height = placer.getHighest(xx, zz) + offset + (v.getH() / 2);
|
||||
options.setMode(i.getPiece().getPlaceMode());
|
||||
|
||||
if(options.getMode().equals(ObjectPlaceMode.PAINT) || options.isVacuum())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user