This commit is contained in:
ThisIsALegitUsername 2023-03-04 23:24:42 +00:00
parent 266e877f20
commit 2c81a94856
5 changed files with 55597 additions and 55610 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

@ -5,14 +5,12 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums; import net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer; import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
public class RoundedUtil { public class RoundedUtil {
final static Minecraft mc = Minecraft.getMinecraft();
final static FontRenderer fr = mc.fontRendererObj;
final static Minecraft mc = Minecraft.getMinecraft();
public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) { public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
Tessellator tessellator = Tessellator.getInstance(); Tessellator tessellator = Tessellator.getInstance();
@ -39,7 +37,7 @@ public class RoundedUtil {
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 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) 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); glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
EaglercraftGPU.glEndList(); tessellator.draw();
worldrenderer.begin(RealOpenGLEnums.GL_LINE_LOOP, DefaultVertexFormats.POSITION_TEX); worldrenderer.begin(RealOpenGLEnums.GL_LINE_LOOP, DefaultVertexFormats.POSITION_TEX);
for (i = 0; i <= 90; i += 3) 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); 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);
@ -49,7 +47,7 @@ public class RoundedUtil {
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 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) 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); glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
EaglercraftGPU.glEndList(); tessellator.draw();
GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
GlStateManager.disableBlend(); GlStateManager.disableBlend();
GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
@ -83,7 +81,7 @@ public class RoundedUtil {
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 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) 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); glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
EaglercraftGPU.glEndList(); tessellator.draw();
GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
GlStateManager.disableBlend(); GlStateManager.disableBlend();
GlStateManager.disableBlend(); GlStateManager.disableBlend();

View File

@ -1,6 +1,7 @@
package net.minecraft.client.gui; package net.minecraft.client.gui;
import dev.resent.util.render.Color; import dev.resent.util.render.Color;
import dev.resent.util.render.RenderUtils;
import dev.resent.util.render.RoundedUtil; import dev.resent.util.render.RoundedUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.PositionedSoundRecord;
@ -75,7 +76,7 @@ public class GuiButton extends Gui {
* Draws this button to the screen. * Draws this button to the screen.
*/ */
public void drawButton(Minecraft mc, int mouseX, int mouseY) { public void drawButton(Minecraft mc, int mouseX, int mouseY) {
RoundedUtil.drawSmoothRoundedRect(this.xPosition, this.yPosition, xPosition + width, yPosition + this.height, 4, Color.BLACK.getRGB()); RenderUtils.drawRoundedRect(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; 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()); 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());