Solved Material.MONSTER_EGG HELP!

Discussion in 'Plugin Development' started by luigieai, Apr 20, 2014.

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

    luigieai

    Hey guys, im creating a shop plugin, and i want when a player put /buy coguvaca, the player will receive a mushroom cow egg, but how i can spawn the egg on player inventory with Material.MONSTER_EGG?
    Code:
                    if (cmd.getName().equalsIgnoreCase("buy")){
                        if (args.length == 0){
                            p.sendMessage("Comando para comprar items!");
                        }else{
                            if (args[0].equalsIgnoreCase("coguvaca")){
                                p.getInventory().addItem(new ItemStack((Material.MONSTER_EGG)));
                            }
                        }
                       
                    }
                }
                return true;
     
  2. Offline

    Plo124

    luigieai
    Code:java
    1. ItemStack mooshroomEgg = new ItemStack(Material.MONSTER_EGG);
    2. mooshroomEgg.setDurability((byte) 96);
    3. p.getInventory().addItem(mooshroomEgg);
     
    luigieai likes this.
  3. Offline

    luigieai

    Plo124 So many thanks men, but how i can know all mobs eggs names? can you pass the link in jd.bukkit.org. Because i will create a shop that will give all the mc eggs!
    So many thanks again :D
     
  4. Offline

    Plo124

    luigieai likes this.
  5. Offline

    luigieai

    Plo124 Thank for the tip, so the durability its like the "id" of the egg?
     
  6. Offline

    Plo124

    luigieai
    The damage value of it, so the ID of a mooshroom egg is 373:96
    You have already set the ID of the egg to 373 by defining this as a Monster_Egg
    Then you need to take the :96, and set that to the damage value.

    Mark thread as solved.
     
  7. Offline

    MOMOTHEREAL

    Plo124 PS: The Monster_Egg ID is actually 383 :) #TypoFixing *flies away*
     
  8. Offline

    Plo124

    MOMOTHEREAL
    Oh oops, yeah 373 is a potion I think.
     
Thread Status:
Not open for further replies.

Share This Page