Jump to content

Ghost entity when I spawn entity [FIXED]


ColdFox

Recommended Posts

When I spawn a entity, in this case a Blaze, it also appears another Blaze but I can't do anything to it. It only disappears when I reenter in the world.

 

Any help?

 

public boolean onBlockActivated(World par1World, int x, int y, int z,EntityPlayer par5EntityPlayer, int par6, float par7, float par8,float par9) {
	EntityBlaze blaze1 = new EntityBlaze(par1World);
	blaze1.setPosition(x, y+3, z);
	blaze1.spawnExplosionParticle();
	par1World.spawnEntityInWorld(blaze1);
	return true;
}

Link to comment
Share on other sites

Use a packet. Make that packet spawn the entity server side.

 

Though I am questioning if it should be server side. If it needs to be server side, then use a packet.

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

I had it working for a bit of time on a redstone activated spawner.

 

Packets are generally a good idea to sync the server and client. Which seems to be the case here. If there is a "ghost entity" that would be (I think) the server thinking there is an entity there, but the actual client is making the entity without letting the server know the entity is made...

 

Just a plain ole me rambling on xD This may or may not be the case...

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

I had it working for a bit of time on a redstone activated spawner.

 

Packets are generally a good idea to sync the server and client. Which seems to be the case here. If there is a "ghost entity" that would be (I think) the server thinking there is an entity there, but the actual client is making the entity without letting the server know the entity is made...

 

Just a plain ole me rambling on xD This may or may not be the case...

 

Thanks, I'll try that latter ;)

Link to comment
Share on other sites

  • 3 weeks later...

no need for a packet here.

Use world.isRemote to check if you are on the server or client. world.isRemote == true => client

 

I fixed it today with that, and only saw your reply when I was closing this thread, thanks anyway :)

Link to comment
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.
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.