Started by
nagol12344
on
Topic category: Help with Minecraft modding (Java Edition)
I want to set a player name to a string var and then add it to something like Has 'used a EPIC LOOT BOX' so i could say "USER used a EPIC LOOT BOX' in chat
First, make a new procedure.

Then insert these blocks like this:
Now Lock the procedure
Open the procedure, and it should look like this:
Now bear with, because while this might seem confusing (and is), I will try to explain as simply as I can.
We need to find our information which we want to send, which we can find inside the "Component.literal()"
Inside, we have to strings: We have the entity display name: (entity.getDisplayName().getString()) and our string " has used EPIC lootbox".
(This is the simplest way (for me) not the only one)

If we want to tie these to together, we have to create (local) strings like so:
*note that you can create as many as you want*
Now assign the variables their values, for example:
String pt1 = (entity.getDisplayName().getString());
String pt2 = " has used EPIC lootbox";
*Make sure to add the semi-colons, otherwise it will throw an error*
Now that we have our strings, all we have to do is insert them into the function:
Lastly, just save the file, and your function should work!