1
0
mirror of https://github.com/demodude4u/Factorio-FBSR.git synced 2025-01-11 18:24:27 +02:00

Implemented new shifting alogrithm for 0.18.37-3

This commit is contained in:
Bilka 2020-07-29 12:10:12 +02:00
parent d0084b2566
commit 2aade83c4e

View File

@ -99,6 +99,7 @@ public class FBSR {
items.put(itemName, amount);
}
// Used before MapVersion(0, 18, 37, 3)
private static void alignRenderingTuplesToGrid(List<EntityRenderingTuple> entityRenderingTuples,
List<TileRenderingTuple> tileRenderingTuples) {
Multiset<Boolean> xAligned = LinkedHashMultiset.create();
@ -160,6 +161,16 @@ public class FBSR {
position.x += 0.5;
position.y += 0.5;
}
}
// Used since MapVersion(0, 18, 37, 3), due to game-internal bp string changes
private static void alignTileRenderingTuplesToGrid(List<TileRenderingTuple> tileRenderingTuples) {
for (TileRenderingTuple tuple : tileRenderingTuples) {
Point2D.Double position = tuple.tile.getPosition();
position.x += 0.5;
position.y += 0.5;
}
}
private static BufferedImage applyRendering(TaskReporting reporting, int tileSize, List<Renderer> renderers,
@ -963,7 +974,10 @@ public class FBSR {
tileRenderingTuples.add(tuple);
}
alignRenderingTuplesToGrid(entityRenderingTuples, tileRenderingTuples);
if (blueprint.getVersion().greaterOrEquals(new MapVersion(0, 18, 37, 3)))
alignTileRenderingTuplesToGrid(tileRenderingTuples);
else // legacy
alignRenderingTuplesToGrid(entityRenderingTuples, tileRenderingTuples);
entityRenderingTuples.forEach(t -> {
try {