Tutorial Creating a helix / 3d spiral out of particles

Discussion in 'Resources' started by Skionz, Sep 28, 2014.

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

    ChipDev

    I mean, what does your CURRENT code do?
     
  2. Offline

    xXCapzXx

    I just linked you to the video. It does the last thing it does for him.

    It is at 11:32
     
  3. Offline

    ChipDev

    Decrease the radius every loop.
     
  4. Offline

    xXCapzXx

    Thanks, it worked!
     
    Last edited: Jul 1, 2015
  5. Offline

    ChipDev

    You are very welcome!
     
  6. Offline

    xXCapzXx

    But how do I make it so that it lasts forever not just when you do /flamey.
    Here is the code:
    Code:
    package me.capz.helix;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.util.Vector;
    
    import de.slikey.effectlib.EffectLib;
    import de.slikey.effectlib.EffectManager;
    
    public class version2 extends JavaPlugin implements Listener{
    
    
    
        public void onEnable() {
            
        }
       
        public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
            Player player = (Player)sender;
            if(cmd.getLabel().equalsIgnoreCase("flamey"))  {
                    flamey(player);
                   
            }
            return true;
        }
       
        private void flamey(Player player) {
            Location l = player.getLocation();
            double radius = 2;
            double maxHeight = 10;
            for(int i1 = 0; i1 < 1; i1++) {
            for(double y = 0; y < 2; y+= 0.1, radius--) {
               double x =  Math.cos(y * radius) * 0.4; 
               double z =  Math.sin(y * radius) * 0.8;   
           
            net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles packet = new net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles("flame",
                                ((float) (l.getX() + x)), 
                                ((float) (l.getY() + y)),
                                ((float) (l.getZ() + z)),
                                0, 0, 0, 1, 0);
           
           
           
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
        }
        }
           
           
           
            }
    
     
  7. Offline

    ChipDev

    Make a runnable in the onEnable()?
     
  8. Offline

    xXCapzXx

    Can you edit my code so it does that, not so good with runnables.
     
  9. Offline

    ChipDev

  10. Offline

    Skionz

    Incrementally increase the radius.
     
  11. Can someone tell me how to create a square of particles??:)
     
  12. Offline

    Zombie_Striker

    @stijnthedev
    To create square particles all you need to do is check if the X, Y or Z values are at the min or max. If so, spawn the particle.
     
  13. Offline

    au2001

    Using the API ParticleLib and this code, I made a tornado for a magic plugin:
    Code:
    double radius = 0.1;
    ParticleEffect particle = new ParticleEffect(ParticleType.SMOKE_NORMAL, 0, 1, 0);
    for (double y = 0; y <= 4; y += 0.002) {
        double x = (radius*=1.0015) * Math.cos(Math.pow(y, 2)*10);
        double z = radius * Math.sin(Math.pow(y, 2)*10);
        particle.sendToLocation(loc.clone().add(x, y, z));
    }
    You can play with the numbers to make it taller, make it increase size faster, etc.
    And I personally made it move randomly and make entities "bounce", looks really nice :)
     

    Attached Files:

    ChipDev likes this.
  14. Offline

    ChipDev

    It's funny how since your tutorial, I've learned this and Mastered it.
    Thanks :)
    (Now I'm into graphing 3D. So, thanks for skipping me 3 grades :D)
     
    MrShnig likes this.
  15. Offline

    gal0511Dev

    I cant get it to work for 1.8, help please?
     
  16. Offline

    gal0511Dev

  17. Offline

    Skionz

    Use the correct constructor.
     
  18. @gal0511Dev
    MC 1.8's particle packet now uses the "EnumParticle" as particle parameter instead of a String.
     
  19. Offline

    ChipDev

    That's why its not as confusing to use ParticleEffectLib
     
  20. Offline

    Agentleader1

    This is one of the major reasons advanced math is as a matter of fact applicable to real life. And people think it's not applicable...

    Outstanding work of art and trigonometry. Great util tool.
     
    megamichiel likes this.
Thread Status:
Not open for further replies.

Share This Page