use of net.minecraft.client.render.Tessellator in project Skyblocker by LifeIsAParadox.
the class ItemRendererMixin method renderItemBar.
@Inject(method = "renderGuiItemOverlay(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V", at = @At("HEAD"))
public void renderItemBar(TextRenderer renderer, ItemStack stack, int x, int y, @Nullable String countLabel, CallbackInfo ci) {
if (Utils.isOnSkyblock && SkyblockerConfig.get().locations.dwarvenMines.enableDrillFuel) {
if (!stack.isEmpty()) {
NbtCompound tag = stack.getNbt();
if (tag != null && tag.contains("ExtraAttributes")) {
if (tag.getCompound("ExtraAttributes").contains("drill_fuel")) {
float current = 3000.0F;
float max = 3000.0F;
for (String line : ItemUtils.getTooltipStrings(stack)) {
if (line.contains("Fuel: ")) {
String clear = Pattern.compile("[^0-9 /]").matcher(line).replaceAll("").trim();
String[] split = clear.split("/");
current = Integer.parseInt(split[0]);
max = Integer.parseInt(split[1]) * 1000;
break;
}
}
RenderSystem.disableDepthTest();
RenderSystem.disableTexture();
// RenderSystem.disableAlphaTest();
RenderSystem.disableBlend();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
float hue = Math.max(0.0F, 1.0F - (max - current) / max);
int width = Math.round(current / max * 13.0F);
int rgb = MathHelper.hsvToRgb(hue / 3.0F, 1.0F, 1.0F);
this.renderGuiQuad(buffer, x + 2, y + 13, 13, 2, 0, 0, 0, 255);
this.renderGuiQuad(buffer, x + 2, y + 13, width, 1, rgb >> 16 & 255, rgb >> 8 & 255, rgb & 255, 255);
RenderSystem.enableBlend();
// RenderSystem.enableAlphaTest();
RenderSystem.enableTexture();
RenderSystem.enableDepthTest();
}
}
}
}
}
use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.
the class Renderer method drawBoxFill.
public static void drawBoxFill(Box box, QuadColor color, Direction... excludeDirs) {
if (!FrustumUtils.isBoxVisible(box)) {
return;
}
setup();
MatrixStack matrices = matrixFrom(box.minX, box.minY, box.minZ);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
// Fill
RenderSystem.setShader(GameRenderer::getPositionColorShader);
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
Vertexer.vertexBoxQuads(matrices, buffer, Boxes.moveToZero(box), color, excludeDirs);
tessellator.draw();
cleanup();
}
use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.
the class Renderer method drawLine.
// -------------------- Lines --------------------
public static void drawLine(double x1, double y1, double z1, double x2, double y2, double z2, LineColor color, float width) {
if (!FrustumUtils.isPointVisible(x1, y1, z1) && !FrustumUtils.isPointVisible(x2, y2, z2)) {
return;
}
setup();
MatrixStack matrices = matrixFrom(x1, y1, z1);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
// Line
RenderSystem.disableDepthTest();
RenderSystem.disableCull();
RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
RenderSystem.lineWidth(width);
buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
Vertexer.vertexLine(matrices, buffer, 0f, 0f, 0f, (float) (x2 - x1), (float) (y2 - y1), (float) (z2 - z1), color);
tessellator.draw();
RenderSystem.enableCull();
RenderSystem.enableDepthTest();
cleanup();
}
use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.
the class Renderer method drawBoxOutline.
public static void drawBoxOutline(Box box, QuadColor color, float lineWidth, Direction... excludeDirs) {
if (!FrustumUtils.isBoxVisible(box)) {
return;
}
setup();
MatrixStack matrices = matrixFrom(box.minX, box.minY, box.minZ);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
// Outline
RenderSystem.disableCull();
RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
RenderSystem.lineWidth(lineWidth);
buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
Vertexer.vertexBoxLines(matrices, buffer, Boxes.moveToZero(box), color, excludeDirs);
tessellator.draw();
RenderSystem.enableCull();
cleanup();
}
use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.
the class Peek method renderTooltipBox.
private void renderTooltipBox(MatrixStack matrices, int x1, int y1, int x2, int y2, boolean wrap) {
int xStart = x1 + 12;
int yStart = y1 - 12;
if (wrap) {
if (xStart + x2 > mc.currentScreen.width)
xStart -= 28 + x2;
if (yStart + y2 + 6 > mc.currentScreen.height)
yStart = mc.currentScreen.height - y2 - 6;
}
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
Matrix4f matrix4f = matrices.peek().getModel();
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart - 4, xStart + x2 + 3, yStart - 3, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart + y2 + 3, xStart + x2 + 3, yStart + y2 + 4, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart - 3, xStart + x2 + 3, yStart + y2 + 3, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart - 4, yStart - 3, xStart - 3, yStart + y2 + 3, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart + x2 + 3, yStart - 3, xStart + x2 + 4, yStart + y2 + 3, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart - 3 + 1, xStart - 3 + 1, yStart + y2 + 3 - 1, 1347420415, 1344798847);
fillGradient(matrix4f, bufferBuilder, xStart + x2 + 2, yStart - 3 + 1, xStart + x2 + 3, yStart + y2 + 3 - 1, 1347420415, 1344798847);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart - 3, xStart + x2 + 3, yStart - 3 + 1, 1347420415, 1347420415);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart + y2 + 2, xStart + x2 + 3, yStart + y2 + 3, 1344798847, 1344798847);
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
RenderSystem.disableBlend();
RenderSystem.enableTexture();
}
Aggregations