Add entity spawn location setting

Also prevents entities from spawning when a building was not spawned
This commit is contained in:
CocoTheOwner 2021-03-06 14:54:28 +01:00
parent 24c4cbe901
commit f3ceda1b3d
2 changed files with 12 additions and 2 deletions

View File

@ -50,6 +50,11 @@ public class IrisJigsawPieceConnector
@Required @Required
private IrisPosition position = new IrisPosition(0,0,0); private IrisPosition position = new IrisPosition(0,0,0);
@DontObfuscate
@Desc("The relative position to this connector to place entities at")
@DependsOn({"spawnEntity"})
private IrisPosition entityPosition = null;
@DontObfuscate @DontObfuscate
@Desc("The direction this connector is facing. If the direction is set to UP, then pieces will place ABOVE the connector.") @Desc("The direction this connector is facing. If the direction is set to UP, then pieces will place ABOVE the connector.")
@Required @Required

View File

@ -114,9 +114,14 @@ public class PlannedStructure {
for(IrisJigsawPieceConnector j : i.getAvailableConnectors()) for(IrisJigsawPieceConnector j : i.getAvailableConnectors())
{ {
if(j.getSpawnEntity() != null) if(j.getSpawnEntity() != null && h != -1)
{ {
IrisPosition p = i.getWorldPosition(j).add(new IrisPosition(j.getDirection().toVector().multiply(2))); IrisPosition p = null;
if (j.getEntityPosition() == null){
p = new IrisPosition(j.getDirection().toVector().multiply(2));
} else {
p = i.getWorldPosition(j).add(j.getEntityPosition());
}
if(options.getMode().equals(ObjectPlaceMode.PAINT) || options.isVacuum()) if(options.getMode().equals(ObjectPlaceMode.PAINT) || options.isVacuum())
{ {