Skip to content

Commit 1014022

Browse files
committed
Ignore air and void blocks when serializing structure
1 parent 433b30c commit 1014022

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/aztech/modern_industrialization/machines/multiblocks/structure/MIStructureTemplateManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import net.minecraft.resources.ResourceLocation;
5757
import net.minecraft.util.FastBufferedInputStream;
5858
import net.minecraft.world.level.Level;
59+
import net.minecraft.world.level.block.Blocks;
5960
import net.minecraft.world.level.block.entity.BlockEntity;
6061
import net.minecraft.world.level.block.state.BlockState;
6162
import net.minecraft.world.level.levelgen.structure.BoundingBox;
@@ -138,6 +139,10 @@ public static FromWorldResult fromWorld(Level level, BlockPos controllerPos, Dir
138139
for (BlockPos pos : BlockPos.betweenClosed(minPos, maxPos)) {
139140
BlockState state = toTemplateState(level, pos, level.getBlockState(pos), controllerDirection);
140141

142+
if (state.isAir() || state.is(Blocks.STRUCTURE_VOID)) {
143+
continue;
144+
}
145+
141146
CompoundTag blockTag = new CompoundTag();
142147

143148
blockTag.put("pos", NbtUtils.writeBlockPos(toTemplatePos(controllerPos, controllerDirection, pos)));

0 commit comments

Comments
 (0)