Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions xplat/src/main/java/dev/emi/emi/screen/BoMScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ public void render(DrawContext raw, int mouseX, int mouseY, float delta) {
context.drawCenteredText(EmiPort.translatable("emi.leftovers"), 0, cy - 16 + 40);
}
for (Cost cost : costs) {
cost.render(context);
cost.renderBase(context);
}
for (Node node : nodes) {
node.render(context, mx, my, delta);
node.renderBase(context, mx, my, delta);
}
int color = -1;
if (batches.contains(mx, my)) {
Expand All @@ -245,6 +245,12 @@ public void render(DrawContext raw, int mouseX, int mouseY, float delta) {
context.drawTexture(EmiRenderHelper.WIDGETS, mode.x(), mode.y(), BoM.craftingMode ? 16 : 0, 146, mode.width(), mode.height());
context.setColor(1f, 1f, 1f, 1f);
batcher.draw();
for (Cost cost : costs) {
cost.renderAmount(context);
}
for (Node node : nodes) {
node.renderAmount(context);
}
} else {
context.drawCenteredText(EmiPort.translatable("emi.tree_welcome", EmiRenderHelper.getEmiText()), 0, -72);
context.drawCenteredText(EmiPort.translatable("emi.no_tree"), 0, -48);
Expand Down Expand Up @@ -563,8 +569,11 @@ public Cost(FlatMaterialCost cost, int x, int y, boolean remainder) {
this.remainder = remainder;
}

public void render(EmiDrawContext context) {
public void renderBase(EmiDrawContext context) {
batcher.render(cost.ingredient, context.raw(), x, y, 0, ~(EmiIngredient.RENDER_AMOUNT | EmiIngredient.RENDER_REMAINDER));
}

public void renderAmount(EmiDrawContext context) {
EmiRenderHelper.renderAmount(context, x, y, getAmountText());
}

Expand Down Expand Up @@ -674,7 +683,7 @@ public Node(MaterialNode node, long amount, int x, int y, ChanceState chance) {
midOffset = tw / -2;
}

public void render(EmiDrawContext context, int mouseX, int mouseY, float delta) {
public void renderBase(EmiDrawContext context, int mouseX, int mouseY, float delta) {
if (parent != null) {
context.push();

Expand Down Expand Up @@ -729,6 +738,11 @@ public void render(EmiDrawContext context, int mouseX, int mouseY, float delta)
}
context.setColor(1f, 1f, 1f, 1f);
batcher.render(node.ingredient, context.raw(), x + xo - 8 + midOffset, y - 8, 0);
}

public void renderAmount(EmiDrawContext context) {
int xo = node.recipe != null ? 11 : 0;
context.setColor(1f, 1f, 1f, 1f);
EmiRenderHelper.renderAmount(context, x + xo - 8 + midOffset, y - 8, getAmountText());
}

Expand Down