mirror of
https://github.com/neoforged/NeoForge.git
synced 2025-12-10 12:08:25 -06:00
[Test Framework] Add a check in StructureTemplateBuilder#set to prevent placing block outside template bondaries (#950)
This commit is contained in:
parent
2d93ce5e64
commit
abc54b7a49
@ -79,6 +79,9 @@ public class StructureTemplateBuilder implements TemplateBuilderHelper<Structure
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StructureTemplateBuilder set(int x, int y, int z, BlockState state, @Nullable CompoundTag nbt) {
|
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));
|
blocks.put(new BlockPos(x, y, z), new StructureTemplate.StructureBlockInfo(new BlockPos(x, y, z), state, nbt));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user