Start fireworks?

Discussion in 'Plugin Development' started by Dragon252525, Dec 22, 2012.

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

    Dragon252525

    Three questions

    1. Is there any possibility at the moment to start a firework?
    2. Is there any possibility at the moment to create FireworkEffects/FireworkEffectMetas?
    3. How can I edit NBTTags of items in 1.4.6 (without the new API)?

    for 1.4.5 it worked

    Code:
    ItemStack item = new ItemStack(401);
    CraftItemStack craftStack = null;
    if (item instanceof CraftItemStack) {
        craftStack = (CraftItemStack) item;
        itemStack = craftStack.getHandle(); //the method getHandle() is undefined for the type CraftItemStack
    }
    else if (item instanceof ItemStack) {
        craftStack = new CraftItemStack(item); //the constructor of CraftItemStack(ItemStack) is not visible
        itemStack = craftStack.getHandle(); //the method getHandle() is undefined for the type CraftItemStack
    }
    imports:
    import net.minecraft.server.v1_4_6.NBTTagCompound;
    import net.minecraft.server.v1_4_6.NBTTagList;
    import org.bukkit.craftbukkit.v1_4_6.inventory.CraftItemStack;
    import org.bukkit.inventory.ItemStack;

    maybe I have to wait for a newer build?
     
  2. Offline

    ceoepts

    I would recommend waiting for a new build and see if they'll do i nifty way of setting off fireworks.
    But you can still do it. (Dont know how :( )
     
  3. Offline

    ftbastler

    PHP:
    Player p = (Playersender;
    ItemStack i = new ItemStack(Material.FIREWORK64);
                    
    FireworkMeta fm = (FireworkMetai.getItemMeta();
                    List<
    Color= new ArrayList<Color>();
                        
    c.add(Color.BLUE);
                        
    c.add(Color.LIME);
                    
    FireworkEffect e FireworkEffect.builder().flicker(true).withColor(c).withFade(c).with(Type.BALL_LARGE).trail(true).build();
                    
    fm.addEffect(e);
                    
    fm.setPower(3);
                    
    i.setItemMeta(fm);
                    
    p.getInventory().addItem(i);
    This is code gives a player 64 custom rockets. Works good.
    I also tried to .spawnEntity(loc, EntityType.Firework); but that didnt work.

    Using the latest beta build.
     
    Minken likes this.
  4. Offline

    fireblast709

    Firework spawning has not yet been implemented in Craftbukkit
     
  5. Offline

    hice3000

  6. Offline

    Dragon252525

Thread Status:
Not open for further replies.

Share This Page