use of net.minecraft.client.render.GameRenderer in project JexClient by DustinRepo.
the class GuiPasswordField method drawSelectionHighlight.
private void drawSelectionHighlight(int x1, int y1, int x2, int y2) {
int j;
if (x1 < x2) {
j = x1;
x1 = x2;
x2 = j;
}
if (y1 < y2) {
j = y1;
y1 = y2;
y2 = j;
}
if (x2 > this.x + this.width) {
x2 = this.x + this.width;
}
if (x1 > this.x + this.width) {
x1 = this.x + this.width;
}
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
RenderSystem.setShader(GameRenderer::getPositionShader);
RenderSystem.setShaderColor(0.0F, 0.0F, 1.0F, 1.0F);
RenderSystem.disableTexture();
RenderSystem.enableColorLogicOp();
RenderSystem.logicOp(LogicOp.OR_REVERSE);
bufferBuilder.begin(DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder.vertex((double) x1, (double) y2, 0.0D).next();
bufferBuilder.vertex((double) x2, (double) y2, 0.0D).next();
bufferBuilder.vertex((double) x2, (double) y1, 0.0D).next();
bufferBuilder.vertex((double) x1, (double) y1, 0.0D).next();
tessellator.draw();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.disableColorLogicOp();
RenderSystem.enableTexture();
}
use of net.minecraft.client.render.GameRenderer in project JexClient by DustinRepo.
the class JexTitleScreen method render.
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
if (this.backgroundFadeStart == 0L && this.doBackgroundFade) {
this.backgroundFadeStart = Util.getMeasuringTimeMs();
}
if (customMainMenu.scroll && stopWatch.hasPassed(customMainMenu.scrollDelay * 1000L)) {
background++;
if (background < 0) {
background = backgrounds.size() - 1;
} else if (background > backgrounds.size() - 1) {
background = 0;
}
stopWatch.reset();
}
isDonator = Addon.isDonator(Wrapper.INSTANCE.getMinecraft().getSession().getUuid().replace("-", ""));
int midX = Render2DHelper.INSTANCE.getScaledWidth() / 2;
float f = this.doBackgroundFade ? (float) (Util.getMeasuringTimeMs() - this.backgroundFadeStart) / 1000.0F : 1.0F;
fill(matrices, 0, 0, this.width, this.height, -1);
this.backgroundRenderer.render(delta, MathHelper.clamp(f, 0.0F, 1.0F));
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.blendFunc(SrcFactor.SRC_ALPHA, DstFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.setShaderTexture(0, PANORAMA_OVERLAY);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.doBackgroundFade ? (float) MathHelper.ceil(MathHelper.clamp(f, 0.0F, 1.0F)) : 1.0F);
drawTexture(matrices, 0, 0, this.width, this.height, 0.0F, 0.0F, 16, 128, 16, 128);
float g = this.doBackgroundFade ? MathHelper.clamp(f - 1.0F, 0.0F, 1.0F) : 1.0F;
int l = MathHelper.ceil(g * 255.0F) << 24;
if (!JexTitleScreen.backgrounds.isEmpty() && customMainMenu.customBackground) {
Background currentBackground = backgrounds.get(background);
Render2DHelper.INSTANCE.bindTexture(currentBackground.identifier);
DrawableHelper.drawTexture(matrices, (int) 0, (int) 0, 0, 0, width, height, width, height);
}
if ((l & -67108864) != 0) {
RenderSystem.setShaderTexture(0, JEX_TITLE_TEXTURE);
int j1 = this.height / 4 - 10;
Render2DHelper.INSTANCE.shaderColor(ColorHelper.INSTANCE.getClientColor());
drawTexture(matrices, 2, (int) j1, 0.0F, 0.0F, 250, 50, 250, 50);
this.splashText = isMinceraft ? "Minceraft" : "Build " + JexClient.INSTANCE.getVersion().version() + " for MC" + SharedConstants.getGameVersion().getName();
matrices.push();
float h = 1.8F - MathHelper.abs(MathHelper.sin((float) (Util.getMeasuringTimeMs() % 1000L) / 1000.0F * 6.2831855F) * 0.1F);
h = h * 100.0F / (float) (this.textRenderer.getWidth(this.splashText) + 32);
matrices.scale(h, h, h);
FontHelper.INSTANCE.drawWithShadow(matrices, splashText, 2 / h, (j1 + 44) / h, ColorHelper.INSTANCE.getClientColor());
matrices.pop();
if (UpdateManager.INSTANCE.getStatus() == UpdateManager.Status.OUTDATED || UpdateManager.INSTANCE.getStatus() == UpdateManager.Status.OUTDATED_BOTH) {
String updateString = "Jex Client is outdated. You can open the Jex Options screen in Options to update to Build " + UpdateManager.INSTANCE.getLatestVersion().version();
float strWidth = FontHelper.INSTANCE.getStringWidth(updateString);
Render2DHelper.INSTANCE.fillAndBorder(matrices, (midX) - (strWidth / 2) - 2, -1, (midX) + (strWidth / 2) + 2, 15, ColorHelper.INSTANCE.getClientColor(), 0x80000000, 1);
FontHelper.INSTANCE.drawCenteredString(matrices, updateString, midX, 2, ColorHelper.INSTANCE.getClientColor());
}
if (customMainMenu.customBackground) {
if (backgrounds.isEmpty()) {
String backgroundString = "You don't have any backgrounds yet.";
FontHelper.INSTANCE.drawWithShadow(matrices, backgroundString, width - FontHelper.INSTANCE.getStringWidth(backgroundString) - 2, height - 30, -1);
} else {
String backgroundString = "Background: (" + (background + 1) + "/" + backgrounds.size() + ")";
FontHelper.INSTANCE.drawWithShadow(matrices, backgroundString, width - FontHelper.INSTANCE.getStringWidth(backgroundString) - 2, height - 30, -1);
}
}
for (net.minecraft.client.gui.Element element : this.children()) {
ClickableWidget abstractButtonWidget = (ClickableWidget) element;
abstractButtonWidget.setAlpha(g);
}
float top = this.height / 4.f + 45;
float bottom = top + (24 * 5) + 2;
float left = -1;
float right = 205;
Render2DHelper.INSTANCE.drawFace(matrices, 2, (int) bottom + 2, 4, MCAPIHelper.INSTANCE.getPlayerSkin(Wrapper.INSTANCE.getMinecraft().getSession().getProfile().getId()));
FontHelper.INSTANCE.drawWithShadow(matrices, "\2477Welcome, " + (isDonator ? "\247r" : (Addon.isLinkedToAccount(Wrapper.INSTANCE.getMinecraft().getSession().getUuid().replace("-", "")) ? "\247a" : "\247f")) + Wrapper.INSTANCE.getMinecraft().getSession().getUsername(), 37, bottom + 2, ColorHelper.INSTANCE.getRainbowColor());
if (Addon.isLinkedToAccount(Wrapper.INSTANCE.getMinecraft().getSession().getUuid().replace("-", ""))) {
FontHelper.INSTANCE.drawWithShadow(matrices, "\2477Jex Utility Client", 37, bottom + 12, -1);
Addon.AddonResponse response = Addon.getResponse(Wrapper.INSTANCE.getMinecraft().getSession().getUuid().replace("-", ""));
try {
if (response.getCape() != null && !response.getCape().isEmpty() && !response.getCape().equalsIgnoreCase("null")) {
Render2DHelper.INSTANCE.draw3DCape(matrices, 2, bottom + 35, new Identifier("jex", "capes/" + Wrapper.INSTANCE.getMinecraft().getSession().getUuid().replace("-", "")), capeYaw, 0);
} else {
Render2DHelper.INSTANCE.draw3DCape(matrices, 2, bottom + 35, new Identifier("jex", "cape/jex_cape.png"), capeYaw, 0);
}
} catch (Exception e) {
}
} else {
if (Cape.capes.containsKey("self")) {
Render2DHelper.INSTANCE.draw3DCape(matrices, 2, bottom + 35, Cape.capes.get("self"), capeYaw, 0);
}
FontHelper.INSTANCE.drawWithShadow(matrices, "\2477Account not linked. You can link your account for a free Jex Cape", 37, bottom + 12, -1);
FontHelper.INSTANCE.drawWithShadow(matrices, "\2477Also join the Discord!", 37, bottom + 22, -1);
}
Render2DHelper.INSTANCE.fillAndBorder(matrices, left, top, right, bottom, ColorHelper.INSTANCE.getClientColor(), 0x40000000, 1);
super.render(matrices, mouseX, mouseY, delta);
}
}
use of net.minecraft.client.render.GameRenderer in project HWG by cybercat-mods.
the class SniperMixin method renderSniperOverlay.
private void renderSniperOverlay() {
RenderSystem.disableDepthTest();
RenderSystem.depthMask(false);
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, SNIPER);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
bufferBuilder.vertex(0.0D, (double) this.scaledHeight, -90.0D).texture(0.0F, 1.0F).next();
bufferBuilder.vertex((double) this.scaledWidth, (double) this.scaledHeight, -90.0D).texture(1.0F, 1.0F).next();
bufferBuilder.vertex((double) this.scaledWidth, 0.0D, -90.0D).texture(1.0F, 0.0F).next();
bufferBuilder.vertex(0.0D, 0.0D, -90.0D).texture(0.0F, 0.0F).next();
tessellator.draw();
RenderSystem.depthMask(true);
RenderSystem.enableDepthTest();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
}
use of net.minecraft.client.render.GameRenderer in project Client by MatHax.
the class BookTooltipComponent method drawItems.
@Override
public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) {
// Background
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, TEXTURE_BOOK_BACKGROUND);
DrawableHelper.drawTexture(matrices, x, y, z, 12, 0, 112, 134, 179, 179);
// Content
matrices.push();
matrices.translate(x + 16, y + 12, z + 1);
matrices.scale(0.7f, 0.7f, 1f);
int offset = 0;
for (OrderedText line : textRenderer.wrapLines(page, 112)) {
textRenderer.draw(matrices, line, 0, offset, 0x000000);
offset += 8;
}
matrices.pop();
}
use of net.minecraft.client.render.GameRenderer in project Client by MatHax.
the class ContainerTooltipComponent method drawItems.
@Override
public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) {
// Background
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(color.r / 255f, color.g / 255f, color.b / 255f, color.a / 255f);
RenderSystem.setShaderTexture(0, TEXTURE_CONTAINER_BACKGROUND);
DrawableHelper.drawTexture(matrices, x, y, z, 0, 0, 176, 67, 176, 67);
// Contents
int row = 0;
int i = 0;
for (ItemStack itemStack : items) {
RenderUtils.drawItem(itemStack, x + 8 + i * 18, y + 7 + row * 18, true);
i++;
if (i >= 9) {
i = 0;
row++;
}
}
}
Aggregations