Skip to content

Commit 79b4679

Browse files
committed
Fix issue where recipes would incorrectly invalidate on size
Bounds check was reversed and recipes were not correctly invalidating themselves
1 parent bd1d1db commit 79b4679

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/com/robotgryphon/compactcrafting/blocks/FieldProjectorTile.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,20 @@ public void doRecipeScan() {
187187
Collection<RegistryObject<MiniaturizationRecipe>> entries = Registration.MINIATURIZATION_RECIPES.getEntries();
188188

189189
// If there are no registered recipes, then we obv can't match anything - exit early
190-
if (entries.isEmpty())
190+
if (entries.isEmpty()) {
191+
this.currentRecipe = null;
191192
return;
193+
}
192194

193195
AxisAlignedBB fieldBounds = field.getBounds();
194196

195197
MiniaturizationFieldBlockData fieldBlocks = MiniaturizationFieldBlockData.getFromField(world, fieldBounds);
196198

197199
// If no positions filled, exit early
198-
if(fieldBlocks.getNumberFilledBlocks() == 0)
200+
if(fieldBlocks.getNumberFilledBlocks() == 0) {
201+
this.currentRecipe = null;
199202
return;
203+
}
200204

201205
// ===========================================================================================================
202206
// RECIPE BEGIN
@@ -205,13 +209,15 @@ public void doRecipeScan() {
205209
.stream()
206210
.map(RegistryObject::get)
207211
.filter(recipe -> recipe.fitsInFieldSize(size))
208-
.filter(recipe -> BlockSpaceUtil.boundsFitsInside(fieldBlocks.getFilledBounds(), recipe.getDimensions()))
212+
.filter(recipe -> BlockSpaceUtil.boundsFitsInside(recipe.getDimensions(), fieldBlocks.getFilledBounds()))
209213
.collect(Collectors.toSet());
210214

211215
// All the recipes we have registered won't fit in the filled bounds -
212216
// blocks were placed in a larger space than the max recipe size
213-
if(recipesBoundFitted.size() == 0)
217+
if(recipesBoundFitted.size() == 0) {
218+
this.currentRecipe = null;
214219
return;
220+
}
215221

216222
// Begin recipe dry run - loop, check bottom layer for matches
217223
MiniaturizationRecipe matchedRecipe = null;

0 commit comments

Comments
 (0)