Creeper Explosion via Packets

Discussion in 'Spigot Plugin Development' started by CodeString, May 26, 2017.

  1. Hey Guys,
    searched like one hour but find nothing.
    My Code:
    Code (Text):
    WorldServer s = ((CraftWorld)loc.getWorld()).getHandle();
                            EntityCreeper entityToSpawn = new EntityCreeper(s);

                            entityToSpawn.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
  2. Why via packets? That's going to make the client and server out of sync pretty bad. Are you just trying to show the effects? If so just send the explosion particle effect and maybe damage them if you need to.

    Otherwise just use World.createExplosion, maybe.
  3. I only want the animation thats right, but I also want the animation before the explosion...
  4. Oh like you want to show an actual creeper that explodes? Ok gotcha, but idk sorry.
  5. Yes, but thanks for trying to help me.
  6. While I am unsure of how to do it with packets, my suggestions include:

    • Spawning a real Creeper, and teleporting it to the designated location
    • Due to the nature of creepers, it will perform the desired effect
    • Listen for EntityExplodeEvent, check if #getEntity() is a Creeper
    • Cancel the event
    • Follow through

    Might not be as smooth, nor does it use packets, however a friend of mine also made a thread similar to this several months ago, which can be found at: (Spigot) or (Bukkit)