Jump to content

nomadsky

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by nomadsky

  1. I don't know if this is correct but I managed to get this to work; @SuppressWarnings("resource") @SubscribeEvent public static void onLogging(final ClientPlayerNetworkEvent.LoggedInEvent event) { Minecraft.getInstance().player.sendMessage((ITextComponent)new StringTextComponent("Test"), null); }
  2. I've updated the line to include ITextComponent "Minecraft.getInstance().player.sendMessage((ITextComponent)new StringTextComponent("Test"));" but it still gives the same error with "sendMessage"
  3. now it highlights "sendMessage" in red and if I hover over it it says "The method sendMessage(ITextComponent, UUID) in the type ClientPlayerEntity is not applicable for the arguments (StringTextComponent)"
  4. I'm trying to create a macro mod for a for 1.16.5 but most examples I can find of similar projects are so old that the code has been changed, i've been trying myself to just send a message when the player logins to get "Minecraft.getInstance().player.sendMessage(new TextComponentString("test"));" to work but to be honest it feels like i'm just brute forcing it without it ever working. Just crashing when logging into the server... It feels like it should be simple but I don't get why it won't work... Here's the whole code; (yes I asked a qustion about this before but without basically any details) package com.name.themod.core.event; import com.name.themod.TheMod; import net.minecraft.client.Minecraft; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @Mod.EventBusSubscriber(modid = TheMod.MOD_ID, bus = Bus.FORGE) public class EventHandler { @SubscribeEvent public static void onLogging(final ClientPlayerNetworkEvent.LoggedInEvent event) { Minecraft.getInstance().player.sendMessage(new TextComponentString("test")); } } I've used this as an example https://www.tabnine.com/code/java/classes/net.minecraft.util.text.TextComponentString but it says "TextComponentString" doesn't work, i've tried to change it to "StringTextComponent" but that doesn't work either., if anyone knows why this doesn't work i'd be grateful for the help!
  5. it highlight TextComponentString in red, as in it does not exist
  6. I've been trying to do this for some hours now but can't seem to get this line to work... Minecraft.getInstance().player.sendMessage(new TextComponentString("test")); If you think there's something else that's messing things up feel free to check, note that this is my first time with forge. package com.generic_name.mod.core.event; import com.generic_name.mod.TheMod; import net.minecraft.client.Minecraft; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @Mod.EventBusSubscriber(modid = TheMod.MOD_ID, bus = Bus.FORGE) public class EventHandler { @SubscribeEvent public static void onLogging(final ClientPlayerNetworkEvent.LoggedInEvent event) { Minecraft.getInstance().player.sendMessage(new TextComponentString("test")); } } thank you for the help
×
×
  • Create New...

Important Information

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