Solved BLOCK_DUST particle

Discussion in 'Spigot Plugin Development' started by weedsnorkeler, Jul 9, 2021.

  1. how do i make the block_dust particle be a specific block, like making the dust look like stone or dirt
  2. You can change the dust color, is that the objective?
  3. im trying to have a block break a few seconds after its placed, and when it breaks have it play a sound and have particles of the same texture like explode out it

    i tried this but it doesnt show any particles im not getting an error though
    Code (Java):
    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(KitPVP.getInstance(), new Runnable() {
        public void run() {

            Block placed = event.getBlockPlaced();
            playGlobalSound(placed.getLocation(), Sound.BLOCK_METAL_BREAK, 1, 1);
            event.getPlayer().spawnParticle(Particle.BLOCK_DUST, placed.getLocation(), 5, placed.getBlockData());

    }, (long) (block_time*20));
  4. Are you sure that task is being runned? Try puting a print to the console for debuging.
    For the dust you could make a switch of the block material unless you pretend in using this system in every block type.
  5. the block disappears and the sound plays but no particles show. i could do a switch but im not sure how to make the particles have a blocks texture.
  6. I think for the T data at the end, it needs to be a material, so instead of placed.getBlockData() make it placed.getType(). But that is just how I am reading it from here
    • Like Like x 1
  7. thank you for the link i need BlockData for BLOCK_DUST, but i give it the blocks data and it doesnt show any particles

    this works though
    Code (Java):
    not sure why this works but placed.getBlockData() doesnt but im just gonna try to do a switch statement for each block. i tried doing placed.getType().createBlockData() but that doesnt work either

    EDIT: omg its because i set the block to air and then try to get air particles

    EDIT: this works
    Code (Java):
    Block placed = event.getBlockPlaced();
    #7 weedsnorkeler, Jul 9, 2021
    Last edited: Jul 9, 2021
  8. oh wow thats so much easier thank u
    • Like Like x 1