use of org.bleachhack.gui.window.widget.WindowWidget in project BleachHack by BleachDrinker420.
the class Window method render.
public void render(MatrixStack matrices, int mouseX, int mouseY) {
TextRenderer textRend = MinecraftClient.getInstance().textRenderer;
if (dragging) {
x2 = (x2 - x1) + mouseX - dragOffX - Math.min(0, mouseX - dragOffX);
y2 = (y2 - y1) + mouseY - dragOffY - Math.min(0, mouseY - dragOffY);
x1 = Math.max(0, mouseX - dragOffX);
y1 = Math.max(0, mouseY - dragOffY);
}
drawBackground(matrices, mouseX, mouseY, textRend);
for (WindowWidget w : widgets) {
if (w.shouldRender(x1, y1, x2, y2)) {
w.render(matrices, x1, y1, mouseX, mouseY);
}
}
boolean blockItem = icon != null && icon.getItem() instanceof BlockItem;
/* window icon */
if (icon != null) {
RenderSystem.getModelViewStack().push();
RenderSystem.getModelViewStack().translate(x1 + (blockItem ? 3 : 2), y1 + 2, 0);
RenderSystem.getModelViewStack().scale(0.6f, 0.6f, 1f);
DiffuseLighting.enableGuiDepthLighting();
MinecraftClient.getInstance().getItemRenderer().renderInGui(icon, 0, 0);
DiffuseLighting.disableGuiDepthLighting();
RenderSystem.getModelViewStack().pop();
RenderSystem.applyModelViewMatrix();
}
/* window title */
textRend.drawWithShadow(matrices, title, x1 + (icon == null || icon.getItem() == Items.AIR ? 4 : (blockItem ? 15 : 14)), y1 + 3, -1);
}
use of org.bleachhack.gui.window.widget.WindowWidget in project BleachHack by BleachDrinker420.
the class WindowScreen method render.
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
super.render(matrices, mouseX, mouseY, delta);
for (WindowWidget w : globalWidgets) {
w.render(matrices, 0, 0, mouseX, mouseY);
}
int sel = getSelectedWindow();
if (sel == -1) {
for (int i : getWindowsFrontToBack()) {
if (!getWindow(i).closed) {
selectWindow(i);
break;
}
}
}
boolean close = true;
for (int w : getWindowsBackToFront()) {
if (!getWindow(w).closed) {
close = false;
onRenderWindow(matrices, w, mouseX, mouseY);
}
}
if (autoClose && close)
this.onClose();
}
Aggregations