Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #118 from GTNewHorizons/feature/multiblock-gui-no-…
Browse files Browse the repository at this point in the history
…inventory

Add no-inventory GUI for multiblock
  • Loading branch information
Dream-Master authored Dec 9, 2022
2 parents 33255d2 + 9cbf0f0 commit ed115f8
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class TecTechUITextures {
AdaptableUITexture.of(MODID, "gui/background/screen_blue", 90, 72, 2);
public static final UITexture BACKGROUND_SCREEN_BLUE_PARAMETRIZER_TXT =
UITexture.fullImage(MODID, "gui/background/screen_blue_parametrizer_txt");
public static final UITexture BACKGROUND_SCREEN_BLUE_NO_INVENTORY =
UITexture.fullImage(MODID, "gui/background/screen_blue_no_inventory");

public static final UITexture BUTTON_STANDARD_16x16 = UITexture.fullImage(MODID, "gui/button/standard_16x16");
public static final UITexture BUTTON_STANDARD_LIGHT_16x16 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2934,18 +2934,27 @@ public void addGregTechLogo(ModularWindow.Builder builder) {

@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
builder.widget(new DrawableWidget()
.setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE)
.setPos(4, 4)
.setSize(190, 91));
if (doesBindPlayerInventory()) {
builder.widget(new DrawableWidget()
.setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE)
.setPos(4, 4)
.setSize(190, 91));
} else {
builder.widget(new DrawableWidget()
.setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE_NO_INVENTORY)
.setPos(4, 4)
.setSize(190, 171));
}
final SlotWidget inventorySlot = new SlotWidget(inventoryHandler, 1);
builder.widget(inventorySlot
.setBackground(getGUITextureSet().getItemSlot(), TecTechUITextures.OVERLAY_SLOT_MESH)
.setPos(173, 167))
.widget(new DrawableWidget()
.setDrawable(TecTechUITextures.PICTURE_HEAT_SINK_SMALL)
.setPos(173, 185)
.setSize(18, 6));
if (doesBindPlayerInventory()) {
builder.widget(inventorySlot
.setBackground(getGUITextureSet().getItemSlot(), TecTechUITextures.OVERLAY_SLOT_MESH)
.setPos(173, 167))
.widget(new DrawableWidget()
.setDrawable(TecTechUITextures.PICTURE_HEAT_SINK_SMALL)
.setPos(173, 185)
.setSize(18, 6));
}

final DynamicPositionedColumn screenElements = new DynamicPositionedColumn();
drawTexts(screenElements, inventorySlot);
Expand Down Expand Up @@ -2980,7 +2989,7 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont
}
return ret.toArray(new IDrawable[0]);
})
.setPos(174, 116)
.setPos(174, doesBindPlayerInventory() ? 116 : 140)
.setSize(16, 16);
if (isPowerPassButtonEnabled()) {
powerPassButton.addTooltip("Power Pass").setTooltipShowUpDelay(TOOLTIP_DELAY);
Expand Down Expand Up @@ -3010,7 +3019,7 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont
}
return ret.toArray(new IDrawable[0]);
})
.setPos(174, 132)
.setPos(174, doesBindPlayerInventory() ? 132 : 156)
.setSize(16, 16);
if (isSafeVoidButtonEnabled()) {
safeVoidButton.addTooltip("Safe Void").setTooltipShowUpDelay(TOOLTIP_DELAY);
Expand Down Expand Up @@ -3043,7 +3052,7 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont
}
return ret.toArray(new IDrawable[0]);
})
.setPos(174, 148)
.setPos(174, doesBindPlayerInventory() ? 148 : 172)
.setSize(16, 16);
if (isAllowedToWorkButtonEnabled()) {
powerSwitchButton.addTooltip("Power Switch").setTooltipShowUpDelay(TOOLTIP_DELAY);
Expand All @@ -3063,7 +3072,7 @@ public void draw(float partialTicks) {
LEDCounter = (byte) ((1 + LEDCounter) % 6);
}
}.setDrawable(TecTechUITextures.PICTURE_PARAMETER_BLANK)
.setPos(5, 96)
.setPos(5, doesBindPlayerInventory() ? 96 : 176)
.setSize(166, 12));
for (int hatch = 0; hatch < 10; hatch++) {
for (int param = 0; param < 2; param++) {
Expand All @@ -3072,51 +3081,53 @@ public void draw(float partialTicks) {
}
}

builder.widget(new DrawableWidget()
.setDrawable(TecTechUITextures.PICTURE_UNCERTAINTY_MONITOR_MULTIMACHINE)
.setPos(173, 96)
.setSize(18, 18));
for (int i = 0; i < 9; i++) {
final int index = i;
if (doesBindPlayerInventory()) {
builder.widget(new DrawableWidget()
.setDrawable(() -> {
UITexture valid = TecTechUITextures.PICTURE_UNCERTAINTY_VALID[index];
UITexture invalid = TecTechUITextures.PICTURE_UNCERTAINTY_INVALID[index];
switch (eCertainMode) {
case 1: // ooo oxo ooo
if (index == 4) return eCertainStatus == 0 ? valid : invalid;
break;
case 2: // ooo xox ooo
if (index == 3) return (eCertainStatus & 1) == 0 ? valid : invalid;
if (index == 5) return (eCertainStatus & 2) == 0 ? valid : invalid;
break;
case 3: // oxo xox oxo
if (index == 1) return (eCertainStatus & 1) == 0 ? valid : invalid;
if (index == 3) return (eCertainStatus & 2) == 0 ? valid : invalid;
if (index == 5) return (eCertainStatus & 4) == 0 ? valid : invalid;
if (index == 7) return (eCertainStatus & 8) == 0 ? valid : invalid;
break;
case 4: // xox ooo xox
if (index == 0) return (eCertainStatus & 1) == 0 ? valid : invalid;
if (index == 2) return (eCertainStatus & 2) == 0 ? valid : invalid;
if (index == 6) return (eCertainStatus & 4) == 0 ? valid : invalid;
if (index == 8) return (eCertainStatus & 8) == 0 ? valid : invalid;
break;
case 5: // xox oxo xox
if (index == 0) return (eCertainStatus & 1) == 0 ? valid : invalid;
if (index == 2) return (eCertainStatus & 2) == 0 ? valid : invalid;
if (index == 4) return (eCertainStatus & 4) == 0 ? valid : invalid;
if (index == 6) return (eCertainStatus & 8) == 0 ? valid : invalid;
if (index == 8) return (eCertainStatus & 16) == 0 ? valid : invalid;
break;
}
return null;
})
.setPos(174 + (index % 3) * 6, 97 + (index / 3) * 6)
.setSize(4, 4));
.setDrawable(TecTechUITextures.PICTURE_UNCERTAINTY_MONITOR_MULTIMACHINE)
.setPos(173, 96)
.setSize(18, 18));
for (int i = 0; i < 9; i++) {
final int index = i;
builder.widget(new DrawableWidget()
.setDrawable(() -> {
UITexture valid = TecTechUITextures.PICTURE_UNCERTAINTY_VALID[index];
UITexture invalid = TecTechUITextures.PICTURE_UNCERTAINTY_INVALID[index];
switch (eCertainMode) {
case 1: // ooo oxo ooo
if (index == 4) return eCertainStatus == 0 ? valid : invalid;
break;
case 2: // ooo xox ooo
if (index == 3) return (eCertainStatus & 1) == 0 ? valid : invalid;
if (index == 5) return (eCertainStatus & 2) == 0 ? valid : invalid;
break;
case 3: // oxo xox oxo
if (index == 1) return (eCertainStatus & 1) == 0 ? valid : invalid;
if (index == 3) return (eCertainStatus & 2) == 0 ? valid : invalid;
if (index == 5) return (eCertainStatus & 4) == 0 ? valid : invalid;
if (index == 7) return (eCertainStatus & 8) == 0 ? valid : invalid;
break;
case 4: // xox ooo xox
if (index == 0) return (eCertainStatus & 1) == 0 ? valid : invalid;
if (index == 2) return (eCertainStatus & 2) == 0 ? valid : invalid;
if (index == 6) return (eCertainStatus & 4) == 0 ? valid : invalid;
if (index == 8) return (eCertainStatus & 8) == 0 ? valid : invalid;
break;
case 5: // xox oxo xox
if (index == 0) return (eCertainStatus & 1) == 0 ? valid : invalid;
if (index == 2) return (eCertainStatus & 2) == 0 ? valid : invalid;
if (index == 4) return (eCertainStatus & 4) == 0 ? valid : invalid;
if (index == 6) return (eCertainStatus & 8) == 0 ? valid : invalid;
if (index == 8) return (eCertainStatus & 16) == 0 ? valid : invalid;
break;
}
return null;
})
.setPos(174 + (index % 3) * 6, 97 + (index / 3) * 6)
.setSize(4, 4));
}
builder.widget(new FakeSyncWidget.ByteSyncer(() -> eCertainMode, val -> eCertainMode = val))
.widget(new FakeSyncWidget.ByteSyncer(() -> eCertainStatus, val -> eCertainStatus = val));
}
builder.widget(new FakeSyncWidget.ByteSyncer(() -> eCertainMode, val -> eCertainMode = val))
.widget(new FakeSyncWidget.ByteSyncer(() -> eCertainStatus, val -> eCertainStatus = val));
}

private void addParameterLED(ModularWindow.Builder builder, int hatch, int param, boolean input) {
Expand Down Expand Up @@ -3224,7 +3235,7 @@ public void draw(float partialTicks) {
return getFullLedDescriptionOut(hatch, param);
}
})
.setPos(12 + posIndex * 8, 97 + (input ? 0 : 1) * 6)
.setPos(12 + posIndex * 8, (doesBindPlayerInventory() ? 97 : 177) + (input ? 0 : 1) * 6)
.setSize(6, 4));
if (input) {
builder.widget(new FakeSyncWidget.ByteSyncer(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ed115f8

Please sign in to comment.