use of org.spongepowered.api.registry.RegistryHolder in project SpongeCommon by SpongePowered.
the class VolumeTransformationTest method fillVolume.
private static SpongeArchetypeVolume fillVolume(final Vector3i min, final Vector3i max, final Vector3i origin) {
final Vector3i rawMin = min.min(max);
final Vector3i rawMax = max.max(min);
final Vector3i size = rawMax.sub(rawMin).add(Vector3i.ONE);
final Vector3i relativeMin = rawMin.sub(origin);
final RegistryHolder holder = Sponge.game();
final SpongeArchetypeVolume volume = new SpongeArchetypeVolume(relativeMin, size, holder);
final StubbedRegistry<BlockType> blockRegistry = (StubbedRegistry<BlockType>) RegistryTypes.BLOCK_TYPE.get();
final Vector3i volMax = volume.max().add(Vector3i.ONE);
IntStream.range(relativeMin.x(), volMax.x()).forEach(x -> IntStream.range(relativeMin.z(), volMax.z()).forEach(z -> IntStream.range(relativeMin.y(), volMax.y()).forEach(y -> {
final BlockType block = blockRegistry.createEntry("minecraft", String.format("volumetest{%d, %d, %d}", x, y, z));
final BlockState blockState = block.defaultState();
volume.setBlock(x, y, z, blockState);
})));
return volume;
}
Aggregations