diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/ftbsc/bscv/patches/ChatPatch.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/patches/ChatPatch.java b/src/main/java/ftbsc/bscv/patches/ChatPatch.java new file mode 100644 index 0000000..b8bc887 --- /dev/null +++ b/src/main/java/ftbsc/bscv/patches/ChatPatch.java @@ -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)); + } + } + +} |