Simple block mod can't run on a server

Started by Truemirror on Tue, 08/07/2018 - 06:52

Topic category: General discussion

Last seen on 16:48, 9. Aug 2018
Joined Apr 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
Simple block mod can't run on a server
Tue, 08/07/2018 - 06:52

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.

0Upvote this forum topic
Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
Can you post your crash log?
Tue, 08/07/2018 - 08:12

Can you post your crash log?

0Upvote this forum topic
Which version of MCreator…
Tue, 08/07/2018 - 16:21

Which version of MCreator did you use to create this mod?

0Upvote this forum topic
Last seen on 16:48, 9. Aug 2018
Joined Apr 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
Version 1.7.3 for MC 1.7.10,…
Tue, 08/07/2018 - 17:44

Version 1.7.3 for MC 1.7.10, here's the crash report:

https://pastebin.com/rRLPqWrS

0Upvote this forum topic
Are you sure your mod only…
Tue, 08/07/2018 - 19:33

Are you sure your mod only adds new recipes?

0Upvote this forum topic
Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
Class of your block uses…
Tue, 08/07/2018 - 19:57

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.

0Upvote this forum topic
Last seen on 16:48, 9. Aug 2018
Joined Apr 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
Well, first, it only adds a…
Wed, 08/08/2018 - 08:09

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?

0Upvote this forum topic
Last seen on 16:48, 9. Aug 2018
Joined Apr 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
Ohhh by "only new recipes"…
Wed, 08/08/2018 - 08:11

Ohhh by "only new recipes" you meant if there's already a sugar cane block... No, the block is also from the MCreator mod.

0Upvote this forum topic
Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
I can not offer any more…
Wed, 08/08/2018 - 09:11

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.

0Upvote this forum topic
Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • Tracker tickets:
Replace  public void…
Wed, 08/08/2018 - 10:34

Replace 

public void onBlockAdded(World world, int i, int j, int k) {
            EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
            if (entity != null && world != null) {
                int le = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
                world.setBlockMetadataWithNotify(i, j, k, le, 2);
            }
 
            world.scheduleBlockUpdate(i, j, k, this, this.tickRate(world));
 
        }

 

by this

public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entity, ItemStack stack) {
            if (entity != null && world != null) {
                int le = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
                world.setBlockMetadataWithNotify(i, j, k, le, 2);
            }
 
            world.scheduleBlockUpdate(i, j, k, this, this.tickRate(world));
 
        }

And you should be fine.

0Upvote this forum topic