|
1 | 1 | package com.researchcube.client.screen; |
2 | 2 |
|
| 3 | +import com.researchcube.ResearchCubeMod; |
3 | 4 | import com.researchcube.block.ResearchTableBlockEntity; |
4 | 5 | import com.researchcube.menu.ResearchTableMenu; |
5 | 6 | import com.researchcube.network.StartResearchPacket; |
| 7 | +import com.researchcube.registry.ModFluids; |
6 | 8 | import com.researchcube.research.FluidCost; |
7 | 9 | import com.researchcube.research.ItemCost; |
8 | 10 | import com.researchcube.research.ResearchDefinition; |
|
41 | 43 | */ |
42 | 44 | public class ResearchTreeScreen extends AbstractContainerScreen<ResearchTableMenu> { |
43 | 45 |
|
44 | | - private static final int BG_OUTER = 0xFFC6C6C6; |
45 | | - private static final int PANEL_BG = 0xFF252838; |
46 | | - private static final int PANEL_DARK = 0xFF121521; |
47 | | - private static final int PANEL_LIGHT = 0xFF5A6078; |
| 46 | + // ── Texture ── |
| 47 | + private static final ResourceLocation TEXTURE = |
| 48 | + ResourceLocation.fromNamespaceAndPath(ResearchCubeMod.MOD_ID, "textures/gui/research_table.png"); |
| 49 | + private static final int TEX_W = ResearchTableMenu.GUI_WIDTH; |
| 50 | + private static final int TEX_H = ResearchTableMenu.GUI_HEIGHT; |
| 51 | + |
| 52 | + // Colors (for dynamic elements) |
| 53 | + private static final int PANEL_BORDER_LIGHT = 0xFF7E87A6; |
| 54 | + private static final int PANEL_BORDER_DARK = 0xFF1A1A1A; |
48 | 55 | private static final int GRAPH_BG = 0xFF171A26; |
49 | 56 |
|
50 | 57 | private static final int EDGE_SINGLE = 0xFF9CA3AF; |
@@ -408,99 +415,48 @@ protected void renderBg(GuiGraphics g, float partialTick, int mouseX, int mouseY |
408 | 415 | int x = leftPos; |
409 | 416 | int y = topPos; |
410 | 417 |
|
411 | | - // Outer background |
412 | | - g.fill(x, y, x + imageWidth, y + imageHeight, BG_OUTER); |
413 | | - g.fill(x, y, x + imageWidth, y + 1, 0xFFFFFFFF); |
414 | | - g.fill(x, y, x + 1, y + imageHeight, 0xFFFFFFFF); |
415 | | - g.fill(x + imageWidth - 1, y, x + imageWidth, y + imageHeight, PANEL_DARK); |
416 | | - g.fill(x, y + imageHeight - 1, x + imageWidth, y + imageHeight, PANEL_DARK); |
417 | | - |
418 | | - // Upper panel (contains graph) |
419 | | - drawPanel(g, x + ResearchTableMenu.UPPER_PANEL_X, y + ResearchTableMenu.UPPER_PANEL_Y, |
420 | | - ResearchTableMenu.UPPER_PANEL_W, ResearchTableMenu.UPPER_PANEL_H); |
421 | | - |
422 | | - // Machine panel area |
423 | | - drawPanel(g, x + ResearchTableMenu.MACHINE_PANEL_X, y + ResearchTableMenu.MACHINE_PANEL_Y, |
424 | | - ResearchTableMenu.MACHINE_PANEL_W, 80); |
425 | | - |
426 | | - // Player inventory panel |
427 | | - drawPanel(g, x + ResearchTableMenu.PLAYER_INV_X - 8, y + ResearchTableMenu.PLAYER_INV_Y - 10, |
428 | | - 178, 90); |
429 | | - |
430 | | - // Slot backgrounds for machine panel |
431 | | - drawSlotBg(g, x + ResearchTableMenu.DRIVE_X, y + ResearchTableMenu.DRIVE_Y); |
432 | | - drawSlotBg(g, x + ResearchTableMenu.CUBE_X, y + ResearchTableMenu.CUBE_Y); |
433 | | - for (int row = 0; row < 2; row++) { |
434 | | - for (int col = 0; col < 3; col++) { |
435 | | - drawSlotBg(g, x + ResearchTableMenu.COST_X + col * 18, y + ResearchTableMenu.COST_Y + row * 18); |
436 | | - } |
437 | | - } |
438 | | - drawSlotBg(g, x + ResearchTableMenu.BUCKET_IN_X, y + ResearchTableMenu.BUCKET_IN_Y); |
439 | | - drawSlotBg(g, x + ResearchTableMenu.BUCKET_OUT_X, y + ResearchTableMenu.BUCKET_OUT_Y); |
440 | | - drawSlotBg(g, x + ResearchTableMenu.IDEA_CHIP_X, y + ResearchTableMenu.IDEA_CHIP_Y); |
| 418 | + // ── Static background from texture (same as ResearchTableScreen) ── |
| 419 | + g.blit(TEXTURE, x, y, 0, 0, imageWidth, imageHeight, TEX_W, TEX_H); |
| 420 | + |
| 421 | + // ── Fluid gauge (dynamic) ── |
441 | 422 | drawFluidGauge(g, x + ResearchTableMenu.FLUID_GAUGE_X, y + ResearchTableMenu.FLUID_GAUGE_Y, |
442 | 423 | ResearchTableMenu.FLUID_GAUGE_W, ResearchTableMenu.FLUID_GAUGE_H); |
443 | 424 |
|
444 | | - // Player inventory slot backgrounds |
445 | | - for (int row = 0; row < 3; row++) { |
446 | | - for (int col = 0; col < 9; col++) { |
447 | | - drawSlotBg(g, x + ResearchTableMenu.PLAYER_INV_X + col * 18, y + ResearchTableMenu.PLAYER_INV_Y + row * 18); |
448 | | - } |
449 | | - } |
450 | | - for (int col = 0; col < 9; col++) { |
451 | | - drawSlotBg(g, x + ResearchTableMenu.HOTBAR_X + col * 18, y + ResearchTableMenu.HOTBAR_Y); |
452 | | - } |
453 | | - |
454 | | - // Graph viewport |
| 425 | + // Graph viewport (render on top of texture background) |
455 | 426 | int gx = x + GRAPH_X; |
456 | 427 | int gy = y + GRAPH_Y; |
457 | 428 | g.fill(gx, gy, gx + GRAPH_W, gy + GRAPH_H, GRAPH_BG); |
458 | | - g.fill(gx, gy, gx + GRAPH_W, gy + 1, PANEL_DARK); |
459 | | - g.fill(gx, gy, gx + 1, gy + GRAPH_H, PANEL_DARK); |
460 | | - g.fill(gx + GRAPH_W - 1, gy, gx + GRAPH_W, gy + GRAPH_H, PANEL_LIGHT); |
461 | | - g.fill(gx, gy + GRAPH_H - 1, gx + GRAPH_W, gy + GRAPH_H, PANEL_LIGHT); |
| 429 | + g.fill(gx, gy, gx + GRAPH_W, gy + 1, PANEL_BORDER_DARK); |
| 430 | + g.fill(gx, gy, gx + 1, gy + GRAPH_H, PANEL_BORDER_DARK); |
| 431 | + g.fill(gx + GRAPH_W - 1, gy, gx + GRAPH_W, gy + GRAPH_H, PANEL_BORDER_LIGHT); |
| 432 | + g.fill(gx, gy + GRAPH_H - 1, gx + GRAPH_W, gy + GRAPH_H, PANEL_BORDER_LIGHT); |
462 | 433 |
|
463 | 434 | g.enableScissor(gx + 1, gy + 1, gx + GRAPH_W - 1, gy + GRAPH_H - 1); |
464 | 435 | drawEdges(g, gx, gy); |
465 | 436 | drawNodes(g, gx, gy); |
466 | 437 | g.disableScissor(); |
467 | 438 | } |
468 | 439 |
|
469 | | - private void drawSlotBg(GuiGraphics g, int sx, int sy) { |
470 | | - int x0 = sx - 1; |
471 | | - int y0 = sy - 1; |
472 | | - g.fill(x0, y0, x0 + 18, y0 + 18, 0xFF8B8B8B); |
473 | | - g.fill(x0 + 1, y0 + 1, x0 + 17, y0 + 17, 0xFF30303A); |
474 | | - g.fill(x0, y0, x0 + 18, y0 + 1, 0xFF151728); |
475 | | - g.fill(x0, y0, x0 + 1, y0 + 18, 0xFF151728); |
476 | | - } |
477 | | - |
478 | 440 | private void drawFluidGauge(GuiGraphics g, int gx, int gy, int gw, int gh) { |
479 | | - g.fill(gx - 1, gy - 1, gx + gw + 1, gy + gh + 1, 0xFF121521); |
480 | | - g.fill(gx, gy, gx + gw, gy + gh, 0xFF1B2030); |
| 441 | + g.fill(gx - 1, gy - 1, gx + gw + 1, gy + gh + 1, PANEL_BORDER_DARK); |
| 442 | + g.fill(gx, gy, gx + gw, gy + gh, 0xFF222222); |
481 | 443 |
|
482 | 444 | int fluidAmount = menu.getFluidAmount(); |
483 | 445 | int fluidType = menu.getFluidType(); |
484 | 446 | if (fluidAmount > 0 && fluidType > 0) { |
485 | 447 | int fillHeight = Math.min(gh, Math.round((float) gh * fluidAmount / ResearchTableBlockEntity.TANK_CAPACITY)); |
486 | 448 | int fillY = gy + gh - fillHeight; |
487 | | - int color = switch (fluidType) { |
488 | | - case 1 -> 0xFF00C8FF; |
489 | | - case 2 -> 0xFFB05DFF; |
490 | | - case 3 -> 0xFFFFC741; |
491 | | - case 4 -> 0xFFFF76D6; |
492 | | - default -> 0xFF6C768E; |
493 | | - }; |
| 449 | + int color = ModFluids.getFluidColor(fluidType); |
494 | 450 | g.fill(gx, fillY, gx + gw, gy + gh, color); |
| 451 | + |
| 452 | + if (fillHeight > 2) { |
| 453 | + int shine = (color & 0x00FFFFFF) | 0x44000000; |
| 454 | + g.fill(gx, fillY, gx + gw, fillY + 1, shine); |
| 455 | + } |
495 | 456 | } |
496 | | - } |
497 | 457 |
|
498 | | - private void drawPanel(GuiGraphics g, int px, int py, int pw, int ph) { |
499 | | - g.fill(px, py, px + pw, py + ph, PANEL_BG); |
500 | | - g.fill(px, py, px + pw, py + 1, PANEL_DARK); |
501 | | - g.fill(px, py, px + 1, py + ph, PANEL_DARK); |
502 | | - g.fill(px + pw - 1, py, px + pw, py + ph, PANEL_LIGHT); |
503 | | - g.fill(px, py + ph - 1, px + pw, py + ph, PANEL_LIGHT); |
| 458 | + g.fill(gx + gw, gy - 1, gx + gw + 1, gy + gh + 1, PANEL_BORDER_LIGHT); |
| 459 | + g.fill(gx - 1, gy + gh, gx + gw + 1, gy + gh + 1, PANEL_BORDER_LIGHT); |
504 | 460 | } |
505 | 461 |
|
506 | 462 | private void drawEdges(GuiGraphics g, int graphScreenX, int graphScreenY) { |
|
0 commit comments