Solved Playing STEP_SOUND particles without sound?

Discussion in 'Plugin Development' started by Assist, Aug 31, 2013.

Thread Status:
Not open for further replies.
  1. Code:java
    1. for (Location pos: util.getSphere(user.getTargetBlock(null, 10).getLocation(), 5, 5, true, true, 1)) {
    2. l.getWorld().playEffect(new Location(l.getWorld(), pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), Effect.STEP_SOUND, Material.ICE);
    3. }

    equivalent of a screamer ^, which scared the living do I say what out of me. I'm trying to play an ice breaking particle effect in a 5x5x5 area, so should I use Packet63WorldParticles instead, or use ProtocolLib to remove the sound? Or is there a better way to do this?
     
  2. Assist Best way would be by using protocolLib.
     
  3. Offline

    stirante

    https://forums.bukkit.org/threads/lib-particleeffect.154406/
     
  4. Offline

    darkletsplay

    tilecrack_iceid

    Send a World Particle Effect packet with that.

    Also, would you mind to share your getSphere() method?
     
  5. darkletsplay stirante CaptainBern
    I went with fireworks instead ;)

    Code:
    public List<Location> getSphere(Location loc, Integer r, Integer h, Boolean hollow, Boolean sphere, int plus_y) {
            List<Location> circleblocks = new ArrayList<Location>();
            int cx = loc.getBlockX();
            int cy = loc.getBlockY();
            int cz = loc.getBlockZ();
            for (int x = cx - r; x <= cx + r; x++) {
                for (int z = cz - r; z <= cz + r; z++) {
                    for (int y = (sphere ? cy - r : cy); y < (sphere ? cy + r : cy + h); y++) {
                        double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0);
                        if (dist < r * r && !(hollow && dist < (r - 1) * (r - 1))) {
                            Location l = new Location(loc.getWorld(), x, y + plus_y, z);
                            circleblocks.add(l);
                        }
                    }
                }
            }
     
            return circleblocks;
        }
    credit to chasechocolate , really nice method :)
     
  6. Assist Fancy nested loops you got there :p
     
Thread Status:
Not open for further replies.

Share This Page