Skip to content

Commit

Permalink
[Test Framework] Add a check in StructureTemplateBuilder#set to pre…
Browse files Browse the repository at this point in the history
…vent placing block outside template bondaries (#950)
  • Loading branch information
Sirttas authored May 11, 2024
1 parent 2d93ce5 commit abc54b7
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public StructureTemplateBuilder set(int x, int y, int z, BlockState state) {

@Override
public StructureTemplateBuilder set(int x, int y, int z, BlockState state, @Nullable CompoundTag nbt) {
if (x < 0 || y < 0 || z < 0 || x >= size.getX() || y >= size.getY() || z >= size.getZ()) {
throw new IllegalArgumentException("Block position is out of template bounds");
}
blocks.put(new BlockPos(x, y, z), new StructureTemplate.StructureBlockInfo(new BlockPos(x, y, z), state, nbt));
return this;
}
Expand Down

0 comments on commit abc54b7

Please sign in to comment.