use of mekanism.common.lib.multiblock.FormationProtocol.StructureRequirement in project Mekanism by mekanism.
the class CuboidStructureValidator method validateNode.
/**
* @param pos Mutable BlockPos
*/
protected FormationResult validateNode(FormationProtocol<T> ctx, Long2ObjectMap<IChunk> chunkMap, BlockPos pos) {
Optional<BlockState> optionalState = WorldUtils.getBlockState(world, chunkMap, pos);
if (!optionalState.isPresent()) {
// If the position is not in a loaded chunk or out of bounds of the world, fail
return FormationResult.FAIL;
}
BlockState state = optionalState.get();
StructureRequirement requirement = getStructureRequirement(pos);
if (requirement.isCasing()) {
CasingType type = getCasingType(state);
FormationResult ret = validateFrame(ctx, pos, state, type, requirement.needsFrame());
if (requirement != StructureRequirement.IGNORED && !ret.isFormed()) {
return ret;
}
} else if (!validateInner(state, chunkMap, pos)) {
return FormationResult.fail(MekanismLang.MULTIBLOCK_INVALID_INNER, pos);
} else if (!state.isAir(world, pos)) {
// Make sure the position is immutable before we store it
ctx.innerNodes.add(pos.immutable());
}
return FormationResult.SUCCESS;
}
Aggregations