Skip to content

Commit d957037

Browse files
Fix: Tracks should work when scanned in 1.21 too
1 parent b4d1858 commit d957037

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/java/nl/motionlesstrain/createcolonies/placementhandlers/TrackPlacementHandler.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public ActionProcessingResult handle(Blueprint blueprint, Level world, BlockPos
9898
}
9999
if (connection.contains("Positions", Tag.TAG_LIST)) {
100100
final ListTag positionInfo = BlockPosUtil.getList(connection, "Positions").stream().map(position -> {
101-
System.out.println("position: " + position);
102101
if (blueprintRotation.isMirrored()) {
103102
position = new BlockPos(-position.getX(), position.getY(), position.getZ());
104103
}
@@ -107,13 +106,11 @@ public ActionProcessingResult handle(Blueprint blueprint, Level world, BlockPos
107106
posTag.put("Pos", BlockPosUtil.toNBT(rotated));
108107
return posTag;
109108
}).collect(ListTag::new, ListTag::add, ListTag::addAll);
110-
System.out.println("positionInfo: " + positionInfo);
111109
connection.put("Positions", positionInfo);
112110
}
113111
}
114112
}
115113

116-
System.out.println("tileEntityData after converting: " + tileEntityData);
117114
return super.handle(world, pos, blockState, tileEntityData, complete, centerPos, settings);
118115
}
119116
}

src/main/java/nl/motionlesstrain/createcolonies/utils/BlockPosUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ public static List<BlockPos> getList(final CompoundTag parent, final String key)
2424
final List<BlockPos> decoded = new ArrayList<>();
2525
for (Tag posTag : list) {
2626
if (posTag instanceof CompoundTag compoundTag) {
27-
decoded.add(BlockPosUtil.fromNBT(compoundTag));
27+
if (compoundTag.contains("Pos")) {
28+
decoded.add(BlockPosUtil.fromNBT(compoundTag, "Pos"));
29+
} else {
30+
decoded.add(BlockPosUtil.fromNBT(compoundTag));
31+
}
2832
} else {
2933
decoded.add(BlockPosUtil.fromNBT(posTag));
3034
}

0 commit comments

Comments
 (0)