fire ball. Help in creating.

Discussion in 'Plugin Development' started by RCR, Sep 22, 2019.

Thread Status:
Not open for further replies.
  1. Offline

    RCR

    hi, I want to make it so that when a player presses the right button particles in the form of a fireball fly out (causing damage to the enemy), experience is taken away for this. Who will help with the code?
     
  2. Offline

    Sir_Jonn

    PlayerInteractEvent
    check the item in hand
    Rightclick air and right-click block
    Spawn projectile
    Fireball b = (Fireball) world.spawn(loc, Fireball.class);
    then set the velocity & direction?
     
  3. @Sir_Jonn I think he doesn't mean the Minecraft fireball.
    @RCR We will help you with the code but we don't want to write it for you ^^ So where are you stuck? What have you already done?
    Sir_Jonn already gave you some information, particles are created like this:
    Code:java
    1. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleType, true, x, y, z, offsetX, offsetY, offsetZ, speed, amount);
    2. ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);

    so just start and tell us if you have issues
     
  4. Offline

    RCR

    @DerDonut I want to make a fireball from particles. Could you give a link on how to make a fireball, and how it would cause damage to a player.
     
  5. Offline

    Sir_Jonn

    https://hub.spigotmc.org/javadocs/bukkit/overview-summary.html
    Why not just make a fireball and add the particles that shoot out at the same time? Check the damage by EntityDamageEvent and check if it's a projectile
     
  6. @RCR there is no link for creating a fireball, but there are plenty of tutorials on how to work with particles. Just google it.
    And yeah the best way to detect the collusion is to launch some kind of projectile (e.g. a fireball but you can also use snowballs, arrows..) which also can be made invisible later on. Also launching an actual entity makes it easier to spawn the particles in the right position An issue could be that these projectiles are too fast for your plans but just try it
     
Thread Status:
Not open for further replies.

Share This Page