Fix glasses

This commit is contained in:
UnknownUser1789 2023-01-20 19:58:02 +00:00
parent c4635ae702
commit 30dcbc60d3
5 changed files with 24339 additions and 24361 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
package dev.resent.cosmetic.impl; package dev.resent.cosmetic.impl;
import dev.resent.cosmetic.CosmeticBase; import dev.resent.cosmetic.CosmeticBase;
import dev.resent.cosmetic.CosmeticController;
import dev.resent.cosmetic.CosmeticModelBase; import dev.resent.cosmetic.CosmeticModelBase;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.AbstractClientPlayer;
@ -18,6 +19,7 @@ public class Glasses extends CosmeticBase {
@Override @Override
public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float headYaw, float headPitch, float scale) { public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float headYaw, float headPitch, float scale) {
if(CosmeticController.renderGlasses(player)){
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
if(player.isSneaking()) { if(player.isSneaking()) {
GlStateManager.translate(0, 0.225, 0); GlStateManager.translate(0, 0.225, 0);
@ -27,6 +29,7 @@ public class Glasses extends CosmeticBase {
this.glassesModel.render(player, limbSwing, limbSwingAmount, ageInTicks, headYaw, headPitch, scale); this.glassesModel.render(player, limbSwing, limbSwingAmount, ageInTicks, headYaw, headPitch, scale);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }
}
public class GlassesRenderer extends CosmeticModelBase{ public class GlassesRenderer extends CosmeticModelBase{

View File

@ -19,17 +19,10 @@ public class Sprint extends RenderModule {
public int lastKeyHeldTicks = 0; public int lastKeyHeldTicks = 0;
public int keyHeldTicks = 0; public int keyHeldTicks = 0;
public boolean toggled = false; public boolean toggled = false;
public boolean clickDebounce = false;
private String getText() {
String text = ""; String text = "";
@Override
public int getWidth() {
return fr.getStringWidth(text)+2;
}
@Override
public void draw() {
this.fr = mc.fontRendererObj;
if (mc.thePlayer.capabilities.isFlying) { if (mc.thePlayer.capabilities.isFlying) {
text = " [Flying]"; text = " [Flying]";
} }
@ -37,9 +30,7 @@ public class Sprint extends RenderModule {
if (mc.gameSettings.keyBindSprint.isKeyDown()) { if (mc.gameSettings.keyBindSprint.isKeyDown()) {
keyHeldTicks += 1; keyHeldTicks += 1;
text = "[Sprinting (Key Held)] "; text = "[Sprinting (Key Held)] ";
} } else if (!mc.gameSettings.keyBindSprint.isKeyDown()) {
if (!mc.gameSettings.keyBindSprint.isKeyDown()) {
keyHeldTicks = 0; keyHeldTicks = 0;
} }
@ -52,8 +43,20 @@ public class Sprint extends RenderModule {
text = "[Sprinting (Toggled)]"; text = "[Sprinting (Toggled)]";
} }
lastKeyHeldTicks = keyHeldTicks;
return text;
}
@Override
public int getWidth() {
return fr.getStringWidth(getText());
}
@Override
public void draw() {
this.fr = mc.fontRendererObj;
if (drawn.getValue()) if (drawn.getValue())
fr.drawStringWithShadow(text, x + 2, y + 2, Theme.getFontColor(Theme.getId())); fr.drawStringWithShadow(getText(), x + 2, y + 2, Theme.getFontColor(Theme.getId()));
} }
@Override @Override

View File

@ -34,32 +34,6 @@ public class RenderUtils {
return -1; return -1;
} }
public static void drawChromaRect(int zLevel, int x, int y, int width, int height) {
GlStateManager.pushMatrix();
GlStateManager.translate((float)x, (float)(y + height), (float)0.0f);
GlStateManager.rotate((float)-90.0f, (float)0.0f, (float)0.0f, (float)1.0f);
int p_drawGradientRect_5_ = Color.HSBtoRGB((float)((System.currentTimeMillis() - (long)x * 10L - (long)y * 10L) % 2000L) / 2000.0f, 0.8f, 0.8f);
int p_drawGradientRect_6_ = Color.HSBtoRGB((float)((System.currentTimeMillis() - (long)(x + width / 2) * 10L - (long)y * 10L) % 2000L) / 2000.0f, 0.8f, 0.8f);
float lvt_11_1_ = (float)(p_drawGradientRect_6_ >> 24 & 0xFF) / 255.0f;
float lvt_12_1_ = (float)(p_drawGradientRect_6_ >> 16 & 0xFF) / 255.0f;
float lvt_13_1_ = (float)(p_drawGradientRect_6_ >> 8 & 0xFF) / 255.0f;
float lvt_14_1_ = (float)(p_drawGradientRect_6_ & 0xFF) / 255.0f;
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.tryBlendFuncSeparate((int)770, (int)771, (int)1, (int)0);
GlStateManager.shadeModel((int)7425);
Tessellator lvt_15_1_ = Tessellator.getInstance();
WorldRenderer lvt_16_1_ = lvt_15_1_.getWorldRenderer();
lvt_16_1_.begin(7, DefaultVertexFormats.POSITION_COLOR);
lvt_16_1_.pos((double)height, (double)width, (double)zLevel).color(lvt_12_1_, lvt_13_1_, lvt_14_1_, lvt_11_1_).endVertex();
lvt_15_1_.draw();
GlStateManager.shadeModel((int)7424);
GlStateManager.disableBlend();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
}
public static void drawChromaString(String string, int x, int y, boolean shadow) { public static void drawChromaString(String string, int x, int y, boolean shadow) {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();