I've looked around a bit and found a few other threads about particle effects and such, but none are helping me solve this issue. I want to place a particle effect above a player while he has a specific item in his inventory. I want the particle to be the item. I can easily create the particle effects, but getting it above the player, and showing the actual item he's carrying.... that's where I'm stumped. Any help?
You could spawn the player's item in hand, set it's velocity so it shoots up about 3 blocks, and then de-spawn it (this will happen multiple times per second). If you want to see what I am talking about, join the McCTF Minecraft servers (mcctf.com) and find someone with the flag.
Yeah, that's what I'm talking about. After going back and looking at what they had again, I realized I had remember the effects wrong. Do you how to do it? I just need a nudge in the right direction.
Check out this thread. It is basically asking what you are talking about. http://forums.bukkit.org/threads/ctf-effects.101215/
I suggest you set the item as the player's passenger. (The same as the player is the minecarts passenger when he sits in it.) Make sure to prevent players from picking up the item!
Thanks for the link. I'm having some issues with casting and timing the tasks. If you can help, I'll post some of what I have and see what I'm doing wrong.
Code:java /** The ID**/private UUID id; /** The command**/if(label.equals("flag")){ if(id == null) { Item i = p.getWorld().dropItem(p.getLocation(), new ItemStack(Material.DIAMOND_SWORD, 1)); id = i.getUniqueId(); p.setPassenger(i); } else { p.getPassenger().remove(); id = null; }} /** The events**/ @EventHandlerpublic void onPickup(PlayerPickupItemEvent event){ UUID tid = event.getItem().getUniqueId(); if(tid.equals(id)) { event.setCancelled(true); }} @EventHandlerpublic void onItemDespawn(ItemDespawnEvent event){ UUID tid = event.getEntity().getUniqueId(); if(tid.equals(id)) { event.setCancelled(true); }} Problem solved ;D. The effect: Spoiler (Move your mouse to the spoiler area to reveal the content) Show Spoiler Hide Spoiler
+rep to you! Do you have a recommendation on how to test when the player scores, and when to make the item despawn?
Well, I want the players to break the wool block (flag) in order to take it. Then they get the flag over their head when they make their way back to their base.
on the BlockBreakEvent you set the Item as hovering like I did. You cancel the event, set the block to air, and then use: Code:java Item i = p.getWorld().dropItem(p.getLocation(), new ItemStack(Material.DIAMOND_SWORD, 1));id = i.getUniqueId();p.setPassenger(i);
fireblast709 Sorry to open up an old thread, but would it be possible to make it so the item hovers at a different height?
Live2Pwn if you either override EntityItem from net.minecraft.server or manage everything with a scheduler and events