Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Release 2.2.0 (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-mc authored Aug 23, 2024
1 parent 0e0e326 commit 9f3da3b
Show file tree
Hide file tree
Showing 55 changed files with 1,716 additions and 339 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ apply plugin: 'java'

group = "keystrokesmod"
archivesBaseName = "raven-XD"
//version = "2.1.1"
//version = "2.2-Dev"

compileJava {
sourceCompatibility = '1.8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ public void onClick(int x, int y, int b) {
return;
}
this.buttonSetting.toggle();
this.mod.guiButtonToggled(this.buttonSetting);
try {
this.mod.guiButtonToggled(this.buttonSetting);
} catch (Exception ignored) {
}
if (Raven.currentProfile != null) {
((ProfileModule) Raven.currentProfile.getModule()).saved = false;
}
Expand Down
28 changes: 12 additions & 16 deletions src/main/java/keystrokesmod/event/RotationEvent.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package keystrokesmod.event;

import keystrokesmod.module.impl.other.RotationHandler;
import lombok.Getter;
import lombok.Setter;
import net.minecraftforge.fml.common.eventhandler.Event;

public class RotationEvent extends Event {
@Getter
private float yaw;
@Getter
private float pitch;
@Setter
@Getter
private RotationHandler.MoveFix moveFix;
@Getter
private boolean smoothBack = true;
private boolean isSet;

public RotationEvent(float yaw, float pitch, RotationHandler.MoveFix moveFix) {
Expand All @@ -15,33 +23,21 @@ public RotationEvent(float yaw, float pitch, RotationHandler.MoveFix moveFix) {
this.moveFix = moveFix;
}

public float getYaw() {
return yaw;
}

public void setYaw(float yaw) {
this.yaw = yaw;
isSet = true;
}

public float getPitch() {
return pitch;
}

public void setPitch(float pitch) {
this.pitch = pitch;
isSet = true;
}

public RotationHandler.MoveFix getMoveFix() {
return this.moveFix;
}

public void setMoveFix(RotationHandler.MoveFix moveFix) {
this.moveFix = moveFix;
}

public boolean isSet() {
return isSet;
}

public void noSmoothBack() {
smoothBack = false;
}
}
14 changes: 14 additions & 0 deletions src/main/java/keystrokesmod/event/SprintEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package keystrokesmod.event;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import net.minecraftforge.fml.common.eventhandler.Event;

@Getter
@Setter
@AllArgsConstructor
public class SprintEvent extends Event {
private boolean sprint;
private boolean omni;
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected void func_110146_f(float p_1101461, float p_1101462, CallbackInfoRetur
*/
@Inject(method = "jump", at = @At("HEAD"), cancellable = true)
protected void jump(CallbackInfo ci) {
JumpEvent jumpEvent = new JumpEvent(getJumpUpwardsMotion(), RotationHandler.getMovementYaw(this));
JumpEvent jumpEvent = new JumpEvent((float) MoveUtil.jumpMotion(), RotationHandler.getMovementYaw(this));
MinecraftForge.EVENT_BUS.post(jumpEvent);
if (jumpEvent.isCanceled()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,12 @@ public void onLivingUpdate() {
boolean flag2 = this.movementInput.moveForward >= f;
this.movementInput.updatePlayerMoveState();
boolean usingItemModified = this.isUsingItem() || (ModuleManager.killAura != null && ModuleManager.killAura.isEnabled() && ModuleManager.killAura.block.get() && ((Object) this) == Minecraft.getMinecraft().thePlayer && ModuleManager.killAura.rmbDown && ModuleManager.killAura.manualBlock.isToggled());
boolean stopSprint = (this.isUsingItem() && ModuleManager.noSlow != null && ModuleManager.noSlow.isEnabled() && NoSlow.getForwardSlowed() == 0.8) || Sprint.stopSprint();
boolean stopSprint = (this.isUsingItem() && ModuleManager.noSlow != null && ModuleManager.noSlow.isEnabled() && NoSlow.getForwardSlowed() == 0.8);

if (!stopSprint) {
stopSprint = Sprint.stopSprint();
}

if (usingItemModified && !this.isRiding()) {
MovementInput var10000 = this.movementInput;
var10000.moveStrafe *= NoSlow.getStrafeSlowed();
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/keystrokesmod/mixins/impl/event/MixinEventBus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package keystrokesmod.mixins.impl.event;


import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.EventBus;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(value = EventBus.class, remap = false)
public abstract class MixinEventBus {

@Inject(method = "post", at = @At(value = "INVOKE", target = "Lcom/google/common/base/Throwables;propagate(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;"), cancellable = true)
public void onPostHandleException(Event event, @NotNull CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(false);
}
}
21 changes: 15 additions & 6 deletions src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import keystrokesmod.utility.font.FontManager;
import keystrokesmod.utility.font.IFont;
import keystrokesmod.utility.render.*;
import keystrokesmod.utility.render.blur.GaussianBlur;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
Expand All @@ -20,6 +21,8 @@

import java.awt.*;

import static keystrokesmod.Raven.mc;


@Mixin(GuiButton.class)
public abstract class MixinGuiButton extends Gui {
Expand Down Expand Up @@ -59,18 +62,24 @@ public void onDrawButton(Minecraft minecraft, int x, int y, CallbackInfo ci) {
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;

if (hovered)
ravenXD$hoverValue = Math.min(ravenXD$hoverValue + 70, 200);
ravenXD$hoverValue = (int) Math.min(ravenXD$hoverValue + 4.0 * 150 / Minecraft.getDebugFPS(), 200);
else
ravenXD$hoverValue = Math.max(ravenXD$hoverValue - 70, 102);
ravenXD$hoverValue = (int) Math.max(ravenXD$hoverValue - 4.0 * 150 / Minecraft.getDebugFPS(), 102);

Color rectColor = new Color(35, 37, 43, ravenXD$hoverValue);
rectColor = raven_XD$interpolateColorC(rectColor, ColorUtils.brighter(rectColor, 0.4f), -1);
RenderUtils.drawBloomShadow(xPosition - 3, yPosition - 3, width + 6, height + 6, 12, new Color(0, 0, 0, 50), false);
RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, (float)3.5, 0.0015f, rectColor, new Color(30, 30, 30, 100));
RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, (float)3.5, 0.0015f, new Color(0, 0, 0, 5) , new Color(0, 0, 0, 5));
RRectUtils.drawRoundOutline(xPosition, yPosition, width, height, (float)3.5, 0.0015f, new Color(0, 0, 0, 50) , new Color(200, 200, 200, 60));
RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, 3.5F, 0.0015f, rectColor, new Color(30, 30, 30, 100));
if (ModuleManager.clientTheme.buttonBlur.isToggled())
GaussianBlur.startBlur();
RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 5) , new Color(0, 0, 0, 5));
RRectUtils.drawRoundOutline(xPosition, yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 50) , new Color(200, 200, 200, 60));
if (ModuleManager.clientTheme.buttonBlur.isToggled())
GaussianBlur.endBlur(20, 5);

this.mouseDragged(minecraft, x, y);

font.drawCenteredString(displayString, this.xPosition + this.width / 2.0f, this.yPosition + height / 2f - font.height() / 2f, -1);
font.drawCenteredString(ModuleManager.clientTheme.buttonLowerCase.isToggled() ? displayString.toLowerCase() : displayString, this.xPosition + this.width / 2.0f, this.yPosition + height / 2f - font.height() / 2f, -1);
}

ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ public void onInitGui(CallbackInfo ci) {
if (!ModuleManager.clientTheme.isEnabled() || !ModuleManager.clientTheme.mainMenu.isToggled())
return;

int j = this.height / 4 + 48;
int j = this.height / 4 + 54;
this.buttonList.add(new GuiButton(1, this.width / 2 - 103, j, 200, 18, "SinglePlayer"));
this.buttonList.add(new GuiButton(2, this.width / 2 - 103, j + 24, 200, 18, "MultiPlayer"));
this.buttonList.add(new GuiButton(6, this.width / 2 - 103, j + 48, 200, 18, "Mods"));
this.buttonList.add(new GuiButton(0, this.width / 2 - 103, j + 72 + 12, 98, 18, "Options"));
this.buttonList.add(new GuiButton(4, this.width / 2 - 1, j + 72 + 12, 98, 18, "Quit"));
this.buttonList.add(new GuiButton(2, this.width / 2 - 103, j + 22, 200, 18, "MultiPlayer"));
this.buttonList.add(new GuiButton(6, this.width / 2 - 103, j + 44, 200, 18, "Mods"));
this.buttonList.add(new GuiButton(0, this.width / 2 - 103, j + 66 + 12, 98, 18, "Options"));
this.buttonList.add(new GuiButton(4, this.width / 2 - 1, j + 66 + 12, 98, 18, "Quit"));

this.mc.setConnectedToRealms(false);
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import keystrokesmod.event.PostVelocityEvent;
import keystrokesmod.event.PreVelocityEvent;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.utility.Reflection;
import keystrokesmod.utility.Utils;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.network.play.server.S12PacketEntityVelocity;
Expand All @@ -28,10 +29,12 @@ public void onPreHandleEntityVelocity(S12PacketEntityVelocity packet, CallbackIn
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled()) ci.cancel();

S12PacketEntityVelocityAccessor accessor = (S12PacketEntityVelocityAccessor) packet;
accessor.setMotionX(event.getMotionX());
accessor.setMotionY(event.getMotionY());
accessor.setMotionZ(event.getMotionZ());
try {
Reflection.S12PacketEntityVelocityXMotion.set(packet, event.getMotionX());
Reflection.S12PacketEntityVelocityYMotion.set(packet, event.getMotionY());
Reflection.S12PacketEntityVelocityZMotion.set(packet, event.getMotionZ());
} catch (IllegalAccessException ignored) {
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
package keystrokesmod.mixins.impl.network;

import com.mojang.realmsclient.gui.ChatFormatting;
import io.netty.channel.ChannelHandlerContext;
import keystrokesmod.Raven;
import keystrokesmod.event.ReceivePacketEvent;
import keystrokesmod.event.SendPacketEvent;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.client.Notifications;
import keystrokesmod.module.impl.exploit.ExploitFixer;
import keystrokesmod.utility.PacketUtils;
import keystrokesmod.utility.Utils;
import net.minecraft.network.INetHandler;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.ThreadQuickExitException;
import org.spongepowered.asm.mixin.Mixin;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Arrays;

@Mixin(value = NetworkManager.class, priority = 1001)
public abstract class MixinNetworkManager {
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
Expand Down Expand Up @@ -50,4 +60,30 @@ public void receivePacket(ChannelHandlerContext p_channelRead0_1_, Packet<?> p_c
} catch (Exception ignored) {
}
}

@Redirect(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/Packet;processPacket(Lnet/minecraft/network/INetHandler;)V"))
public void onProcessPacket(Packet<?> instance, INetHandler handler) {
try {
((Packet<INetHandler>) instance).processPacket(handler);
} catch (ThreadQuickExitException ignored) { // 😅 Minecraft wtf
} catch (Exception e) {
try {
if (ModuleManager.exploitFixer != null && ModuleManager.exploitFixer.isEnabled() && ExploitFixer.safePacketProcess != null && ExploitFixer.safePacketProcess.isToggled()) {
final StringBuilder stackTraces = new StringBuilder();

Arrays.stream(e.getStackTrace())
.limit(4)
.parallel()
.map(s -> "\n " + ChatFormatting.RED + "at " + ChatFormatting.AQUA + s)
.forEach(stackTraces::append);

Utils.sendMessage(String.format(
"%sCatch %s on processing packet <%s>.%s",
ChatFormatting.RED, e.getClass(), instance.toString(), stackTraces
));
}
} catch (Throwable ignored) {
}
}
}
}

This file was deleted.

31 changes: 18 additions & 13 deletions src/main/java/keystrokesmod/module/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import keystrokesmod.module.setting.Setting;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.ModeValue;
import keystrokesmod.module.setting.impl.SubMode;
import keystrokesmod.script.Script;
import keystrokesmod.utility.Utils;
import keystrokesmod.utility.i18n.I18nModule;
Expand Down Expand Up @@ -36,6 +37,7 @@ public class Module {
@Getter
@Setter
private boolean enabled;
@Getter
private int keycode;
private final @Nullable String toolTip;
protected static Minecraft mc;
Expand All @@ -60,10 +62,11 @@ public Module(String moduleName, Module.category moduleCategory, int keycode, @N
this.enabled = false;
mc = Minecraft.getMinecraft();
this.settings = new ArrayList<>();
Raven.moduleCounter++;
if (!(this instanceof SubMode))
Raven.moduleCounter++;
}

public static Module getModule(Class<? extends Module> a) {
public static @Nullable Module getModule(Class<? extends Module> a) {
Iterator<Module> var1 = ModuleManager.modules.iterator();

Module module;
Expand Down Expand Up @@ -131,7 +134,10 @@ public void enable() {
}
else {
FMLCommonHandler.instance().bus().register(this);
this.onEnable();
try {
this.onEnable();
} catch (Exception ignored) {
}
}
}

Expand All @@ -146,7 +152,10 @@ public void disable() {
}
else {
FMLCommonHandler.instance().bus().unregister(this);
this.onDisable();
try {
this.onDisable();
} catch (Exception ignored) {
}
}
}

Expand Down Expand Up @@ -226,10 +235,10 @@ public Module.category moduleCategory() {
return this.moduleCategory;
}

public void onEnable() {
public void onEnable() throws Exception {
}

public void onDisable() {
public void onDisable() throws Exception {
}

public void toggle() {
Expand All @@ -247,17 +256,13 @@ public void toggle() {

}

public void onUpdate() {
}

public void guiUpdate() {
public void onUpdate() throws Exception {
}

public void guiButtonToggled(ButtonSetting b) {
public void guiUpdate() throws Exception {
}

public int getKeycode() {
return this.keycode;
public void guiButtonToggled(ButtonSetting b) throws Exception {
}

public void setBind(int keybind) {
Expand Down
Loading

0 comments on commit 9f3da3b

Please sign in to comment.