11package dev .compactmods .crafting .projector ;
22
3+ import javax .annotation .Nonnull ;
34import java .util .Optional ;
45import java .util .stream .Stream ;
56import dev .compactmods .crafting .api .field .MiniaturizationFieldSize ;
@@ -108,9 +109,7 @@ public static Stream<BlockPos> getMissingProjectors(IBlockReader level, BlockPos
108109 MiniaturizationFieldSize size = fieldSize .get ();
109110 BlockPos center = size .getCenterFromProjector (initialProjector , projectorFacing );
110111
111- return size .getProjectorLocations (center )
112- // inverted filter - if the projector doesn't point to the center or isn't a projector, add to list
113- .filter (proj -> !projectorFacesCenter (level , proj , center , size ));
112+ return getMissingProjectors (level , size , center );
114113 } else {
115114 // No opposing projector to limit field size.
116115 // Scan for a cross-axis projector to try to limit.
@@ -123,15 +122,21 @@ public static Stream<BlockPos> getMissingProjectors(IBlockReader level, BlockPos
123122 MiniaturizationFieldSize matchedSize = firstMatchedSize .get ();
124123
125124 BlockPos matchedCenter = matchedSize .getCenterFromProjector (initialProjector , projectorFacing );
126- return matchedSize .getProjectorLocations (matchedCenter )
127- .filter (proj -> !ProjectorHelper .projectorFacesCenter (level , proj , matchedCenter , matchedSize ));
125+ return ProjectorHelper .getMissingProjectors (level , matchedSize , matchedCenter );
128126 } else {
129127 // Need an opposing projector set up to limit size
130128 return ProjectorHelper .getValidOppositePositions (initialProjector , projectorFacing );
131129 }
132130 }
133131 }
134132
133+ @ Nonnull
134+ public static Stream <BlockPos > getMissingProjectors (IBlockReader level , MiniaturizationFieldSize size , BlockPos center ) {
135+ return size .getProjectorLocations (center )
136+ // inverted filter - if the projector doesn't point to the center or isn't a projector, add to list
137+ .filter (proj -> !projectorFacesCenter (level , proj , center , size ));
138+ }
139+
135140 public static boolean projectorFacesCenter (IBlockReader world , BlockPos proj , BlockPos actualCenter , MiniaturizationFieldSize size ) {
136141 return FieldProjectorBlock .getDirection (world , proj )
137142 .map (projFacing -> size .getCenterFromProjector (proj , projFacing ).equals (actualCenter ))
0 commit comments