Jump to content

Help with 1.8.9 mod that copies messages when ctrl + right clicking on them


Recommended Posts

Help with 1.8.9 mod that copies messages when ctrl + right clicking on them


I'm pretty new to Forge modding and been trying to figure out how to get the chat message that was ctrl + right clicked on then copy the message, but I have no clue, any help?

I know I could just get a mod that already does this but I want to do this by myself


this is all i have right now:

package com.example.examplemod;

import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;

import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.awt.datatransfer.Clipboard;

@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION)
public class ExampleMod {
	public static final String MODID = "examplemod";
	public static final String VERSION = "1.0";
	private static String copiedMessage = "";

	public void init(FMLInitializationEvent event) {
		// some example code
		System.out.println("DIRT BLOCK >> " + Blocks.dirt.getUnlocalizedName());

	public void onClientTick(TickEvent.ClientTickEvent event) {
		Minecraft mc = Minecraft.getMinecraft();

		if (Mouse.isButtonDown(1) && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && mc.currentScreen instanceof GuiChat) {


Link to comment
Share on other sites

This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello all! I'm currently trying to make the Biomes o' Plenty mod (1.12.2 version) compatible with my shaderpack (BSL v8.5). Even after I've already inserted a "shaders" folder with a correctly-formatted blocks.PROPERTIES file within the assets folder of the .jar, it still does not wave the textures from the mod. I definitely thought this was going to work since I noticed the 1.19.2 version of the mod laid it out exactly like that and it worked perfectly when my PC was able to run 1.19.2 Forge... ^^;;; Could there be some missing link I'm not getting at here?
    • After much experimentation I finally realised why this doesn't work and how to fix it. The critical component to understand here, is that ItemCraftedEvent is called before the crafting ingredients are purged from the crafting slots; this all happens in ResultSlot.java's onTake method: We can see here the first line fires checkTakeAchievements, this is what fires the ItemCraftedEvent (after a few method calls). Then we can see the purge behaviour. I worked around this by creating a CarverItem class, which uses hasCraftingRemainingItem and getCraftingRemainingItem to hook into ResultSlot.onTake: Now, I reconstruct my ItemCraftedEvent handler, and using some smart tags (which I omit for brevity), I handle two cases: 1. When crafting a carved item, I damage the tool used in the recipe 2. When crafting a carving tool from a repair recipe, I manually purge the input tools as with the new CarverItem class, as otherwise items would be duplicated   This has now greatly improved implementation, beyond my expectations, for the standard crafting table and the user's inventory crafting grid. A user can now click or shift-click 'carve' items, with no duplication or issues that I have spotted so far.  
    • Hi, I'm having issues launching my Forge 1.20.1 installation (47.2.0). I keep getting error code 1, and all the logs abruptly pause with the game attempting to open GL 4.6. Latest Crash: https://pastebin.com/zsP5Wipk Debug (No idea what the real name is) Log: https://pastebin.com/CzvqhNq0   Thanks for the help!
    • In the most up to date version of Allthemods 6 (v1.9.2) the stoned bee is not able to be interacted with apart from putting it into an empty bee jar. I can't breed the bee or put it into my aviary breeder. When I try to put it into the breeder it says import unsuccessful. The stoned bee is one of the most important bees for advancing in the mod so it is rather unfortunate that it is not working as intended.
    • Everytime I try to run the Forge 1.20.1 - 47.1.0 Installer, only appears an a black window and then closes. I don't appear the installing menu anymore.
  • Topics

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.