Started by
Araa2000
on
Topic category: Advanced modding
Im planning to make a mod that has an help/guidebook which tells crafting recipes and other information about the stuff of my mod. Is there any way to give the book to player when player spawns. Hopefully you understood im not english :).
Edited by Araa2000 on Fri, 04/24/2020 - 11:52
I dont think this is possible without coding,but maybe you should try to make a "Keybind" that when you press for a example the letter H in your keyboard it do the "Add item to inventory" event,then you just set it to add the guidebook!P.S. I hope you understood im not english too xD
i think GH127 is right
Have you looked into world events? I want to do the same just have not got to it yet still working on world gen first
First of all Make a variable. NewPlayer, make this variabe logic, and set it to true. This way whenever anyone first joins the world or server they will be defined as a NewPlayer.
1: Make a block that will at every tick give all new players the book.
2: keybind that gives everyone who is NewPlayer the book
3: When ever a NewPlayer Chats (Global Event) he/she gets the book
Now Create a GUI that
Make A Custom Variable. Every tick, check if variable = 1. If it does not, give item and set variable to 2. If variable = 2, do nothing.
Go into the code editor and find: 'ClientProxytestenvironmentmod.java' should look like below.
Now paste the following into it on line 10:
Like this:
Just put the Item in the ###ITEM_GOES_HERE### Like this but use your item.
How would you make it send a specific thing into the chat instead?
All right, there are quite a few wrong things about this.
First of all, I have to ask why do you add the code to CLIENT proxy and also why do you even add it to proxy class at all??
That is not how are proxies intended to work. They are used to split client and server side code, and that is not what do you want, especially if you need to do the detection on the server/common side.
Now, I can not see where do you register the class as an event handler, as I do not see the registration to the EVENT_BUS and it is not a static event handler.
Now, you can see that your variable entityData of type NBTTagCompound are not used at all.
To be honest, I do not really believe that this code will do anything in the game. Sure, it will recompile and it will not crash the game, but almost certainly, unless there is some code you did not show, it won't do anything.
I guess you picked up the code from some forum and edited until it recompiled successfully to you, judging by previously mentioned and the fact, that there is commented out SideOnly annotation in the tutorial.
Also to the question by NaiduBoys about sending a chat message to the player:
You can use EntityPlayer#sendMessage(ITextComponent).
As ITextComponent parse TextComponentString that takes as a parameter just the text as a string.
thanks
To be honest I don't even use Mcreator, I sometimes download it to see if I can help with some things.
Sorry, I'm a completely newbie, I can't find the Internet how to check a global variable, well, true or false, can you tell me how to do this?
I hope google translator did its job well, I'm in the ranks of not English!