need help in spiral projectile trails

Discussion in 'Plugin Development' started by azedazdazd, Dec 31, 2020.

  1. Offline

    azedazdazd

    Code:
    Code:
                tasks.put(e.getEntity(), new BukkitRunnable() {
                    @Override
                    public void run() {
                        Location loc = e.getEntity().getLocation();
                        float red = (float) 0.5882;
                        float green = (float) 0.7255;
                        float blue = (float) 0.9176;
                        float red1 = (float) 0.2235;
                        float green1 = (float) 0.4824;
                        float blue1 = (float) 0.5843;
                        double radius = 0.5;
                        for(Player online1 : Bukkit.getOnlinePlayers()) {
                            double z = e.getEntity().getLocation().getZ();
                            double x = radius * Math.cos(e.getEntity().getVelocity().getZ()*8);
                            double y = radius * Math.sin(e.getEntity().getVelocity().getZ()*8);
                            PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles (EnumParticle.REDSTONE, true, (float) loc.getX() + (float)x, (float) loc.getY() + (float)y, (float) loc.getZ(), red, blue, green, (float)1, 0);
                            PacketPlayOutWorldParticles packet11 = new PacketPlayOutWorldParticles (EnumParticle.REDSTONE, true, (float) loc.getX() + (float)-x, (float) loc.getY() + (float)-y, (float) loc.getZ(), red1, blue1, green1, (float)1, 0);
                            for(Player online : Bukkit.getOnlinePlayers()) {
                                ((CraftPlayer)online).getHandle().playerConnection.sendPacket(packet11);
                                ((CraftPlayer)online).getHandle().playerConnection.sendPacket(packet);
                            }
                        }
                        if(e.getEntity().isDead()) {
                            if (e.getEntity().getShooter() instanceof Player) {
                                BukkitTask task = tasks.get(e.getEntity());
                                if (task != null) {
                                    task.cancel();
                                    tasks.remove(e.getEntity());
                                }
                            }
                        }
                    }
                  
                }.runTaskTimer(JavaPlugin.getPlugin(Main.class), 0L, 0L));
    i need help so that the spiral shape appears in the x direction too not only z
     
  2. Offline

    Kars

    This is a wild guess but perhaps do this here again but with X instead of Z? :eek:
    PHP:
    double z e.getEntity().getLocation().getZ();
    double x radius Math.cos(e.getEntity().getVelocity().getZ()*8);
    double y radius Math.sin(e.getEntity().getVelocity().getZ()*8);
     

Share This Page