This commit is contained in:
ThisIsALegitUsername 2023-03-04 23:06:48 +00:00
parent 38cea35593
commit 266e877f20
5 changed files with 57207 additions and 57178 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,13 @@
/*package dev.resent.util.render;
package dev.resent.util.render;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
public class RoundedUtil {
final static Minecraft mc = Minecraft.getMinecraft();
@ -11,18 +15,21 @@ public class RoundedUtil {
public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
glPushAttrib(0);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.scale(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(RealOpenGLEnums.GL_BLEND);
glDisable(RealOpenGLEnums.GL_TEXTURE_2D);
glEnable(RealOpenGLEnums.GL_LINE_SMOOTH);
setColor(color);
glEnable(RealOpenGLEnums.GL_LINE_SMOOTH);
glBegin(RealOpenGLEnums.GL_POLYGON);
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
float alpha = (color >> 24 & 0xFF) / 255.0F;
float red = (color >> 16 & 0xFF) / 255.0F;
float green = (color >> 8 & 0xFF) / 255.0F;
float blue = (color & 0xFF) / 255.0F;
GlStateManager.color(red, green, blue, alpha);
worldrenderer.begin(RealOpenGLEnums.GL_POLYGON, DefaultVertexFormats.POSITION_TEX);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
@ -32,8 +39,8 @@ public class RoundedUtil {
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
glBegin(RealOpenGLEnums.GL_LINE_LOOP);
EaglercraftGPU.glEndList();
worldrenderer.begin(RealOpenGLEnums.GL_LINE_LOOP, DefaultVertexFormats.POSITION_TEX);
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
for (i = 90; i <= 180; i += 3)
@ -42,30 +49,31 @@ public class RoundedUtil {
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
EaglercraftGPU.glEndList();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
glDisable(RealOpenGLEnums.GL_LINE_SMOOTH);
glDisable(RealOpenGLEnums.GL_LINE_SMOOTH);
GlStateManager.disableBlend();
GlStateManager.enableTexture2D();
GlStateManager.scale(2.0D, 2.0D, 2.0D);
glPopAttrib();
glLineWidth(1);
EaglercraftGPU.glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
glPushAttrib(0);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.scale(0.5D, 0.5D, 0.5D);
x *= 2.0D;
y *= 2.0D;
x1 *= 2.0D;
y1 *= 2.0D;
glEnable(RealOpenGLEnums.GL_BLEND);
glDisable(RealOpenGLEnums.GL_TEXTURE_2D);
glEnable(RealOpenGLEnums.GL_LINE_SMOOTH);
setColor(color);
glEnable(RealOpenGLEnums.GL_LINE_SMOOTH);
glBegin(RealOpenGLEnums.GL_POLYGON);
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
float alpha = (color >> 24 & 0xFF) / 255.0F;
float red = (color >> 16 & 0xFF) / 255.0F;
float green = (color >> 8 & 0xFF) / 255.0F;
float blue = (color & 0xFF) / 255.0F;
GlStateManager.color(red, green, blue, alpha);
worldrenderer.begin(RealOpenGLEnums.GL_POLYGON, DefaultVertexFormats.POSITION_TEX);
int i;
for (i = 0; i <= 90; i += 3)
glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D);
@ -75,13 +83,18 @@ GlStateManager.disableBlend();
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius);
for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd();
EaglercraftGPU.glEndList();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
GlStateManager.disableBlend();
GlStateManager.disableBlend();
GlStateManager.disableBlend();
GlStateManager.scale(2.0D, 2.0D, 2.0D);
glEnable(RealOpenGLEnums.GL_BLEND);
glPopAttrib();
GlStateManager.enableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
}*/
public static void glVertex2d(double idk, double idk2){
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.pos(idk, idk2, 0);
}
}

View File

@ -1,15 +1,10 @@
package net.minecraft.client.gui;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import dev.resent.util.render.Color;
import dev.resent.util.render.RenderUtils;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import dev.resent.util.render.RoundedUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.audio.SoundHandler;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
/**+
@ -80,8 +75,7 @@ public class GuiButton extends Gui {
* Draws this button to the screen.
*/
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if(!Tessellator.getInstance().getWorldRenderer().isDrawing)
RenderUtils.drawRoundedRect(this.xPosition, this.yPosition, xPosition + width, yPosition + this.height, 4, Color.BLACK.getRGB(), true);
RoundedUtil.drawSmoothRoundedRect(this.xPosition, this.yPosition, xPosition + width, yPosition + this.height, 4, Color.BLACK.getRGB());
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
drawCenteredString(mc.fontRendererObj, this.displayString, this.xPosition + this.width / 2f, this.yPosition + (this.height - 8) / 2f, this.hovered ? new Color(47, 116, 253, 255).getRGB() : new Color(200, 200, 200).getRGB());