@@ -97,28 +97,20 @@ public abstract class GuiMultiblockHandler {
97
97
public static final BlockPos MB_PLACE_POS = new BlockPos (0 , 64 , 0 );
98
98
protected static final BlockPos SELECTED_BLOCK = new BlockPos ().set (NO_SELECTED_BLOCK );
99
99
100
- protected static int guiMouseX ;
101
- protected static int guiMouseY ;
102
- protected static int lastGuiMouseX ;
103
- protected static int lastGuiMouseY ;
100
+ protected static int guiMouseX , guiMouseY , guiLeft , guiTop ;
101
+ protected static int lastGuiMouseX , lastGuiMouseY ;
104
102
protected static Vector3f center ;
105
- protected static float rotationYaw ;
106
- protected static float rotationPitch ;
103
+ protected static float rotationYaw , rotationPitch ;
107
104
protected static float zoom ;
108
105
109
106
protected static ItemStack tooltipBlockStack ;
110
107
111
108
protected static int layerIndex = -1 ;
112
- protected static int guiColorBg ;
113
- protected static int guiColorFont ;
114
- protected static int buttonColorEnabled ;
115
- protected static int buttonColorDisabled ;
116
- protected static int buttonColorHovered ;
117
-
118
- protected static String guiTextLayer ;
119
- protected static String guiLayerButtonTitle ;
120
- protected static String guiTextTier ;
121
- protected static String guiTierButtonTitle ;
109
+ protected static int guiColorBg , guiColorFont ;
110
+ protected static int buttonColorEnabled , buttonColorDisabled , buttonColorHovered ;
111
+
112
+ protected static String guiTextLayer , guiLayerButtonTitle ;
113
+ protected static String guiTextTier , guiTierButtonTitle ;
122
114
protected static int initialTierButtonTitleWidth ;
123
115
protected static int initialLayerButtonTitleWidth ;
124
116
protected static int initialChannelTierButtonTitleWidth ;
@@ -131,9 +123,8 @@ public abstract class GuiMultiblockHandler {
131
123
protected Consumer <List <ItemStack >> onIngredientChanged ;
132
124
protected final Map <GuiButton , Runnable > buttons = new HashMap <>();
133
125
134
- protected IConstructable renderingController ;
126
+ protected IConstructable renderingController , lastRenderingController ;
135
127
protected ItemStack stackForm ;
136
- protected IConstructable lastRenderingController ;
137
128
138
129
public static final Long2ObjectMap <IStructureElement <IConstructable >> structureElementMap = new Long2ObjectOpenHashMap <>();
139
130
protected Consumer <List <List <ItemStack >>> onCandidateChanged ;
@@ -442,8 +433,8 @@ private void resetCenter() {
442
433
public void drawMultiblock () {
443
434
guiMouseX = GuiDraw .getMousePosition ().x ;
444
435
guiMouseY = GuiDraw .getMousePosition ().y ;
445
- int guiLeft = NEIClientUtils .getGuiContainer ().guiLeft ;
446
- int guiTop = NEIClientUtils .getGuiContainer ().guiTop ;
436
+ guiLeft = NEIClientUtils .getGuiContainer ().guiLeft ;
437
+ guiTop = NEIClientUtils .getGuiContainer ().guiTop ;
447
438
448
439
int guiHeight = NEIClientUtils .getGuiContainer ().height ;
449
440
if (guiHeight != lastHeight ) {
@@ -464,14 +455,11 @@ public void drawMultiblock() {
464
455
tooltipBlockStack = null ;
465
456
466
457
MovingObjectPosition rayTraceResult = renderer .getLastTraceResult ();
467
- boolean insideView = guiMouseX >= guiLeft + RECIPE_LAYOUT_X && guiMouseY >= guiTop + RECIPE_LAYOUT_Y
468
- && guiMouseX < guiLeft + RECIPE_LAYOUT_X + RECIPE_WIDTH
469
- && guiMouseY < guiTop + RECIPE_LAYOUT_Y + sceneHeight ;
470
458
boolean leftClickHeld = Mouse .isButtonDown (0 );
471
459
boolean rightClickHeld = Mouse .isButtonDown (1 );
472
460
boolean middleClickHeld = Mouse .isButtonDown (2 );
473
461
474
- if (insideView ) {
462
+ if (isInsideView () ) {
475
463
if (leftClickHeld ) {
476
464
rotationPitch += guiMouseX - lastGuiMouseX + 360 ;
477
465
rotationPitch = rotationPitch % 360 ;
@@ -551,6 +539,12 @@ public void drawMultiblock() {
551
539
// RenderHelper.disableStandardItemLighting();
552
540
}
553
541
542
+ private boolean isInsideView () {
543
+ return guiMouseX >= guiLeft + RECIPE_LAYOUT_X && guiMouseX <= guiLeft + RECIPE_LAYOUT_X + RECIPE_WIDTH
544
+ && guiMouseY >= guiTop + RECIPE_LAYOUT_Y
545
+ && guiMouseY <= guiTop + RECIPE_LAYOUT_Y + scaledSceneHeight ;
546
+ }
547
+
554
548
protected String getMultiblockName () {
555
549
return I18n .format (stackForm .getDisplayName ());
556
550
}
@@ -662,8 +656,12 @@ protected void initializeSceneRenderer(boolean resetCamera) {
662
656
}
663
657
}
664
658
665
- public void handleMouseScrollUp (int scrolled ) {
666
- this .scrolled = scrolled ;
659
+ public boolean handleMouseScrollUp (int scrolled ) {
660
+ if (isInsideView ()) {
661
+ this .scrolled = scrolled ;
662
+ return true ;
663
+ }
664
+ return false ;
667
665
}
668
666
669
667
protected String getTierButtonTitle () {
0 commit comments