Started by
Truemirror
on
Topic category: General discussion
Yesterday I played on my server and we have ProjectE there. I setup a sugar cane farm for infinite EMC, but the energy condenser overflowed with canes, and so I thought to myself why not make a mod which allows me to craft sugar cane blocks. Problem is, mod runs fine in singleplayer, but the server crashes when I run it.
Can you post your crash log?
Which version of MCreator did you use to create this mod?
Version 1.7.3 for MC 1.7.10, here's the crash report:
https://pastebin.com/rRLPqWrS
Are you sure your mod only adds new recipes?
Class of your block uses references to client-only classes in the common or server-side code, resulting in to crash, as the server-side cannot see these classes as they de-facto are not there.
The client-side class is EntityClientPlayerMP. You have to use some common or server-side class instead, depending on your needs. I do not have an access to your code, but I guess that using EntityPlayer should be enough, if it is possible in the method, that the EntityClientPlayerMP is referenced from. Another possible solution could be checking for server-side (using field isRemote (its value is false for a server) in World class) and/or using @SideOnly annotation.
Well, first, it only adds a recipe for the sugar cane block, which is 4 sugar canes in a square pattern.
Second, I have absolutely no clue as to how these classes work, how can I change them etc. I'm guessing when I select the mod I go to "Edit code of selected element", but everything to me there is just a bunch of text. Any suggestions how to do this?
Ohhh by "only new recipes" you meant if there's already a sugar cane block... No, the block is also from the MCreator mod.
I can not offer any more help as long as you don't provide any of your code, as it is nearly impossible to do anything without it.
Ohhh, my bad. Here's the code:
https://pastebin.com/jDQuRU2r
Replace
by this
And you should be fine.
:( Didn't work, failed to recompile
Here's the gradle log (I suppose it might help?):
https://pastebin.com/L867ZhKR
And the code:
https://pastebin.com/EKQARiUD
You have to import EntityLivingBase class, you can do it manually (import net.minecraft.entity.EntityLivingBase;), or you can use the fix imports button. (Actually that is not its name, but it is close enough. Most likely something like "fix imports & format code".)
Thank you so much, it worked!
One question, do I have to do this everytime I want to add a mod to a server?
I have not modded for 1.7.10 for quite a while, but it seems that MCreator for this version most likely generates this part of the code for every new block. So you have to do this change for every new block, I guess. Alternatively, you could also just remove the part of the code. What the code actually does is that it sets the metadata f the block based on placer facing on its placement, so if you do not want to have the block this functionality, you should be fine without it.