Skip to content

Commit a4495e8

Browse files
committed
Fix compile errors part 3
1 parent 8d0052f commit a4495e8

19 files changed

+181
-171
lines changed

common/src/main/java/com/ultreon/devices/api/app/Dialog.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public void init(@Nullable CompoundTag intent) {
206206

207207
super.init(intent);
208208

209-
defaultLayout.setBackground((graphics, gui, mc, x, y, width, height, mouseX, mouseY, windowActive) -> graphics.fill(x, y, x + width, y + height, Color.LIGHT_GRAY.getRGB()));
209+
defaultLayout.setBackground((graphics, mc, x, y, width, height, mouseX, mouseY, windowActive) -> graphics.fill(x, y, x + width, y + height, Color.LIGHT_GRAY.getRGB()));
210210

211211
Text message = new Text(messageText, 5, 5, getWidth() - 10);
212212
this.addComponent(message);
@@ -262,7 +262,7 @@ public void init(@Nullable CompoundTag intent) {
262262

263263
super.init(intent);
264264

265-
defaultLayout.setBackground((graphics, gui, mc, x, y, width, height, mouseX, mouseY, windowActive) -> graphics.fill(x, y, x + width, y + height, Color.LIGHT_GRAY.getRGB()));
265+
defaultLayout.setBackground((graphics, mc, x, y, width, height, mouseX, mouseY, windowActive) -> graphics.fill(x, y, x + width, y + height, Color.LIGHT_GRAY.getRGB()));
266266

267267
Text message = new Text(messageText, 5, 5, getWidth() - 10);
268268
this.addComponent(message);
@@ -366,7 +366,7 @@ public void init(@Nullable CompoundTag intent) {
366366

367367
super.init(intent);
368368

369-
defaultLayout.setBackground((graphics, gui, mc, x, y, width, height, mouseX, mouseY, windowActive) -> graphics.fill(x, y, x + width, y + height, Color.LIGHT_GRAY.getRGB()));
369+
defaultLayout.setBackground((graphics, mc, x, y, width, height, mouseX, mouseY, windowActive) -> graphics.fill(x, y, x + width, y + height, Color.LIGHT_GRAY.getRGB()));
370370

371371
if (messageText != null) {
372372
Text message = new Text(messageText, 5, 5, getWidth() - 10);

common/src/main/java/com/ultreon/devices/api/app/component/ComboBox.java

+19-18
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import net.minecraft.client.Minecraft;
1313
import net.minecraft.client.gui.Gui;
1414

15+
import net.minecraft.client.gui.GuiGraphics;
1516
import org.jetbrains.annotations.NotNull;
1617
import org.jetbrains.annotations.Nullable;
1718
import java.awt.*;
@@ -49,11 +50,11 @@ public void handleTick() {
4950

5051
@Override
5152
public void init(Layout layout) {
52-
this.layout.setBackground((pose, gui, mc, x, y, width, height, mouseX, mouseY, windowActive) -> Gui.fill(pose, x, y, x + width, y + height, Color.GRAY.getRGB()));
53+
this.layout.setBackground((graphics, mc, x, y, width, height, mouseX, mouseY, windowActive) -> graphics.fill(x, y, x + width, y + height, Color.GRAY.getRGB()));
5354
}
5455

5556
@Override
56-
public void render(PoseStack pose, Laptop laptop, Minecraft mc, int x, int y, int mouseX, int mouseY, boolean windowActive, float partialTicks) {
57+
public void render(GuiGraphics graphics, Laptop laptop, Minecraft mc, int x, int y, int mouseX, int mouseY, boolean windowActive, float partialTicks) {
5758
if (this.visible) {
5859
RenderSystem.setShaderTexture(0, Component.COMPONENTS_GUI);
5960

@@ -71,38 +72,38 @@ public void render(PoseStack pose, Laptop laptop, Minecraft mc, int x, int y, in
7172
int xOffset = width - height;
7273

7374
/* Corners */
74-
RenderUtil.drawRectWithTexture(pose, xPosition + xOffset, yPosition, 96 + i * 5, 12, 2, 2, 2, 2);
75-
RenderUtil.drawRectWithTexture(pose, xPosition + height - 2 + xOffset, yPosition, 99 + i * 5, 12, 2, 2, 2, 2);
76-
RenderUtil.drawRectWithTexture(pose, xPosition + height - 2 + xOffset, yPosition + height - 2, 99 + i * 5, 15, 2, 2, 2, 2);
77-
RenderUtil.drawRectWithTexture(pose, xPosition + xOffset, yPosition + height - 2, 96 + i * 5, 15, 2, 2, 2, 2);
75+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + xOffset, yPosition, 96 + i * 5, 12, 2, 2, 2, 2);
76+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + height - 2 + xOffset, yPosition, 99 + i * 5, 12, 2, 2, 2, 2);
77+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + height - 2 + xOffset, yPosition + height - 2, 99 + i * 5, 15, 2, 2, 2, 2);
78+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + xOffset, yPosition + height - 2, 96 + i * 5, 15, 2, 2, 2, 2);
7879

7980
/* Middles */
80-
RenderUtil.drawRectWithTexture(pose, xPosition + 2 + xOffset, yPosition, 98 + i * 5, 12, height - 4, 2, 1, 2);
81-
RenderUtil.drawRectWithTexture(pose, xPosition + height - 2 + xOffset, yPosition + 2, 99 + i * 5, 14, 2, height - 4, 2, 1);
82-
RenderUtil.drawRectWithTexture(pose, xPosition + 2 + xOffset, yPosition + height - 2, 98 + i * 5, 15, height - 4, 2, 1, 2);
83-
RenderUtil.drawRectWithTexture(pose, xPosition + xOffset, yPosition + 2, 96 + i * 5, 14, 2, height - 4, 2, 1);
81+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + 2 + xOffset, yPosition, 98 + i * 5, 12, height - 4, 2, 1, 2);
82+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + height - 2 + xOffset, yPosition + 2, 99 + i * 5, 14, 2, height - 4, 2, 1);
83+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + 2 + xOffset, yPosition + height - 2, 98 + i * 5, 15, height - 4, 2, 1, 2);
84+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + xOffset, yPosition + 2, 96 + i * 5, 14, 2, height - 4, 2, 1);
8485

8586
/* Center */
86-
RenderUtil.drawRectWithTexture(pose, xPosition + 2 + xOffset, yPosition + 2, 98 + i * 5, 14, height - 4, height - 4, 1, 1);
87+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + 2 + xOffset, yPosition + 2, 98 + i * 5, 14, height - 4, height - 4, 1, 1);
8788

8889
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
8990

9091
/* Icons */
91-
RenderUtil.drawRectWithTexture(pose, xPosition + xOffset + 3, yPosition + 5, 111, 12, 8, 5, 8, 5);
92+
RenderUtil.drawRectWithTexture(Component.COMPONENTS_GUI, graphics, xPosition + xOffset + 3, yPosition + 5, 111, 12, 8, 5, 8, 5);
9293

9394
Color boxColor = new Color(getColorScheme().getBackgroundColor());
9495
Color borderColor = boxColor.darker().darker();
9596

9697
/* Box */
97-
drawHorizontalLine(pose, xPosition, xPosition + xOffset, yPosition, borderColor.getRGB());
98-
drawHorizontalLine(pose, xPosition, xPosition + xOffset, yPosition + height - 1, borderColor.getRGB());
99-
drawVerticalLine(pose, xPosition, yPosition, yPosition + height - 1, borderColor.getRGB());
100-
fill(pose, xPosition + 1, yPosition + 1, xPosition + xOffset, yPosition + height - 1, boxColor.getRGB());
98+
drawHorizontalLine(graphics, xPosition, xPosition + xOffset, yPosition, borderColor.getRGB());
99+
drawHorizontalLine(graphics, xPosition, xPosition + xOffset, yPosition + height - 1, borderColor.getRGB());
100+
drawVerticalLine(graphics, xPosition, yPosition, yPosition + height - 1, borderColor.getRGB());
101+
graphics.fill(xPosition + 1, yPosition + 1, xPosition + xOffset, yPosition + height - 1, boxColor.getRGB());
101102

102103
if (itemRenderer != null) {
103-
itemRenderer.render(pose, value, laptop, mc, x + 1, y + 1, xOffset - 1, height - 2);
104+
itemRenderer.render(graphics, value, mc, x + 1, y + 1, xOffset - 1, height - 2);
104105
} else if (value != null) {
105-
RenderUtil.drawStringClipped(pose, value.toString(), xPosition + 3, yPosition + 3, width - 15, Color.WHITE.getRGB(), true);
106+
RenderUtil.drawStringClipped(graphics, value.toString(), xPosition + 3, yPosition + 3, width - 15, Color.WHITE.getRGB(), true);
106107
}
107108

108109
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);

common/src/main/java/com/ultreon/devices/api/app/component/Image.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.ultreon.devices.object.AppInfo;
1515
import net.minecraft.Util;
1616
import net.minecraft.client.Minecraft;
17+
import net.minecraft.client.gui.GuiGraphics;
1718
import net.minecraft.client.renderer.texture.AbstractTexture;
1819
import net.minecraft.client.renderer.texture.DynamicTexture;
1920
import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite;
@@ -248,7 +249,7 @@ protected void handleUnload() {
248249
}
249250

250251
@Override
251-
public void render(PoseStack pose, Laptop laptop, Minecraft mc, int x, int y, int mouseX, int mouseY, boolean windowActive, float partialTicks) {
252+
public void render(GuiGraphics graphics, Laptop laptop, Minecraft mc, int x, int y, int mouseX, int mouseY, boolean windowActive, float partialTicks) {
252253
if (this.visible) {
253254
if (loader != null && loader.setup) {
254255
image = loader.load(this);
@@ -257,7 +258,7 @@ public void render(PoseStack pose, Laptop laptop, Minecraft mc, int x, int y, in
257258
}
258259

259260
if (hasBorder) {
260-
fill(pose, x, y, x + componentWidth, y + componentHeight, borderColor);
261+
graphics.fill(x, y, x + componentWidth, y + componentHeight, borderColor);
261262
}
262263

263264
RenderSystem.setShaderColor(tint.get().r/255f, tint.get().g/255f, tint.get().b/255f, alpha);
@@ -272,29 +273,29 @@ public void render(PoseStack pose, Laptop laptop, Minecraft mc, int x, int y, in
272273
if (/*hasBorder*/true) {
273274
if (drawFull) {
274275
//DebugLog.log("Rendering image");
275-
RenderUtil.drawRectWithTexture(pose, x + borderThickness, y + borderThickness, 0, imageU, imageV, componentWidth - borderThickness * 2, componentHeight - borderThickness * 2, 256, 256);
276+
RenderUtil.drawRectWithTexture(null, graphics, x + borderThickness, y + borderThickness, 0, imageU, imageV, componentWidth - borderThickness * 2, componentHeight - borderThickness * 2, 256, 256);
276277
//GuiComponent.blit(pose, x + borderThickness, y + borderThickness, imageU, imageV, componentWidth - borderThickness * 2, componentHeight - borderThickness * 2, 256, 256);
277278
} else {
278279
//DebugLog.log("Rendering image");
279-
RenderUtil.drawRectWithTexture(pose, x + borderThickness, y + borderThickness, imageU, imageV, componentWidth - borderThickness * 2, componentHeight - borderThickness * 2, imageWidth, imageHeight, sourceWidth, sourceHeight);
280+
RenderUtil.drawRectWithTexture(null, graphics, x + borderThickness, y + borderThickness, imageU, imageV, componentWidth - borderThickness * 2, componentHeight - borderThickness * 2, imageWidth, imageHeight, sourceWidth, sourceHeight);
280281
//GuiComponent.blit(pose, x + borderThickness, y + borderThickness, componentWidth - borderThickness * 2, imageU, imageV, componentHeight - borderThickness * 2, sourceWidth, sourceHeight, imageWidth, imageHeight);
281282
}
282283
} else {
283284
if (drawFull) {
284285
//DebugLog.log("Rendering image");
285-
RenderUtil.drawRectWithTexture(pose, x, y, componentWidth, componentHeight, imageU, imageV, 256, 256);
286+
RenderUtil.drawRectWithTexture(null, graphics, x, y, componentWidth, componentHeight, imageU, imageV, 256, 256);
286287
// GuiComponent.blit(pose, x, y, componentWidth, componentHeight, imageU, imageV, 256, 256);
287288
} else {
288289
//DebugLog.log("Rendering image");
289-
RenderUtil.drawRectWithTexture(pose, x, y, componentWidth, componentHeight, imageU, imageV, imageWidth, imageHeight, sourceWidth, sourceHeight);
290+
RenderUtil.drawRectWithTexture(null, graphics, x, y, componentWidth, componentHeight, imageU, imageV, imageWidth, imageHeight, sourceWidth, sourceHeight);
290291
//GuiComponent.blit(pose, x, y, componentWidth, componentHeight, imageU, imageV, sourceWidth, sourceHeight, imageWidth, imageHeight);
291292
}
292293
}
293294
} else {
294295
if (/*hasBorder*/true) {
295-
fill(pose, x + borderThickness, y + borderThickness, x + componentWidth - borderThickness, y + componentHeight - borderThickness, Color.LIGHT_GRAY.getRGB());
296+
graphics.fill(x + borderThickness, y + borderThickness, x + componentWidth - borderThickness, y + componentHeight - borderThickness, Color.LIGHT_GRAY.getRGB());
296297
} else {
297-
fill(pose, x, y, x + componentWidth, y + componentHeight, Color.LIGHT_GRAY.getRGB());
298+
graphics.fill(x, y, x + componentWidth, y + componentHeight, Color.LIGHT_GRAY.getRGB());
298299
}
299300
}
300301
RenderSystem.setShaderColor(1f, 1f, 1f, alpha);

common/src/main/java/com/ultreon/devices/api/app/component/ItemList.java

+20-19
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.ultreon.devices.util.GuiHelper;
1111
import net.minecraft.client.Minecraft;
1212
import net.minecraft.client.gui.Gui;
13+
import net.minecraft.client.gui.GuiGraphics;
1314
import net.minecraft.core.NonNullList;
1415

1516
import org.jetbrains.annotations.NotNull;
@@ -87,8 +88,8 @@ public void init(Layout layout) {
8788
layoutLoading = new Layout(left, top, getWidth(), getHeight());
8889
layoutLoading.setVisible(loading);
8990
layoutLoading.addComponent(new Spinner((layoutLoading.width - 12) / 2, (layoutLoading.height - 12) / 2));
90-
layoutLoading.setBackground((pose, gui, mc, x, y, width, height, mouseX, mouseY, windowActive) ->
91-
Gui.fill(pose, x, y, x + width, y + height, LOADING_BACKGROUND));
91+
layoutLoading.setBackground((graphics, mc, x, y, width, height, mouseX, mouseY, windowActive) ->
92+
graphics.fill(x, y, x + width, y + height, LOADING_BACKGROUND));
9293
layout.addComponent(layoutLoading);
9394

9495
updateButtons();
@@ -98,7 +99,7 @@ public void init(Layout layout) {
9899
}
99100

100101
@Override
101-
public void render(PoseStack pose, Laptop laptop, Minecraft mc, int x, int y, int mouseX, int mouseY, boolean windowActive, float partialTicks) {
102+
public void render(GuiGraphics graphics, Laptop laptop, Minecraft mc, int x, int y, int mouseX, int mouseY, boolean windowActive, float partialTicks) {
102103
if (this.visible) {
103104
int height = 13;
104105
if (renderer != null) {
@@ -111,25 +112,25 @@ public void render(PoseStack pose, Laptop laptop, Minecraft mc, int x, int y, in
111112
Color borderColor = bgColor.darker().darker();
112113

113114
/* Fill */
114-
Gui.fill(pose, xPosition + 1, yPosition + 1, xPosition + width - 1, yPosition + (size * height) + size, bgColor.getRGB());
115+
graphics.fill(xPosition + 1, yPosition + 1, xPosition + width - 1, yPosition + (size * height) + size, bgColor.getRGB());
115116

116117
/* Box */
117-
drawHorizontalLine(pose, xPosition, xPosition + width - 1, yPosition, borderColor.getRGB());
118-
drawVerticalLine(pose, xPosition, yPosition, yPosition + (size * height) + size, borderColor.getRGB());
119-
drawVerticalLine(pose, xPosition + width - 1, yPosition, yPosition + (size * height) + size, borderColor.getRGB());
120-
drawHorizontalLine(pose, xPosition, xPosition + width - 1, yPosition + (size * height) + size, borderColor.getRGB());
118+
drawHorizontalLine(graphics, xPosition, xPosition + width - 1, yPosition, borderColor.getRGB());
119+
drawVerticalLine(graphics, xPosition, yPosition, yPosition + (size * height) + size, borderColor.getRGB());
120+
drawVerticalLine(graphics, xPosition + width - 1, yPosition, yPosition + (size * height) + size, borderColor.getRGB());
121+
drawHorizontalLine(graphics, xPosition, xPosition + width - 1, yPosition + (size * height) + size, borderColor.getRGB());
121122

122123
/* Items */
123124
for (int i = 0; i < size - 1 && i < items.size(); i++) {
124125
E item = getItem(i);
125126
if (item != null) {
126127
if (renderer != null) {
127-
renderer.render(pose, item, this, mc, xPosition + 1, yPosition + (i * (renderer.getHeight())) + 1 + i, width - 2, renderer.getHeight(), (i + offset) == selected);
128-
drawHorizontalLine(pose, xPosition + 1, xPosition + width - 1, yPosition + (i * height) + i + height + 1, borderColor.getRGB());
128+
renderer.render(graphics, item, mc, xPosition + 1, yPosition + (i * (renderer.getHeight())) + 1 + i, width - 2, renderer.getHeight(), (i + offset) == selected);
129+
drawHorizontalLine(graphics, xPosition + 1, xPosition + width - 1, yPosition + (i * height) + i + height + 1, borderColor.getRGB());
129130
} else {
130-
fill(pose, xPosition + 1, yPosition + (i * 14) + 1, xPosition + width - 1, yPosition + 13 + (i * 14) + 1, (i + offset) != selected ? bgColor.brighter().getRGB() : bgColor.brighter().brighter().getRGB());
131-
drawString(pose, mc.font, item.toString(), xPosition + 3, yPosition + 3 + (i * 14), textColor);
132-
drawHorizontalLine(pose, xPosition + 1, xPosition + width - 2, yPosition + (i * height) + i + height + 1, borderColor.getRGB());
131+
graphics.fill(xPosition + 1, yPosition + (i * 14) + 1, xPosition + width - 1, yPosition + 13 + (i * 14) + 1, (i + offset) != selected ? bgColor.brighter().getRGB() : bgColor.brighter().brighter().getRGB());
132+
graphics.drawString(mc.font, item.toString(), xPosition + 3, yPosition + 3 + (i * 14), textColor);
133+
drawHorizontalLine(graphics, xPosition + 1, xPosition + width - 2, yPosition + (i * height) + i + height + 1, borderColor.getRGB());
133134
}
134135
}
135136
}
@@ -138,17 +139,17 @@ public void render(PoseStack pose, Laptop laptop, Minecraft mc, int x, int y, in
138139
E item = getItem(i);
139140
if (item != null) {
140141
if (renderer != null) {
141-
renderer.render(pose, item, this, mc, xPosition + 1, yPosition + (i * (renderer.getHeight())) + 1 + i, width - 2, renderer.getHeight(), (i + offset) == selected);
142-
drawHorizontalLine(pose, xPosition + 1, xPosition + width - 1, yPosition + (i * height) + i + height + 1, borderColor.getRGB());
142+
renderer.render(graphics, item, mc, xPosition + 1, yPosition + (i * (renderer.getHeight())) + 1 + i, width - 2, renderer.getHeight(), (i + offset) == selected);
143+
drawHorizontalLine(graphics, xPosition + 1, xPosition + width - 1, yPosition + (i * height) + i + height + 1, borderColor.getRGB());
143144
} else {
144-
fill(pose, xPosition + 1, yPosition + (i * 14) + 1, xPosition + width - 1, yPosition + 13 + (i * 14) + 1, (i + offset) != selected ? bgColor.brighter().getRGB() : bgColor.brighter().brighter().getRGB());
145-
drawString(pose, Laptop.getFont(), item.toString(), xPosition + 3, yPosition + 3 + (i * 14), textColor);
145+
graphics.fill(xPosition + 1, yPosition + (i * 14) + 1, xPosition + width - 1, yPosition + 13 + (i * 14) + 1, (i + offset) != selected ? bgColor.brighter().getRGB() : bgColor.brighter().brighter().getRGB());
146+
graphics.drawString(Laptop.getFont(), item.toString(), xPosition + 3, yPosition + 3 + (i * 14), textColor);
146147
}
147148
}
148149

149150
if (items.size() > visibleItems) {
150-
fill(pose, xPosition + width, yPosition, xPosition + width + 10, yPosition + (size * height) + size, Color.DARK_GRAY.getRGB());
151-
drawVerticalLine(pose, xPosition + width + 10, yPosition + 11, yPosition + (size * height) + size - 11, borderColor.getRGB());
151+
graphics.fill(xPosition + width, yPosition, xPosition + width + 10, yPosition + (size * height) + size, Color.DARK_GRAY.getRGB());
152+
drawVerticalLine(graphics, xPosition + width + 10, yPosition + 11, yPosition + (size * height) + size - 11, borderColor.getRGB());
152153
}
153154
}
154155
}

0 commit comments

Comments
 (0)