Jump to content

Area effect cloud doesn't despawn, what I did wrong?


Myarin

Recommended Posts

Hi, I'm a little new on modding. Actually this its my first mod and everything was going fine until I got stuck on this problem.

I have a block that when it breaks is replaced and the player get posion and I wanted to spawn an AreaEffectCloud if is breaked with an explosion.
So I did that:

@Override
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion) {
  replaceRegen(world, pos);
  EntityAreaEffectCloud cloud = new EntityAreaEffectCloud(world, pos.getX(),pos.getY(),pos.getZ());
  cloud.setOwner(explosion.getExplosivePlacedBy());
  cloud.setRadius(2.5F);
  cloud.setRadiusOnUse(-0.5F);
  cloud.setWaitTime(10);
  cloud.setDuration(260);
  cloud.addEffect(new PotionEffect(MobEffects.POISON,800,3));
  world.spawnEntity(cloud);
}

where "replaceRegen" is the function to replace the block and the rest is how I spawn the effect cloud.
But for some reason, this code summon 2 clouds and the second one doesn't despawn.
This is how it looks a normal cloud:
https://i.imgur.com/U0l0kYO.png
And this is how it look the one that my code summon
https://i.imgur.com/lZ6Islu.png

Not really sure if there's 2 clouds or one with 2 hitbox. It looks like 2 diferent entities and the first one despawn.
But the second one remains and drop particles on the center, it looks like a bug, only disappears if I go back to menu and load the world again.
https://i.imgur.com/jOdK4pU.png

Someone know why this happen and how can I fix it?
I checked with diferent versions about how to spawn and all are almost the same and the same error happens.

Link to comment
Share on other sites

Makes sense! So the ghost cloud entity with no values are actually unused client data not syncronized with the server one...
Thanks a lot, that was so helpful ^-^

Still dind't know how to call events from server side but now I kwow where to investigate, thank you!

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.