@@ -239,7 +239,7 @@ private final boolean calcWidthUsingAdjIFrames(PlayerEntity player, AxisData cur
239239// final Boolean rowOffsetNeg = axisMatch ? varAxis1Neg : varAxis2Neg;
240240 assert (axisMatch ? varAxis1Neg : varAxis2Neg ) != null ;//rowOffsetNeg != null;
241241// final Boolean colOffsetNeg = axisMatch ? varAxis2Neg : varAxis1Neg;
242- // Main.LOGGER.info("AutoPlaceMapArt: recurRecalcUsingAdjIFrames, axisMatch="+axisMatch+", varAxis1Neg="+varAxis1Neg+", varAxis2Neg="+varAxis2Neg);
242+ Main .LOGGER .info ("AutoPlaceMapArt: recurRecalcUsingAdjIFrames, axisMatch=" +axisMatch +", varAxis1Neg=" +varAxis1Neg +", varAxis2Neg=" +varAxis2Neg );
243243
244244 final double SCAN_DIST = Configs .Generic .MAPART_AUTOPLACE_REACH .getDoubleValue () + 3d ;
245245 final Map <Vec3i , ItemFrameEntity > ifes = getReachableItemFrames (player , SCAN_DIST )
@@ -268,13 +268,17 @@ private final boolean calcWidthUsingAdjIFrames(PlayerEntity player, AxisData cur
268268 }
269269 final ItemFrameEntity ifeColNeg = ifes .get (getRelativeBp (currAxisData , !axisMatch , true ));
270270 if (ifeColNeg != null && isPartOfCurrentAutoPlace (ifeColNeg .getHeldItemStack ())){
271- final boolean result = recalcLayout (player , ifeColNeg , ifeColNeg .getHeldItemStack ());
271+ Main .LOGGER .info ("AutoPlaceMapArt: sub-call to recalcLayout() with col-1" );
272+ //TODO: current, this can trigger disableAndReset, killing the process
273+ final boolean result = recalcLayout (player , ifeColNeg , ifeColNeg .getHeldItemStack ()/*, sandbox=true*/ );
272274 if (result ) assert rowWidth != null ;
273275 return result ;
274276 }
275277 final ItemFrameEntity ifeColPos = ifes .get (getRelativeBp (currAxisData , !axisMatch , false ));
276278 if (ifeColPos != null && isPartOfCurrentAutoPlace (ifeColPos .getHeldItemStack ())){
277- final boolean result = recalcLayout (player , ifeColPos , ifeColPos .getHeldItemStack ());
279+ Main .LOGGER .info ("AutoPlaceMapArt: sub-call to recalcLayout() with col+1" );
280+ //TODO: current, this can trigger disableAndReset, killing the process
281+ final boolean result = recalcLayout (player , ifeColPos , ifeColPos .getHeldItemStack ()/*, sandbox=true*/ );
278282 if (result ) assert rowWidth != null ;
279283 return result ;
280284 }
@@ -395,7 +399,7 @@ public final boolean recalcLayout(final PlayerEntity player, final ItemFrameEnti
395399 Main .LOGGER .warn ("AutoPlaceMapArt: Invalid 1d X/SIZE pos! a=" +a +",b=" +b );
396400 disableAndReset (); return false ;
397401 }
398- Main .LOGGER .info ("AutoPlaceMapArt: for X/SIZE, curr(a)=" +a +", last(b)=" +b +", ifeOffset1=" +ifeOffset1 +", ifeOffset2=" +ifeOffset2 );
402+ Main .LOGGER .info ("AutoPlaceMapArt: for X/SIZE, size=" + ofSize + ", curr(a)=" +a +", last(b)=" +b +", ifeOffset1=" +ifeOffset1 +", ifeOffset2=" +ifeOffset2 );
399403 final int posOffset = a -b ;
400404 if (ifeOffset1 == 0 || ifeOffset2 == 0 ){
401405 final int ifeOffset = ifeOffset1 + ifeOffset2 ; // one of them is 0
@@ -439,11 +443,13 @@ else if(varAxis2Neg != isNeg){
439443 }
440444 final int candidateRowWidth = Math .abs (rowOffset )+1 ;
441445 if (ofSize % candidateRowWidth == 0 ){
446+ //TODO: prevent calcWidthUsingAdjIFrames() from being able to trigger disableAndReset in sub-calls
442447 final boolean determinedWidth = calcWidthUsingAdjIFrames (player , currAxisData , a , b );
443448 if (determinedWidth ){
444449 assert rowWidth != null && rowWidth != 0 ;
445450 Main .LOGGER .info ("AutoPlaceMapArt: determined rowWidth=" +rowWidth +" from calcWidthUsingAdjIFrames()" );
446451 }
452+ if (dir == null ) return false ; // If the sub-call triggered disableAndReset()
447453 }
448454 // A little hack to maximize future rowOffset; might not be necessary anymore, but used to help the logic above
449455 if (rowWidth == null ) updateLastIfe = false ;
@@ -459,8 +465,8 @@ else if(varAxis1Neg != null || varAxis2Neg != null){
459465 if (rowNeg != null ){
460466 final int test1 = posOffset - rowOffset *(rowNeg ? -1 : +1 );
461467 assert test1 % colOffset == 0 ;
462- Main .LOGGER .info ("AutoPlaceMapArt: rowNeg=" +rowNeg +", solving sys-of-eqs, test1=" +test1 +", posOffset=" +posOffset );
463468 rowWidth = Math .abs (test1 /colOffset );
469+ Main .LOGGER .info ("AutoPlaceMapArt: rowNeg=" +rowNeg +", solved sys-of-eqs, test1=" +test1 +", posOffset=" +posOffset +", rowWidth=" +rowWidth );
464470 assert rowWidth != 0 ;
465471// colNeg = test1/colOffset < 0;
466472 if (axisMatch ) varAxis2Neg = test1 /colOffset < 0 ;
@@ -503,7 +509,7 @@ else if(negWorks){
503509 }
504510 final Pos2DPair pos2dPair = getRelativePosPair (currPosStr , lastPosStr );
505511 if (pos2dPair == null ){
506- Main .LOGGER .info ("AutoPlaceMapArt: unable to parse pos2dPair from pos strs (" +currPosStr +"," +lastPosStr +")" );
512+ Main .LOGGER .warn ("AutoPlaceMapArt: unable to parse pos2dPair from pos strs (" +currPosStr +"," +lastPosStr +")" );
507513 disableAndReset (); return false ;
508514 }
509515
0 commit comments