|
10 | 10 | import gregtech.api.gui.ModularUI; |
11 | 11 | import gregtech.api.gui.widgets.LabelWidget; |
12 | 12 | import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; |
| 13 | +import gregtech.api.mui.GTGuiTextures; |
| 14 | +import gregtech.api.mui.GTGuis; |
13 | 15 | import gregtech.api.recipes.RecipeMap; |
14 | 16 | import gregtech.client.renderer.ICubeRenderer; |
15 | 17 | import gregtech.client.renderer.texture.Textures; |
|
28 | 30 | import codechicken.lib.render.CCRenderState; |
29 | 31 | import codechicken.lib.render.pipeline.IVertexOperation; |
30 | 32 | import codechicken.lib.vec.Matrix4; |
| 33 | +import com.cleanroommc.modularui.api.drawable.IKey; |
| 34 | +import com.cleanroommc.modularui.factory.PosGuiData; |
| 35 | +import com.cleanroommc.modularui.screen.ModularPanel; |
| 36 | +import com.cleanroommc.modularui.value.sync.PanelSyncManager; |
| 37 | +import com.cleanroommc.modularui.widget.Widget; |
31 | 38 | import org.jetbrains.annotations.NotNull; |
32 | 39 | import org.jetbrains.annotations.Nullable; |
33 | 40 |
|
@@ -130,6 +137,44 @@ protected void renderOverlays(CCRenderState renderState, Matrix4 translation, IV |
130 | 137 |
|
131 | 138 | // todo mui2 check |
132 | 139 |
|
| 140 | + @Override |
| 141 | + public boolean usesMui2() { |
| 142 | + RecipeMap<?> map = getRecipeMap(); |
| 143 | + return map != null && map.getRecipeMapUI().usesMui2(); |
| 144 | + } |
| 145 | + |
| 146 | + @Override |
| 147 | + public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { |
| 148 | + RecipeMap<?> workableRecipeMap = workable.getRecipeMap(); |
| 149 | + int yOffset = 0; |
| 150 | + if (workableRecipeMap.getMaxInputs() >= 6 || workableRecipeMap.getMaxFluidInputs() >= 6 || |
| 151 | + workableRecipeMap.getMaxOutputs() >= 6 || workableRecipeMap.getMaxFluidOutputs() >= 6) { |
| 152 | + yOffset = FONT_HEIGHT; |
| 153 | + } |
| 154 | + |
| 155 | + ModularPanel panel = GTGuis.createPanel(this, 176, 166 + yOffset); |
| 156 | + Widget<?> widget = workableRecipeMap.getRecipeMapUI().buildWidget(workable::getProgressPercent, importItems, |
| 157 | + exportItems, importFluids, exportFluids, yOffset, guiSyncManager); |
| 158 | + |
| 159 | + panel.child(widget) |
| 160 | + .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) |
| 161 | + // .child(new ItemSlot() |
| 162 | + // .slot(SyncHandlers.itemSlot(chargerInventory, 0)) |
| 163 | + // .pos(79, 62 + yOffset) |
| 164 | + // .background(GTGuiTextures.SLOT, GTGuiTextures.CHARGER_OVERLAY) |
| 165 | + // .tooltip(t -> t.addLine(IKey.lang("gregtech.gui.charger_slot.tooltip", GTValues.VNF[getTier()], |
| 166 | + // GTValues.VNF[getTier()])))) |
| 167 | + .bindPlayerInventory(); |
| 168 | + |
| 169 | + if (exportItems.getSlots() + exportFluids.getTanks() <= 9) { |
| 170 | + panel.child(new Widget<>() |
| 171 | + .size(17) |
| 172 | + .pos(152, 63 + yOffset) |
| 173 | + .background(GTGuiTextures.getLogo(getUITheme()))); |
| 174 | + } |
| 175 | + return panel; |
| 176 | + } |
| 177 | + |
133 | 178 | @Override |
134 | 179 | protected ModularUI createUI(EntityPlayer entityPlayer) { |
135 | 180 | return createGuiTemplate(entityPlayer).build(getHolder(), entityPlayer); |
|
0 commit comments