Jigsaw Enhancements

- Added keepEntity property for jigsaw connectors. When set to true, mobs spawned will not despawn
- Fixed jigsaw entities being spawned off-center
This commit is contained in:
StrangeOne101 2021-07-03 21:51:14 +12:00
parent 294324e31b
commit ced33114cc
2 changed files with 12 additions and 1 deletions

View File

@ -45,6 +45,10 @@ public class IrisJigsawPieceConnector
@Desc("Pick an entity to spawn on this connector")
private String spawnEntity;
@DontObfuscate
@Desc("Stop the entity from despawning")
private boolean keepEntity;
@DontObfuscate
@MaxNumber(50)
@MinNumber(1)

View File

@ -15,6 +15,7 @@ import lombok.Data;
import org.bukkit.Axis;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
@Data
public class PlannedStructure {
@ -170,7 +171,13 @@ public class PlannedStructure {
IrisPosition p = i.getWorldPosition(j).add(new IrisPosition(j.getDirection().toVector().multiply(2)));
IrisEntity e = getData().getEntityLoader().load(j.getSpawnEntity());
e.spawn(a.getCompound().getEngineForHeight(p.getY()), new Location(world, p.getX() + 0.5, p.getY(), p.getZ() + 0.5), rng);
if(a != null)
{
Entity entity = e.spawn(a.getCompound().getEngineForHeight(p.getY()), new Location(world, p.getX() + 0.5, p.getY(), p.getZ() + 0.5), rng);
if (j.isKeepEntity()) {
entity.setPersistent(true);
}
}
}
}
});