- Fixed NPE occuring when Jigsaw fails to find Object in pool. Now just produces a warning in the console like it should
- Fixed pointless copies of lists being created within PlannedStructure
- Fixed mobs spawning within other blocks and suffocating on spawn
- Fixed creating a jigsaw with a non existent object causing jigsaw commands to lock up (#377)
- Fixed editing a non existent jigsaw just not doing anything
This commit is contained in:
StrangeOne101 2021-06-19 19:34:46 +12:00 committed by DanLT
parent 82161c10f8
commit b6bc269505
4 changed files with 13 additions and 5 deletions

View File

@ -53,8 +53,11 @@ public class CommandIrisJigsawEdit extends MortarCommand
{ {
File dest = piece.getLoadFile(); File dest = piece.getLoadFile();
new JigsawEditor(sender.player(), piece, IrisDataManager.loadAnyObject(piece.getObject()), dest); new JigsawEditor(sender.player(), piece, IrisDataManager.loadAnyObject(piece.getObject()), dest);
return true;
} }
sender.sendMessage("Failed to find existing jigsaw piece: " + args[0]);
return true; return true;
} }

View File

@ -48,6 +48,12 @@ public class CommandIrisJigsawNew extends MortarCommand
} }
IrisObject object = IrisDataManager.loadAnyObject(args[2]); IrisObject object = IrisDataManager.loadAnyObject(args[2]);
if (object == null) {
sender.sendMessage("Failed to find existing object: " + args[2]);
return true;
}
File dest = Iris.instance.getDataFile("packs", args[1], "jigsaw-pieces", args[0] + ".json"); File dest = Iris.instance.getDataFile("packs", args[1], "jigsaw-pieces", args[0] + ".json");
new JigsawEditor(sender.player(), null, object, dest); new JigsawEditor(sender.player(), null, object, dest);
sender.sendMessage("* Right Click blocks to make them connectors"); sender.sendMessage("* Right Click blocks to make them connectors");

View File

@ -80,6 +80,6 @@ public class IrisEntityInitialSpawn
private Entity spawn100(Engine g, Location at) private Entity spawn100(Engine g, Location at)
{ {
return getRealEntity(g).spawn(g, at.clone().add(0, 1, 0), rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4))); return getRealEntity(g).spawn(g, at.clone().add(0.5, 1, 0.5), rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)));
} }
} }

View File

@ -179,7 +179,7 @@ public class PlannedStructure {
} }
private void generateOutwards() { private void generateOutwards() {
for(PlannedPiece i : getPiecesWithAvailableConnectors().shuffleCopy(rng)) for(PlannedPiece i : getPiecesWithAvailableConnectors().shuffle(rng))
{ {
if(!generatePieceOutwards(i)) if(!generatePieceOutwards(i))
{ {
@ -317,7 +317,7 @@ public class PlannedStructure {
{ {
IrisJigsawPiece pi = getData().getJigsawPieceLoader().load(j); IrisJigsawPiece pi = getData().getJigsawPieceLoader().load(j);
if(terminating && !pi.isTerminal()) if (pi == null || (terminating && !pi.isTerminal()))
{ {
continue; continue;
} }
@ -325,8 +325,7 @@ public class PlannedStructure {
p.addIfMissing(pi); p.addIfMissing(pi);
} }
} }
return p.shuffle(rng);
return p.shuffleCopy(rng);
} }
private void generateStartPiece() { private void generateStartPiece() {