Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Entity Syncronisation


Recommended Posts

So, I am fairly sure that you only need to create/spawn entities server-side (to avoid having client-side "ghost" entities), but I don't know how to then make the client aware of the entities that are spawned server-side.

 

(Note that I am not referring to mobs, just entities that inherit from the base entity class)

 

Thanks in advance for any help!

Link to post
Share on other sites

At the moment, the entity only exists server-side.

 

Is it that I am entering it into the world wrong? At the moment what I am doing is this:

worldObj.spawnEntityInWorld(entity);

Which only occurs server-side, and the entity is definitely ticking server-side so it definitely gets this far at the least.

Link to post
Share on other sites

Yes I have registered the entity in the init phase (do I need to do it in a specific phase?)

EntityRegistry.registerGlobalEntityID(EntityQuantumEssentia.class, "qfthaum_essentia", EntityRegistry.findGlobalUniqueEntityId());

Link to post
Share on other sites

registerGlobalEntityID is only useful if you need a vanilla spawn egg for your entity. Otherwise do not use it! It takes up precious space in the limit entity id range of vanilla entities, and doesn't actually register your Entity with the networking system.

Use registerModEntity for that, then you don't need findGlobalUniqueEntityId either, you can use any number between 0 and 255, they are per-mod.

Link to post
Share on other sites

Ok, changing that has worked, thanks a bunch!

for the sake of anyone wondering about my final solution:

EntityRegistry.registerModEntity(EntityQuantumEssentia.class, "qfthaum_essentia", 0, this, 64, 1, true);

Link to post
Share on other sites

I've now hit a related issue.

 

Put simply, I don't know how to synchronize variables inside the entity, (which usually would not be an issue unless they are used for rendering, which this is).

 

In this particular case the variable is set when the entity is created and will never be changed.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.