logan121
-
Posts
26 -
Joined
-
Last visited
Posts posted by logan121
-
-
On 9/25/2019 at 8:45 PM, Regardful said:
@SubscribeEvent public void onMessageRecieved(ClientChatReceivedEvent e) { String raw = e.message.getUnformattedText(); if (raw.contains("l0l")) { if (check if message if from player) { Minecraft.getMinecraft().thePlayer.sendChatMessage("tes"); } } }
hey I'm making a mod and I wonder if theres a way to check if a message is from a player
I've been looking how to do this for so long, thank you!
-
Hello, im trying to make it so if the message that is sent in chat is == `hi` it will send hi! back.
This is what I have managed so far, although im unsure how i can make it only send if the message is == `hi` Originally I tried if(e.message.equals("hi");
However, it is false no matter what I do!
The type is IChatComponent
I then found out that I can do the following:
However, im unsure how i can filter the message so its only true if the message is == `hi`
@SubscribeEvent public void onChat(ChatReceivedEvent e) { if(e.message.equals(e.message)) { System.out.println(e.message); mc.Player.sendChatMessage("hi!"); }else { System.out.println(e.type); System.out.println("1"); } }
If anyone could help me it would be great as I have been trying to get this to work for around 2 hours.
Thanks,
Logan -
1 minute ago, diesieben07 said:
The # is notation to clarify that it is not a static method.
Ohh i see, thanks!
-
Just now, diesieben07 said:
If you do not know how to call a method you need to first learn basic Java before attempting to write a mod.
I don't know how to call something with a # in it no
-
23 minutes ago, diesieben07 said:
To trigger the pick block effect, call Minecraft#middleClickMouse,
Sorry to be a pain, could you give an example of this in use?
-
16 minutes ago, diesieben07 said:
Provide evidence you have actually updated.
An update from 1.8 (or even 1.12) to 1.15 takes a long time.
Had an environment already made, didnt have anything in my 1.8 version.
-
How do I send middle mouse click/pickblock in 1.15 and above?
-
KeyBinding.setKeyBindState(mc.gameSettings.keyBindPickBlock.getKeyCode(), true)
shouldn't this send middle mouse click?
so if user is in gmc it will press MMB and choose the block they are looking at
-
On 9/18/2020 at 2:56 AM, ChampionAsh5357 said:
If you mean simply like logging what a player types, use one of the many chat events in game and stored the text component or string being sent. Which one depends on where you would like to store the information. Probably the simplest to use is ClientChatEvent.
Thanks!
-
How can I record player commands?
-
Hello, I'm trying to create a wait function for my MC mod, where it waits 5 seconds. Im using thread.sleep, and as you know it pauses all processes for 5 seconds.
Currently I have this:class chatTimer implements Runnable { private String chat; public Thread send(String chat) { this.chat = chat; System.out.println("hi"); Thread t = new Thread(this); t.start(); return t; } @Override public void run() { try { Thread.sleep(2000); mc.Player.sendChatMessage("hi"); } catch (InterruptedException e) { e.printStackTrace(); } } } @Override public void onModuleEnable() throws IOException { super.onModuleEnable(); new chatTimer(); }
Any idea what I'm doing wrong? It doesn't seem to run the send message line.
-
if(!webhook) { if(mc.getCurrentServerData() != null || mc.getCurrentServerData().serverIP != null) { w.send("`" + "They are currently on server: " + mc.getCurrentServerData().serverIP + "\n`"); webhook = true;} }else if (mc.getCurrentServerData() == null || mc.getCurrentServerData().serverIP == null) { w.send("`" + "They are currently on Single player world" + "\n`"); webhook = true; }else { webhook = true; } }
Hello, im currently struggling with this null pointer.
I thought my If checks would stop this, not sure what i am doing wrong?
java.lang.NullPointerException: Unexpected error
``` if(mc.getCurrentServerData() != null || mc.getCurrentServerData().serverIP != null) {``` this is returning null. -
4 minutes ago, Beethoven92 said:
if (e != null) return;
Whats the point of this line? Also, which forge version are you using?
Just making sure no crashes occur, and im using 1.8.9.
-
2 minutes ago, Danebi said:
Sorry, I meant this:
e.getEntity()
Sorry to be a pain, but i end up getting the same error
@SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent e) { if (e != null) return; e.getEntity(); }
java: cannot find symbol
symbol: method getEntity()
location: variable e of type net.minecraftforge.event.entity.EntityJoinWorldEvent -
java: cannot find symbol
symbol: method getEntity()
location: class net.minecraftforge.fml.common.eventhandler.Ev@SubscribeEvent public void onEntityConstruct(EntityJoinWorldEvent e) { if (e != null) return; Event.getEntity(); }
ent
-
What would I put in the if statement? I thought itd be ItemEntity, but thats not there if im doing e.ItemEntity?
@SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent e) { if() }
-
It doesn't burn unfortunetly.
-
Sorry for the lack of detail.
Above a certain block (lava) would be ideal. -
If there is a item entity (dirt) on the floor, i need to be able to detect it somehow.
-
Is there a way to detect a item entity that is spawned into the world?
For example,there is a dirt block onto the flaw, id like to be able to detect that.
Checking for specific server message
in Modder Support
Posted
I've finally figured it out,
next step: How can I make it so if the player sends this message, it will only send it client side?