Skip to content

Commit

Permalink
B120
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed May 10, 2024
1 parent 7820e47 commit 097f69f
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ class Cape : Module() {
),
"NightX"
) { customCape.get() }
val animationModeValue = ListValue(
"Animations-Mode",
arrayOf(
"Normal",
"Smooth"
),
"Normal"
)

private val capeCache = hashMapOf<String, CapeStyle>()
fun getCapeLocation(value: String): ResourceLocation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Interface : Module() {
private val targetHudYPosValue = FloatValue("TargetHud-YPos", 0F, -300F, 300F) { targetHudValue.get() }
private val pingValue = BoolValue("Ping", true)
private val cFontValue = BoolValue("C-Font", true)
val oldRotationRendererValue = BoolValue("CrazyRotation-Renderer", true)
val noAchievement = BoolValue("No-Achievements", true)
val nof5crossHair = BoolValue("NoF5-Crosshair", true)
val animHotbarValue = BoolValue("Hotbar-Animation", false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ class SilentRotations : Module() {
RotationUtils.enableLook()

mc.thePlayer.rotationYaw = RotationUtils.targetRotation?.yaw!!
if (Launch.moduleManager.getModule(Interface::class.java)?.state!! && Launch.moduleManager.getModule(Interface::class.java)?.oldRotationRendererValue?.get()!!) {
mc.thePlayer.rotationYawHead = mc.thePlayer.rotationYaw
mc.thePlayer.renderYawOffset = mc.thePlayer.rotationYaw
}
mc.thePlayer.rotationPitch = RotationUtils.targetRotation?.pitch!!
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ public void drawButton(Minecraft mc, int mouseX, int mouseY) {
this.enabled ? new Color(0F, 0F, 0F, this.alpha / 255F).getRGB() :
new Color(120F, 120F, 120F, 100F).getRGB());
else {
RenderUtils.originalRoundedRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 0F, new Color(0F, 0F, 0F, this.alpha / 255F).getRGB());
if (this.enabled && this.hovered) {
RenderUtils.drawGradientRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + 1, new Color(0, 0, 255, 80).getRGB(), new Color(0, 0, 255, 80).getRGB());
RenderUtils.drawGradientRect(this.xPosition, this.yPosition + this.height - 1, this.xPosition + this.width, this.yPosition + this.height, new Color(0, 0, 255, 80).getRGB(), new Color(0, 0, 255, 80).getRGB());
RenderUtils.drawGradientRect(this.xPosition, this.yPosition, this.xPosition + 1, this.yPosition + this.height, new Color(0, 0, 255, 80).getRGB(), new Color(0, 0, 255, 80).getRGB());
RenderUtils.drawGradientRect(this.xPosition + this.width - 1, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, new Color(0, 0, 255, 80).getRGB(), new Color(0, 0, 255, 80).getRGB());
RenderUtils.originalRoundedRect(this.xPosition + 1, this.yPosition + 1, this.xPosition + this.width - 1, this.yPosition + this.height - 1, 0F, new Color(0F, 0F, 0F, this.alpha / 255F).getRGB());
} else {
RenderUtils.originalRoundedRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 0F, new Color(0F, 0F, 0F, this.alpha / 255F).getRGB());
}
}

int j = 13816530;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) {
this.enabled ? new Color(0F, 0F, 0F, this.alpha / 255F).getRGB() :
new Color(120F, 120F, 120F, 100F).getRGB());
else {
RenderUtils.originalRoundedRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 0F, new Color(0F, 0F, 0F, this.alpha / 255F).getRGB());
if (this.enabled && this.hovered) {
RenderUtils.drawGradientRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + 1, new Color(0, 0, 255, 80).getRGB(), new Color(0, 0, 255, 80).getRGB());
RenderUtils.drawGradientRect(this.xPosition, this.yPosition + this.height - 1, this.xPosition + this.width, this.yPosition + this.height, new Color(0, 0, 255, 80).getRGB(), new Color(0, 0, 255, 80).getRGB());
RenderUtils.drawGradientRect(this.xPosition, this.yPosition, this.xPosition + 1, this.yPosition + this.height, new Color(0, 0, 255, 80).getRGB(), new Color(0, 0, 255, 80).getRGB());
RenderUtils.drawGradientRect(this.xPosition + this.width - 1, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, new Color(0, 0, 255, 80).getRGB(), new Color(0, 0, 255, 80).getRGB());
RenderUtils.originalRoundedRect(this.xPosition + 1, this.yPosition + 1, this.xPosition + this.width - 1, this.yPosition + this.height - 1, 0F, new Color(0F, 0F, 0F, this.alpha / 255F).getRGB());
} else {
RenderUtils.originalRoundedRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 0F, new Color(0F, 0F, 0F, this.alpha / 255F).getRGB());
}
}

int j = 13816530;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,120 +1,19 @@
package net.aspw.client.injection.forge.mixins.gui;

import net.aspw.client.utils.MinecraftInstance;
import net.aspw.client.utils.ServerUtils;
import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.network.NetHandlerLoginClient;
import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.handshake.client.C00Handshake;
import net.minecraft.network.login.client.C00PacketLoginStart;
import net.minecraft.util.ChatComponentTranslation;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.atomic.AtomicInteger;

/**
* The type Mixin gui connecting.
*/
@Mixin(GuiConnecting.class)
public abstract class MixinGuiConnecting extends GuiScreen {

@Shadow
@Final
private static Logger logger;
@Shadow
@Final
private static AtomicInteger CONNECTION_ID;
@Shadow
private NetworkManager networkManager;
@Shadow
private boolean cancel;
@Shadow
@Final
private GuiScreen previousGuiScreen;

@Inject(method = "connect", at = @At("HEAD"))
private void headConnect(final String ip, final int port, CallbackInfo callbackInfo) {
ServerUtils.serverData = new ServerData("", ip + ":" + port, true);
}

/**
* @author As_pw
* @reason Connection Fix
*/
@Overwrite
private void connect(final String ip, final int port) {
logger.info("Authenticating to " + ip + ", " + port);

new Thread(() -> {
InetAddress inetaddress = null;

try {
if (cancel) {
return;
}

inetaddress = InetAddress.getByName(ip);
networkManager = NetworkManager.createNetworkManagerAndConnect(inetaddress, port, mc.gameSettings.isUsingNativeTransport());
networkManager.setNetHandler(new NetHandlerLoginClient(networkManager, mc, previousGuiScreen));
networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true));
networkManager.sendPacket(new C00PacketLoginStart(mc.getSession().getProfile()));
} catch (UnknownHostException unknownhostexception) {
if (cancel)
return;

logger.error("Couldn't connect to server", unknownhostexception);
mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", "Unknown host")));
} catch (Exception exception) {
if (cancel) {
return;
}

logger.error("Couldn't connect to server", exception);
String s = exception.toString();

if (inetaddress != null) {
String s1 = inetaddress + ":" + port;
s = s.replaceAll(s1, "");
}

mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", s)));
}
}, "Server Connector #" + CONNECTION_ID.incrementAndGet()).start();
}

/**
* @author As_pw
* @reason Logging in
*/
@Overwrite
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
ScaledResolution scaledResolution = new ScaledResolution(MinecraftInstance.mc);

this.drawDefaultBackground();

String ip = "Unknown";

final ServerData serverData = mc.getCurrentServerData();
if (serverData != null)
ip = serverData.serverIP;

drawCenteredString(fontRendererObj, "Logging in to", scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 102, 16777215);
drawCenteredString(fontRendererObj, "§7" + ip, scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 115, 16777215);

super.drawScreen(mouseX, mouseY, partialTicks);
}
}
Loading

0 comments on commit 097f69f

Please sign in to comment.