mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Planned structure init
This commit is contained in:
parent
6fd53d6e95
commit
8353c5105b
@ -1,2 +1,73 @@
|
|||||||
package com.volmit.iris.scaffold.jigsaw;public class PlannedStructure {
|
package com.volmit.iris.scaffold.jigsaw;
|
||||||
|
|
||||||
|
import com.volmit.iris.manager.IrisDataManager;
|
||||||
|
import com.volmit.iris.object.IrisJigsawStructure;
|
||||||
|
import com.volmit.iris.object.IrisPosition;
|
||||||
|
import com.volmit.iris.util.KList;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PlannedStructure {
|
||||||
|
private KList<PlannedPiece> pieces;
|
||||||
|
private IrisJigsawStructure structure;
|
||||||
|
private IrisPosition position;
|
||||||
|
private IrisDataManager data;
|
||||||
|
|
||||||
|
public PlannedStructure(IrisJigsawStructure structure, IrisPosition position)
|
||||||
|
{
|
||||||
|
this.structure = structure;
|
||||||
|
this.position = position;
|
||||||
|
this.data = structure.getLoader();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVolume()
|
||||||
|
{
|
||||||
|
int v = 0;
|
||||||
|
|
||||||
|
for(PlannedPiece i : pieces)
|
||||||
|
{
|
||||||
|
v += i.getObject().getH() * i.getObject().getW() * i.getObject().getD();
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMass()
|
||||||
|
{
|
||||||
|
int v = 0;
|
||||||
|
|
||||||
|
for(PlannedPiece i : pieces)
|
||||||
|
{
|
||||||
|
v += i.getObject().getBlocks().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean collidesWith(PlannedPiece piece)
|
||||||
|
{
|
||||||
|
for(PlannedPiece i : pieces)
|
||||||
|
{
|
||||||
|
if(i.collidesWith(piece))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(IrisPosition p)
|
||||||
|
{
|
||||||
|
for(PlannedPiece i : pieces)
|
||||||
|
{
|
||||||
|
if(i.contains(p))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user