forked from MeteorDevelopment/meteor-client
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into master-ame
# Conflicts: # src/main/java/meteordevelopment/meteorclient/asm/Asm.java # src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientMixin.java # src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java
- Loading branch information
Showing
66 changed files
with
1,849 additions
and
920 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/meteordevelopment/meteorclient/asm/transformers/PacketInflaterTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). | ||
* Copyright (c) Meteor Development. | ||
*/ | ||
|
||
package meteordevelopment.meteorclient.asm.transformers; | ||
|
||
import meteordevelopment.meteorclient.asm.AsmTransformer; | ||
import meteordevelopment.meteorclient.asm.Descriptor; | ||
import meteordevelopment.meteorclient.asm.MethodInfo; | ||
import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick; | ||
import org.objectweb.asm.Label; | ||
import org.objectweb.asm.Opcodes; | ||
import org.objectweb.asm.Type; | ||
import org.objectweb.asm.tree.*; | ||
|
||
// Future compatibility | ||
// Future uses @ModifyConstant which does not chain when multiple mods do it and mixins / mixinextra can't target throw | ||
// statements. So using a custom ASM transformer we wrap the throw statement inside another if statement. | ||
public class PacketInflaterTransformer extends AsmTransformer { | ||
private final MethodInfo decodeMethod; | ||
|
||
public PacketInflaterTransformer() { | ||
super(mapClassName("net/minecraft/class_2532")); | ||
|
||
decodeMethod = new MethodInfo("net/minecraft/class_2532", "decode", new Descriptor("Lio/netty/channel/ChannelHandlerContext;", "Lio/netty/buffer/ByteBuf;", "Ljava/util/List;", "V"), true); | ||
} | ||
|
||
@Override | ||
public void transform(ClassNode klass) { | ||
MethodNode method = getMethod(klass, decodeMethod); | ||
if (method == null) error("[Meteor Client] Could not find method PacketInflater.decode()"); | ||
|
||
int newCount = 0; | ||
LabelNode label = new LabelNode(new Label()); | ||
|
||
//noinspection DataFlowIssue | ||
for (AbstractInsnNode insn : method.instructions) { | ||
if (insn instanceof TypeInsnNode typeInsn && typeInsn.getOpcode() == Opcodes.NEW && typeInsn.desc.equals("io/netty/handler/codec/DecoderException")) { | ||
newCount++; | ||
|
||
if (newCount == 2) { | ||
InsnList list = new InsnList(); | ||
|
||
list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "meteordevelopment/meteorclient/systems/modules/Modules", "get", "()Lmeteordevelopment/meteorclient/systems/modules/Modules;", false)); | ||
list.add(new LdcInsnNode(Type.getType(AntiPacketKick.class))); | ||
list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "meteordevelopment/meteorclient/systems/modules/Modules", "isActive", "(Ljava/lang/Class;)Z", false)); | ||
|
||
list.add(new JumpInsnNode(Opcodes.IFNE, label)); | ||
|
||
method.instructions.insertBefore(insn, list); | ||
} | ||
} | ||
else if (newCount == 2 && insn.getOpcode() == Opcodes.ATHROW) { | ||
method.instructions.insert(insn, label); | ||
return; | ||
} | ||
} | ||
|
||
error("[Meteor Client] Failed to modify PacketInflater.decode()"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/meteordevelopment/meteorclient/mixin/ChatHudLineVisibleMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). | ||
* Copyright (c) Meteor Development. | ||
*/ | ||
|
||
package meteordevelopment.meteorclient.mixin; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import meteordevelopment.meteorclient.mixininterface.IChatHudLineVisible; | ||
import net.minecraft.client.gui.hud.ChatHudLine; | ||
import net.minecraft.text.OrderedText; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
@Mixin(ChatHudLine.Visible.class) | ||
public class ChatHudLineVisibleMixin implements IChatHudLineVisible { | ||
@Shadow @Final private OrderedText content; | ||
@Unique private int id; | ||
@Unique private GameProfile sender; | ||
@Unique private boolean startOfEntry; | ||
|
||
@Override | ||
public String meteor$getText() { | ||
StringBuilder sb = new StringBuilder(); | ||
|
||
content.accept((index, style, codePoint) -> { | ||
sb.appendCodePoint(codePoint); | ||
return true; | ||
}); | ||
|
||
return sb.toString(); | ||
} | ||
|
||
@Override | ||
public int meteor$getId() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public void meteor$setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public GameProfile meteor$getSender() { | ||
return sender; | ||
} | ||
|
||
@Override | ||
public void meteor$setSender(GameProfile profile) { | ||
sender = profile; | ||
} | ||
|
||
@Override | ||
public boolean meteor$isStartOfEntry() { | ||
return startOfEntry; | ||
} | ||
|
||
@Override | ||
public void meteor$setStartOfEntry(boolean start) { | ||
startOfEntry = start; | ||
} | ||
} |
Oops, something went wrong.