aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/tectech/thing/metaTileEntity/hatch/MTEHatchParam.java
blob: 2bf8a2c31205bc59543f478ca4f7ffc2815408f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
package tectech.thing.metaTileEntity.hatch;

import static net.minecraft.util.StatCollector.translateToLocalFormatted;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;

import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.math.Alignment;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.Textures;
import gregtech.api.gui.modularui.GTUIInfos;
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.modularui.IAddGregtechLogo;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.MTEHatch;
import gregtech.api.objects.GTRenderedTexture;
import gregtech.mixin.interfaces.accessors.EntityPlayerMPAccessor;
import tectech.TecTech;
import tectech.thing.gui.TecTechUITextures;
import tectech.util.CommonValues;
import tectech.util.TTUtility;

/**
 * Created by danie_000 on 15.12.2016.
 */
public class MTEHatchParam extends MTEHatch implements IAddGregtechLogo, IAddUIWidgets {

    public int pointer = 0;
    public int param = -1;
    public double value0D = 0;
    public double value1D = 0;
    public double input0D = 0;
    public double input1D = 0;
    private static Textures.BlockIcons.CustomIcon ScreenON;
    private static Textures.BlockIcons.CustomIcon ScreenOFF;

    private String clientLocale = "en_US";

    public MTEHatchParam(int aID, String aName, String aNameRegional, int aTier) {
        super(
            aID,
            aName,
            aNameRegional,
            aTier,
            0,
            new String[] { CommonValues.TEC_MARK_GENERAL,
                EnumChatFormatting.DARK_RED
                    + "Deprecated; Now you can set parameter by clicking LED on multiblock GUI.",
                EnumChatFormatting.DARK_RED
                    + "If it doesn't work, try removing Parametrizer from multiblock structure." });
        TTUtility.setTier(aTier, this);
    }

    public MTEHatchParam(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
        super(aName, aTier, 0, aDescription, aTextures);
    }

    @Override
    @SideOnly(Side.CLIENT)
    public void registerIcons(IIconRegister aBlockIconRegister) {
        super.registerIcons(aBlockIconRegister);
        ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/PARAM");
        ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/PARAM_ACTIVE");
    }

    @Override
    public ITexture[] getTexturesActive(ITexture aBaseTexture) {
        return new ITexture[] { aBaseTexture, new GTRenderedTexture(ScreenON) };
    }

    @Override
    public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
        return new ITexture[] { aBaseTexture, new GTRenderedTexture(ScreenOFF) };
    }

    @Override
    public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
        return new MTEHatchParam(mName, mTier, mDescriptionArray, mTextures);
    }

    @Override
    public boolean isGivingInformation() {
        return true;
    }

    @Override
    public String[] getInfoData() {
        return new String[] {
            translateToLocalFormatted("tt.keyword.Parametrizer", clientLocale) + " "
                + translateToLocalFormatted("tt.keyword.ID", clientLocale)
                + ": "
                + EnumChatFormatting.GREEN
                + param,
            translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 0D: " + EnumChatFormatting.AQUA + value0D,
            translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 1D: " + EnumChatFormatting.BLUE + value1D,
            translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 0D: " + EnumChatFormatting.GOLD + input0D,
            translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 1D: "
                + EnumChatFormatting.YELLOW
                + input1D, };
    }

    @Override
    public boolean isSimpleMachine() {
        return true;
    }

    @Override
    public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
        ItemStack aStack) {
        return false;
    }

    @Override
    public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
        ItemStack aStack) {
        return false;
    }

    @Override
    public void saveNBTData(NBTTagCompound aNBT) {
        super.saveNBTData(aNBT);
        aNBT.setInteger("ePointer", pointer);
        aNBT.setDouble("eValue0D", value0D);
        aNBT.setDouble("eValue1D", value1D);
        aNBT.setDouble("eInput0D", input0D);
        aNBT.setDouble("eInput1D", input1D);
        aNBT.setInteger("eParam", param);
    }

    @Override
    public void loadNBTData(NBTTagCompound aNBT) {
        super.loadNBTData(aNBT);
        pointer = aNBT.getInteger("ePointer");
        if (aNBT.hasKey("eFloats") || aNBT.hasKey("eValue0i")
            || aNBT.hasKey("eValue1i")
            || aNBT.hasKey("eInput0i")
            || aNBT.hasKey("eInput1i")) {
            boolean usesFloat = aNBT.getBoolean("eFloats");
            if (usesFloat) {
                value0D = Double.longBitsToDouble(aNBT.getLong("eValue0i"));
                value1D = Double.longBitsToDouble(aNBT.getLong("eValue1i"));
                input0D = Double.longBitsToDouble(aNBT.getLong("eInput0i"));
                input1D = Double.longBitsToDouble(aNBT.getLong("eInput1i"));
            } else {
                value0D = aNBT.getLong("eValue0i");
                value1D = aNBT.getLong("eValue1i");
                input0D = aNBT.getLong("eInput0i");
                input1D = aNBT.getLong("eInput1i");
            }
        } else {
            value0D = aNBT.getDouble("eValue0D");
            value1D = aNBT.getDouble("eValue1D");
            input0D = aNBT.getDouble("eInput0D");
            input1D = aNBT.getDouble("eInput1D");
        }
        param = aNBT.getInteger("eParam");
    }

    @Override
    public boolean isFacingValid(ForgeDirection facing) {
        return true;
    }

    @Override
    public boolean isAccessAllowed(EntityPlayer aPlayer) {
        return true;
    }

    @Override
    public boolean isValidSlot(int aIndex) {
        return false;
    }

    @Override
    public boolean isLiquidInput(ForgeDirection side) {
        return false;
    }

    @Override
    public boolean isFluidInputAllowed(FluidStack aFluid) {
        return false;
    }

    @Override
    public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
        if (aBaseMetaTileEntity.isClientSide()) {
            return true;
        }
        if (aPlayer instanceof EntityPlayerMPAccessor) {
            clientLocale = ((EntityPlayerMPAccessor) aPlayer).gt5u$getTranslator();
        }
        GTUIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
        return true;
    }

    @Override
    public void addGregTechLogo(ModularWindow.Builder builder) {
        builder.widget(
            new DrawableWidget().setDrawable(TecTechUITextures.PICTURE_TECTECH_LOGO_DARK)
                .setSize(18, 18)
                .setPos(112, 55));
    }

    @Override
    public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
        final boolean isAdvanced = mTier > 5;
        builder.widget(
            new DrawableWidget().setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE)
                .setPos(43, 4)
                .setSize(90, 72));

        addChangeParamButton(
            builder,
            (shift, columnPointer, secondRow) -> param -= shift ? 16 : 4,
            7,
            4,
            GTUITextures.OVERLAY_BUTTON_MINUS_LARGE,
            TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (secondRow.get()) {
                    secondRow.set(false);
                } else {
                    columnPointer.addAndGet(shift ? -16 : -4);
                }
            } else {
                value0D -= shift ? 4096 : 256;
            }
        }, 7, 22, GTUITextures.OVERLAY_BUTTON_MINUS_LARGE, TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_0);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (secondRow.get()) {
                    columnPointer.addAndGet(shift ? -16 : -4);
                } else {
                    secondRow.set(true);
                }
            } else {
                value1D -= shift ? 4096 : 256;
            }
        }, 7, 40, GTUITextures.OVERLAY_BUTTON_MINUS_LARGE, TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_1);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (shift) {
                    if (secondRow.get()) {
                        value1D = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL);
                    } else {
                        value0D = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL);
                    }
                } else {
                    if (secondRow.get()) {
                        long temp = Double.doubleToLongBits(value1D);
                        temp |= 1L << (long) columnPointer.get();
                        value1D = Double.longBitsToDouble(temp);
                    } else {
                        long temp = Double.doubleToLongBits(value0D);
                        temp |= 1L << (long) columnPointer.get();
                        value0D = Double.longBitsToDouble(temp);
                    }
                }
            } else {
                value0D /= shift ? 4096 : 256;
                value1D /= shift ? 4096 : 256;
            }
        },
            7,
            58,
            isAdvanced ? TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_S : GTUITextures.OVERLAY_BUTTON_MINUS_LARGE,
            isAdvanced ? null : TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);

        addChangeParamButton(
            builder,
            (shift, columnPointer, secondRow) -> param -= shift ? 2 : 1,
            25,
            4,
            GTUITextures.OVERLAY_BUTTON_MINUS_SMALL,
            TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (secondRow.get()) {
                    secondRow.set(false);
                } else {
                    columnPointer.addAndGet(shift ? -2 : -1);
                }
            } else {
                value0D -= shift ? 16 : 1;
            }
        }, 25, 22, GTUITextures.OVERLAY_BUTTON_MINUS_SMALL, TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_0);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (secondRow.get()) {
                    columnPointer.addAndGet(shift ? -2 : -1);
                } else {
                    secondRow.set(true);
                }
            } else {
                value1D -= shift ? 16 : 1;
            }
        }, 25, 40, GTUITextures.OVERLAY_BUTTON_MINUS_SMALL, TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_1);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (shift) {
                    if (secondRow.get()) {
                        value1D = Double.longBitsToDouble(0);
                    } else {
                        value0D = Double.longBitsToDouble(0);
                    }
                } else {
                    if (secondRow.get()) {
                        long temp = Double.doubleToLongBits(value1D);
                        temp &= ~(1L << (long) columnPointer.get());
                        value1D = Double.longBitsToDouble(temp);
                    } else {
                        long temp = Double.doubleToLongBits(value0D);
                        temp &= ~(1L << (long) columnPointer.get());
                        value0D = Double.longBitsToDouble(temp);
                    }
                }
            } else {
                value0D /= shift ? 16 : 2;
                value1D /= shift ? 16 : 2;
            }
        },
            25,
            58,
            isAdvanced ? TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_C : GTUITextures.OVERLAY_BUTTON_MINUS_SMALL,
            isAdvanced ? null : TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_X);

        addChangeParamButton(
            builder,
            (shift, columnPointer, secondRow) -> param += shift ? 2 : 1,
            133,
            4,
            GTUITextures.OVERLAY_BUTTON_PLUS_SMALL,
            TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (secondRow.get()) {
                    secondRow.set(false);
                } else {
                    columnPointer.addAndGet(shift ? 2 : 1);
                }
            } else {
                value0D += shift ? 16 : 1;
            }
        }, 133, 22, GTUITextures.OVERLAY_BUTTON_PLUS_SMALL, TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_0);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (secondRow.get()) {
                    columnPointer.addAndGet(shift ? 2 : 1);
                } else {
                    secondRow.set(true);
                }
            } else {
                value1D += shift ? 16 : 1;
            }
        }, 133, 40, GTUITextures.OVERLAY_BUTTON_PLUS_SMALL, TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_1);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (shift) {
                    if (secondRow.get()) {
                        value1D = Double.longBitsToDouble(~Double.doubleToLongBits(value1D));
                    } else {
                        value0D = Double.longBitsToDouble(~Double.doubleToLongBits(value1D));
                    }
                } else {
                    if (secondRow.get()) {
                        long temp = Double.doubleToLongBits(value1D);
                        temp ^= 1L << (long) columnPointer.get();
                        value1D = Double.longBitsToDouble(temp);
                    } else {
                        long temp = Double.doubleToLongBits(value0D);
                        temp ^= 1L << (long) columnPointer.get();
                        value0D = Double.longBitsToDouble(temp);
                    }
                }
            } else {
                value0D *= shift ? 16 : 2;
                value1D *= shift ? 16 : 2;
            }
        },
            133,
            58,
            isAdvanced ? TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_T : GTUITextures.OVERLAY_BUTTON_PLUS_SMALL,
            isAdvanced ? null : TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);

        addChangeParamButton(
            builder,
            (shift, columnPointer, secondRow) -> param += shift ? 16 : 4,
            151,
            4,
            GTUITextures.OVERLAY_BUTTON_PLUS_LARGE,
            TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (secondRow.get()) {
                    secondRow.set(false);
                } else {
                    columnPointer.addAndGet(shift ? 16 : 4);
                }
            } else {
                value0D += shift ? 4096 : 256;
            }
        }, 151, 22, GTUITextures.OVERLAY_BUTTON_PLUS_LARGE, TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_0);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                if (secondRow.get()) {
                    columnPointer.addAndGet(shift ? 16 : 4);
                } else {
                    secondRow.set(true);
                }
            } else {
                value1D += shift ? 4096 : 256;
            }
        }, 151, 40, GTUITextures.OVERLAY_BUTTON_PLUS_LARGE, TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_1);
        addChangeParamButton(builder, (shift, columnPointer, secondRow) -> {
            if (isAdvanced) {
                value0D = input0D;
                value1D = input1D;
            } else {
                value0D *= shift ? 4096 : 256;
                value1D *= shift ? 4096 : 256;
            }
        },
            151,
            58,
            isAdvanced ? TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_IF : GTUITextures.OVERLAY_BUTTON_PLUS_LARGE,
            isAdvanced ? null : TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);

        builder.widget(new FakeSyncWidget.IntegerSyncer(() -> pointer, val -> pointer = val))
            .widget(new FakeSyncWidget.IntegerSyncer(() -> param, val -> param = val))
            .widget(new FakeSyncWidget.DoubleSyncer(() -> value0D, val -> value0D = val))
            .widget(new FakeSyncWidget.DoubleSyncer(() -> value1D, val -> value1D = val))
            .widget(new FakeSyncWidget.DoubleSyncer(() -> input0D, val -> input0D = val))
            .widget(new FakeSyncWidget.DoubleSyncer(() -> input1D, val -> input1D = val));

        final String CIRCLED_0 = "\u24EA";
        final String CIRCLED_1 = "\u2460";
        final String ARROW_DOWN = "\u2b07";
        final String ARROW_UP = "\u2b06";
        builder.widget(
            TextWidget.dynamicString(() -> (isAdvanced ? "Parameters X: " : "Parameters: ") + param)
                .setSynced(false)
                .setDefaultColor(COLOR_TEXT_WHITE.get())
                .setPos(46, 7))
            .widget(
                TextWidget.dynamicString(() -> CIRCLED_0 + ARROW_DOWN + TTUtility.formatNumberExp(input0D))
                    .setSynced(false)
                    .setDefaultColor(0x22ddff)
                    .setPos(46, 16))
            .widget(
                TextWidget.dynamicString(() -> CIRCLED_1 + ARROW_DOWN + TTUtility.formatNumberExp(input1D))
                    .setSynced(false)
                    .setDefaultColor(0x00ffff)
                    .setPos(46, 24))
            .widget(
                TextWidget.dynamicString(() -> CIRCLED_0 + ARROW_UP + TTUtility.formatNumberExp(value0D))
                    .setSynced(false)
                    .setDefaultColor(0x00bbff)
                    .setPos(46, 33))
            .widget(
                TextWidget.dynamicString(() -> CIRCLED_1 + ARROW_UP + TTUtility.formatNumberExp(value1D))
                    .setSynced(false)
                    .setDefaultColor(0x0077ff)
                    .setPos(46, 41))
            .widget(
                TextWidget
                    .dynamicString(
                        () -> CIRCLED_0 + ARROW_UP + TTUtility.longBitsToShortString(Double.doubleToLongBits(value0D)))
                    .setSynced(false)
                    .setDefaultColor(0x00bbff)
                    .setScale(.5f)
                    .setTextAlignment(Alignment.CenterLeft)
                    .setPos(46, 50))
            .widget(
                TextWidget
                    .dynamicString(
                        () -> CIRCLED_1 + ARROW_UP + TTUtility.longBitsToShortString(Double.doubleToLongBits(value1D)))
                    .setSynced(false)
                    .setDefaultColor(0x0077ff)
                    .setScale(.5f)
                    .setTextAlignment(Alignment.CenterLeft)
                    .setPos(46, 58));
        if (isAdvanced) {
            builder.widget(
                TextWidget.dynamicString(
                    () -> "Pointer " + Integer.toHexString(pointer | 0x10000)
                        .substring(1))
                    .setSynced(false)
                    .setDefaultColor(0x0033ff)
                    .setPos(46, 66));
        }
    }

    private void addChangeParamButton(ModularWindow.Builder builder, OnClick onClick, int xPos, int yPos,
        IDrawable overlay1, IDrawable overlay2) {
        final boolean isAdvanced = mTier > 5;
        builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
            AtomicInteger columnPointer = new AtomicInteger(pointer & 0xff);
            AtomicBoolean secondRow = new AtomicBoolean((pointer & 0x0100) != 0);
            onClick.accept(clickData.shift, columnPointer, secondRow);
            TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click");
            if (isAdvanced) {
                if (columnPointer.get() >= 64) {
                    columnPointer.set(63);
                } else if (columnPointer.get() < 0) {
                    columnPointer.set(0);
                }
                pointer = secondRow.get() ? columnPointer.get() + 0x100 : columnPointer.get();
            }
            if (param > 9) {
                param = 9;
            } else if (param < -1) {
                param = -1;
            }
        })
            .setPlayClickSound(false)
            .setBackground(
                overlay2 != null ? new IDrawable[] { GTUITextures.BUTTON_STANDARD, overlay1, overlay2 }
                    : new IDrawable[] { GTUITextures.BUTTON_STANDARD, overlay1 })
            .setSize(18, 18)
            .setPos(xPos, yPos));
    }

    @FunctionalInterface
    private interface OnClick {

        void accept(boolean shift, AtomicInteger columnPointer, AtomicBoolean secondRow);
    }
}