Jump to content

Recommended Posts

Posted

       @SubscribeEvent
public void entityJoinWorld(EntityJoinWorldEvent e) {
	ExtendedProperties data = null;
	if(e.entity instanceof EntityPlayerMP && LightDrafter.proxy.getWorld() != null)
		data = ExtendedProperties.get((EntityPlayer) e.entity);
	if (data != null)
	    data.entitySpawned();
}

CommonProxy
        public World getWorld()
{
	return FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[0];
}

ClientProxy
@Override
public World getWorld()
{
	return Minecraft.getMinecraft().theWorld;
}

 

In SMP this is catching only once and it is catching before the server has a world instance, which is stopping me from syncing player IEEP info.

What can I do to trigger data.entitySpawned() when the server finishes loading?

 

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

@SubscribeEvent
public void entityJoinWorld(EntityJoinWorldEvent e)
{
if (e.entity instanceof EntityPlayer && !e.entity.worldObj.isRemote) // can be replaces by if (e.entity instanceof EntityPlayerMP)
	ExtendedProperties.get((EntityPlayer) e.entity).entitySpawned();
}

 

That is all it takes. You don't need IEEP null check nor ANY "proxyfication" of code.

 

For future:

* Learn what Proxy does - there is difference between logical (world.isRemote) and application side (client.jar / dedic.jar).

* Don't ever get world that way.

 

1.7.10 is no longer supported by forge, you are on your own.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.