feat: jank way to prevent chat clearing
This commit is contained in:
parent
0dc1644c14
commit
dd9b4bb539
1 changed files with 32 additions and 0 deletions
32
src/main/java/ftbsc/bscv/patches/ChatPatch.java
Normal file
32
src/main/java/ftbsc/bscv/patches/ChatPatch.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package ftbsc.bscv.patches;
|
||||
|
||||
import ftbsc.lll.processor.annotations.Injector;
|
||||
import ftbsc.lll.processor.annotations.Patch;
|
||||
import ftbsc.lll.processor.annotations.Target;
|
||||
import net.minecraft.client.gui.NewChatGui;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
|
||||
public class ChatPatch {
|
||||
|
||||
@Patch(value = NewChatGui.class, reason = "add hook to prevent chat from being cleared")
|
||||
public abstract static class ChatClearInterceptor implements Opcodes {
|
||||
|
||||
/*
|
||||
* TODO this patch is pretty bad because it prevents everyone from clearing the chat history.
|
||||
*
|
||||
* A better (but more complex) approach would be to patch in Minecraft.setScreen() and prevent clearing
|
||||
* chat history upon getting into main menu / multiplayer menu
|
||||
*/
|
||||
|
||||
@Target
|
||||
abstract void clearMessages(boolean clearSent);
|
||||
|
||||
@Injector
|
||||
public void inject(ClassNode clazz, MethodNode main) {
|
||||
main.instructions.insert(new InsnNode(RETURN));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue