How to create the swirly particle potion effect

Discussion in 'Resources' started by nisovin, Jan 22, 2012.

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

    dillyg10

    Ohh, so if i ref cbukkit.jar it will be there?
     
  2. Offline

    iPhysX

    dillyg10 the craftbukkit jar should let you do it fine.
     
  3. Offline

    dillyg10

    Thanks, works now. I just have one question about the code, what is up with the duration part of it? It's a delayed task that is being called, but it is being delayed for the duration?
     
  4. Offline

    iPhysX

  5. Offline

    dillyg10

    Can somone please rewrite the example so that everyonone can see the effets?
     
    iPhysX likes this.
  6. Offline

    thehutch

    Everyone can see it, just copy/paste nisovin's code, import classes then fill in the arguments when you need to, otherwise everything works fine :D
     
  7. Offline

    gsand

    any plugins that have this capability?
     
  8. Offline

    nisovin

    TheDirtyDan Bukkit will only ever call the onCommand method, not onCommand1 or onCommand2.
     
  9. Offline

    Deleted user

  10. Offline

    nisovin

    TheDirtyDan You're struggling with things that aren't related to this thread. I recommend creating a thread in Plugin Development and ask your questions there.
     
  11. Offline

    Waffletastic

    What numbers are what colors though?
     
  12. Offline

    nisovin

    It's standard hex colors.
     
  13. Offline

    Neodork

    nisovin

    I'm using this code example:

    Code:java
    1.  
    2. public void addPotionGraphicalEffect(LivingEntity entity, int color, int duration) {
    3. final EntityLiving el = ((CraftLivingEntity)entity).getHandle();
    4. final DataWatcher dw = el.getDataWatcher();
    5. dw.watch(8, Integer.valueOf(color));
    6.  
    7. Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    8. public void run() {
    9. int c = 0;
    10. if (!el.effects.isEmpty()) {
    11. c = net.minecraft.server.PotionBrewer.a(el.effects.values());
    12. }
    13. dw.watch(8, Integer.valueOf(c));
    14. }
    15. }, duration);
    16. }
    17.  



    And I'm using this to run it:

    Code:java
    1.  
    2. plugin.effect.addPotionGraphicalEffect(player, 0x00002A, 1);
    3. plugin.effect.addPotionGraphicalEffect(player, 0x2A0000, 1);
    4.  


    I notice no difference in the situation before adding the code, no particle effect I guess. There are no error messages thrown, what am I doing wrong?
     
  14. Offline

    nisovin

    It's going to be hard to see it with a duration of 1 tick.
     
    glen3b, Neodork and Sir Savary like this.
  15. Offline

    Neodork

    lol ticks... Right totally forgot that. Thanks man!
     
  16. Offline

    roflcopter399

    So how do you put the
    Code:
    playPotionEffect(player, entity, 0x0000FF, 40);
    in to like say a command? Do you do something like
    Code:
    LivingEntity entity = (LivingEntity) sender?
     
  17. Offline

    Bradley Hilton

    Is the best way to clear this effect from someone just to clear their potion effects?

    -edit-
    Okay, seems I may have a problem? If I apply this to a player and he dies, the swirly effects go away for him but are still being displayed for others. What's the best way to clear this?
     
  18. Offline

    MCForger

    Yes how would you apply this to a player?
     
  19. Offline

    VoidWhisperer

    MCforger - get the player entity and convert it to a living entity...
     
  20. Offline

    Alex3543


    They dont work for me, I get kicked out every time i use the command
     
Thread Status:
Not open for further replies.

Share This Page