@@ -127,14 +127,14 @@ private boolean checkRotation(IWorldReader world, Rotation rot, AxisAlignedBB fi
127127 Map <BlockPos , BlockPos > layerRotated = BlockSpaceUtil .rotatePositionsInPlace (layerFilled , rot );
128128
129129 // Check that the rotated positions are correct
130- boolean layerMatches = areLayerPositionsCorrect (filledBounds , layerRotated .values ().toArray (new BlockPos [0 ]));
130+ boolean layerMatches = areLayerPositionsCorrect (layer . get (), filledBounds , layerRotated .values ().toArray (new BlockPos [0 ]));
131131 if (!layerMatches )
132132 return false ;
133133
134134 // Check the states are correct
135135 for (BlockPos unrotatedPos : layerFilled ) {
136136 BlockPos rotatedPos = layerRotated .get (unrotatedPos );
137- BlockPos normalizedRotatedPos = BlockSpaceUtil .normalizeLayerPosition (filledBounds , rotatedPos );
137+ BlockPos normalizedRotatedPos = BlockSpaceUtil .normalizeLayerPosition (filledBounds , rotatedPos ). down ( offset ) ;
138138
139139 BlockState actualState = world .getBlockState (unrotatedPos );
140140
@@ -194,19 +194,13 @@ public AxisAlignedBB getDimensions() {
194194 * @param filledPositions The filled positions on the layer to check.
195195 * @return
196196 */
197- public boolean areLayerPositionsCorrect (AxisAlignedBB fieldFilledBounds , BlockPos [] filledPositions ) {
197+ public boolean areLayerPositionsCorrect (IRecipeLayer layer , AxisAlignedBB fieldFilledBounds , BlockPos [] filledPositions ) {
198198 // Recipe layers using this method must define at least one filled space
199199 if (filledPositions .length == 0 )
200200 return false ;
201201
202- Optional <IRecipeLayer > layer = getRecipeLayerFromPositions (fieldFilledBounds , filledPositions );
203- if (!layer .isPresent ())
204- return false ;
205-
206- IRecipeLayer l = layer .get ();
207-
208202 int totalFilled = filledPositions .length ;
209- int requiredFilled = l .getNumberFilledPositions ();
203+ int requiredFilled = layer .getNumberFilledPositions ();
210204
211205 // Early exit if we don't have the correct number of blocks in the layer
212206 if (totalFilled != requiredFilled )
@@ -226,7 +220,7 @@ public boolean areLayerPositionsCorrect(AxisAlignedBB fieldFilledBounds, BlockPo
226220
227221 return Arrays .stream (fieldNormalizedPositionsLayerOffset )
228222 .parallel ()
229- .allMatch (l ::isPositionRequired );
223+ .allMatch (layer ::isPositionRequired );
230224 }
231225
232226 private Optional <IRecipeLayer > getRecipeLayerFromPositions (AxisAlignedBB fieldFilledBounds , BlockPos [] filledPositions ) {
0 commit comments