Util Spawn Eggs Data Values

Discussion in 'Resources' started by oriamrm, Oct 28, 2016.

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

    oriamrm

    So I Was Looking For This For A Long Time In The Internet and haven't Found Any List, So I Checked Myself.
    I listed only the data values for animals (Since all other stuff just isn't useful).

    So Here It Is:
    Creeper: 50
    Skeleton: 51
    Spider: 52
    Zombie: 54
    Slime: 55
    Ghast: 56
    Zombie Pigman: 57
    Enderman: 58
    Cave Spider: 59
    Silverfish: 60
    Blaze: 61
    Magma Cube: 62
    Bat: 65
    Witch: 66
    Endermite: 67
    Guardian: 68
    Shulker: 69
    Pig: 90
    Sheep: 91
    Cow: 92
    Chicken: 93
    Squid: 94
    Wolf: 95
    Mooshroom (Mushroom Cow): 96
    Ocelot: 98
    Horse: 100
    Rabbit: 101
    Villager: 120
    Polar Beer: 102


    If You Find Any Another Data Values or Found A Mistake, Please Replay To This Thread So I'll Add Them :)

    The Only One I Can See Missing Is The Polar Beer, And I Checked In the creative menu and found I have 28/29.
     
    Last edited: Nov 8, 2016
  2. Offline

    Zombie_Striker

    ChipDev likes this.
  3. Offline

    ChipDev

    Lots of threads have already been made on this, it can be taken from PMC / MCWiki etc
     
  4. Offline

    PhantomUnicorns

    Here something someone can actually use without any probs (and way more useful)
    Class:
    Code:
    public class AnimalID {
        public static final int Creeper = 50;
        public static final int Skeleton = 51;
        public static final int Spider = 52;
        public static final int Zombie = 54;
        public static final int Slime = 55;
        public static final int Ghast = 56;
        public static final int Zombie_Pigman = 57;
        public static final int Enderman = 58;
        public static final int Cave_Spider = 59;
        public static final int Silverfish = 60;
        public static final int Blaze = 61;
        public static final int Magma_Cube = 62;
        public static final int Bat = 65;
        public static final int Witch = 66;
        public static final int Endermite = 67;
        public static final int Guardian = 68;
        public static final int Shulker = 69;
        public static final int Pig = 90;
        public static final int Sheep = 91;
        public static final int Cow = 92;
        public static final int Chicken = 93;
        public static final int Squid = 94;
        public static final int Wolf = 95;
        public static final int Mooshroom = 96;
        public static final int Ocelot = 98;
        public static final int Horse = 100;
        public static final int Rabbit = 101;
        public static final int Villager = 120;
    }
    
    Enum:
    Code:
    public enum AnimalID {
        Creeper ("Creeper", 50),
        Skeleton ("Skeleton", 51),
        Spider ("Spider", 52),
        Zombie ("Zombie", 54),
        Slime ("Slime", 55),
        Ghast ("Ghast", 56),
        Zombie_Pigman ("Zombie Pigman", 57),
        Enderman ("Enderman", 58),
        Cave_Spider ("Cave Spider", 59),
        Silverfish ("Silverfish", 60),
        Blaze ("Blaze", 61),
        Magma_Cube ("Magma Cube", 62),
        Bat ("Bat", 65),
        Witch ("Witch", 66),
        Endermite ("Endermite", 67),
        Guardian ("Gaurdian", 68),
        Shulker ("Shulker", 69),
        Pig ("Pig", 90),
        Sheep ("Sheep", 91),
        Cow ("Cow", 92),
        Chicken ("Chicken", 93),
        Squid ("Squid", 94),
        Wolf ("Wolf", 95),
        Mooshroom ("Mooshroom", 96),
        Ocelot ("Ocelot", 98),
        Horse ("Horse", 100),
        Rabbit ("Rabbit", 101),
        Villager ("Villager", 120);
       
        String name;
        int dataType;
       
        AnimalID (String name, int dataType) {
            this.name = name;
            this.dataType = dataType;
        }
       
        @Override
        public String toString() {
            return this.name;
        }
       
        public String getName() {
            return this.name;
        }
       
        public int getDataType() {
            return this.dataType;
        }
       
        public static String getName(AnimalID animal) {
            return animal.name;
        }
       
        public static int getDataType(AnimalID animal) {
            return animal.dataType;
        }
       
        public static boolean equals (AnimalID orginal, AnimalID testing) {
            if (orginal!=null && testing!=null) {
                if (orginal.getName().equals(testing.getName()) && orginal.getDataType()==testing.getDataType()) {
                    return true;
                }
            }
            return false;
        }
    }
    
     
    Last edited: Oct 30, 2016
    ChipDev likes this.
  5. Offline

    I Al Istannen

    @PhantomUnicorns
    That is an enum. Besides the fact that Zombies approach with getTypeId may work as well and is plain bukkit.
     
  6. Offline

    PhantomUnicorns

    Just ignore these stupid comments because there is entitytype...
     
    Last edited: Oct 30, 2016
  7. Offline

    I Al Istannen

    @PhantomUnicorns
    I wasn't clear and you misunderstood me. There is NO, absolutely NO need to make that some public static variables. This the exact use case for an enum.

    The sentence should be "That should be an enum."

    And follow naming conventions and write that names in upper case.
     
    Zombie_Striker and bwfcwalshy like this.
  8. Offline

    PhantomUnicorns

    EntityType :p
     
    Last edited: Oct 30, 2016
  9. Offline

    I Al Istannen

    @PhantomUnicorns
    Please tag me in the future :)

    You are not totally wrong, but certainly not right either. Yes, some static vars may seem a bit easier at the first glance.
    But an enum has some advantages, you should be aware of in order to make an informed decision:
    • Default methods
      • valueOf => name to ID
      • values() => Get all entries, so all entities with their ID
      • ordinal() ==> Get the position of the entry, allows comparison
    • Type safety. You can pass any value that an integer can hold to the method if it takes an int, but you will have a hard time passing an invalid value to a method taking an enum (except null, but yea)
    • Switch statements actually work
    • Less confusion (Huh, what value should I input here? From where should I get it??)
    • Define methods for them later on, if you suddenly have the need. Maybe you want an isMonster or getEntityType method later which returns the Bukkit EntityType
    • Serializable (and not just ordinal, it uses the name :))
    • EnumSet and EnumMap for blazingly fast collections
    • Ability to customize toString (or just output the name). This means in debugging you won't see "Entity not found 56", but "Entity not found SKELETON". Which is easier to read?
    • They are singletons (not helpful here, but an lifesafer if you want to create a singleton class)
    These are the ones that came to my mind and a quick 3 minute google search revealed. If you search a bit more, I am sure you will find additional points.
     
    Zombie_Striker likes this.
  10. Offline

    PhantomUnicorns

    EntityType is already on it :p
     
    Last edited: Oct 30, 2016
  11. Online

    timtower Administrator Administrator Moderator

    @PhantomUnicorns getEntityType()==EntityType.CREEPER
    There are always other options.
     
  12. Offline

    PhantomUnicorns

    Then what's the point of this thread? :p

    EDIT:
    @oriamrm Here is the total list:

    Item: 1
    XPOrb: 2
    LeashKnot: 8
    Painting: 9
    Arrow: 10
    Snowball: 11
    Fireball: 12
    SmallFireball: 13
    ThrownEnderpearl: 14
    EyeOfEnderSignal: 15
    ThrownExpBottle: 17
    Item Frame: 18
    WitherSkull: 19
    PrimedTnt: 20
    FallingSand: 21
    FireworksRocketEntity: 22
    TippedArrow: 23
    SpectralArrow: 24
    ShulkerBullet: 25
    DragonFireball: 26
    ArmorStand: 30
    MinecartCommandBlock: 40
    Boat: 41
    MinecartRideable: 42
    MinecartChest: 43
    MinecartFurnace: 44
    MinecartTNT: 45
    MinecartHopper: 46
    MinecartMobSpawner: 47
    Creeper: 50
    Skeleton: 51
    Spider: 52
    Giant: 53
    Zombie: 54
    Slime: 55
    Ghast: 56
    PigZombie: 57
    Enderman: 58
    CaveSpider: 59
    Silverfish: 60
    Blaze: 61
    LavaSlime: 62
    EnderDragon: 63
    WitherBoss: 64
    Bat: 65
    Witch: 66
    Endermite: 67
    Guardian: 68
    Shulker: 69
    Pig: 90
    Sheep: 91
    Cow: 92
    Chicken: 93
    Squid: 94
    Wolf: 95
    MushroomCow: 96
    SnowMan: 97
    Ozelot: 98
    VillagerGolem: 99
    EntityHorse: 100
    Rabbit: 101
    PolarBear: 102
    Villager: 120
    EnderCrystal: 200

    And while I'm at it here is all the material Id's:
    Air: 0
    Stone: 1
    Grass: 2
    Dirt: 3
    Cobblestone: 4
    Wood: 5
    Sapling: 6
    Bedrock: 7
    Water: 8
    Stationary Water: 9
    Lava: 10
    Stationary Lava: 11
    Sand: 12
    Gravel: 13
    Gold Ore: 14
    Iron Ore: 15
    Coal Ore: 16
    Log: 17
    Leaves: 18
    Iron Helmet: 306
    Iron Chestplate: 307
    Iron Leggings: 308
    Iron Boots: 309
    Diamond Helmet: 310
    Diamond Chestplate: 311
    Diamond Leggings: 312
    Diamond Boots: 313
    Gold Helmet: 314
    Gold Chestplate: 315
    Gold Leggings: 316
    Gold Boots: 317
    Flint: 318
    Pork: 319
    Grilled Pork: 320
    Painting: 321
    Golden Apple: 322
    Sign: 323
    Wood Door: 324
    Bucket: 325
    Water Bucket: 326
    Lava Bucket: 327
    Minecart: 328
    Saddle: 329
    Iron Door: 330
    Redstone: 331
    Snow Ball: 332
    Boat: 333
    Leather: 334
    Milk Bucket: 335
    Clay Brick: 336
    Clay Ball: 337
    Sugar Cane: 338
    Paper: 339
    Book: 340
    Slime Ball: 341
    Storage Minecart: 342
    Powered Minecart: 343
    Egg: 344
    Compass: 345
    Fishing Rod: 346
    Watch: 347
    Glowstone Dust: 348
    Raw Fish: 349
    Cooked Fish: 350
    Ink Sack: 351
    Bone: 352
    Sugar: 353
    Cake: 354
    Bed: 355
    Diode: 356
    Cookie: 357
    Map: 358
    Shears: 359
    Melon: 360
    Pumpkin Seeds: 361
    Melon Seeds: 362
    Raw Beef: 363
    Cooked Beef: 364
    Raw Chicken: 365
    Cooked Chicken: 366
    Rotten Flesh: 367
    Ender Pearl: 368
    Blaze Rod: 369
    Ghast Tear: 370
    Gold Nugget: 371
    Nether Stalk: 372
    Potion: 373
    Glass Bottle: 374
    Spider Eye: 375
    Fermented Spider Eye: 376
    Blaze Powder: 377
    Magma Cream: 378
    Brewing Stand Item: 379
    Cauldron Item: 380
    Eye Of Ender: 381
    Speckled Melon: 382
    Monster Egg: 383
    Exp Bottle: 384
    Fireball: 385
    Book And Quill: 386
    Written Book: 387
    Emerald: 388
    Item Frame: 389
    Flower Pot Item: 390
    Carrot Item: 391
    Potato Item: 392
    Baked Potato: 393
    Poisonous Potato: 394
    Empty Map: 395
    Golden Carrot: 396
    Skull Item: 397
    Carrot Stick: 398
    Nether Star: 399
    Pumpkin Pie: 400
    Firework: 401
    Firework Charge: 402
    Enchanted Book: 403
    Redstone Comparator: 404
    Nether Brick Item: 405
    Quartz: 406
    Explosive Minecart: 407
    Hopper Minecart: 408
    Prismarine Shard: 409
    Prismarine Crystals: 410
    Rabbit: 411
    Cooked Rabbit: 412
    Rabbit Stew: 413
    Rabbit Foot: 414
    Rabbit Hide: 415
    Armor Stand: 416
    Iron Barding: 417
    Gold Barding: 418
    Diamond Barding: 419
    Leash: 420
    Name Tag: 421
    Command Minecart: 422
    Mutton: 423
    Cooked Mutton: 424
    Banner: 425
    End Crystal: 426
    Spruce Door Item: 427
    Birch Door Item: 428
    Jungle Door Item: 429
    Acacia Door Item: 430
    Dark Oak Door Item: 431
    Chorus Fruit: 432
    Chorus Fruit Popped: 433
    Beetroot: 434
    Beetroot Seeds: 435
    Beetroot Soup: 436
    Dragons Breath: 437
    Splash Potion: 438
    Spectral Arrow: 439
    Tipped Arrow: 440
    Lingering Potion: 441
    Shield: 442
    Elytra: 443
    Boat Spruce: 444
    Boat Birch: 445
    Boat Jungle: 446
    Boat Acacia: 447
    Boat Dark Oak: 448
    Gold Record: 2256
    Green Record: 2257
    Record 3: 2258
    Record 4: 2259
    Record 5: 2260
    Record 6: 2261
    Record 7: 2262
    Record 8: 2263
    Record 9: 2264
    Record 10: 2265
    Record 11: 2266
    Record 12: 2267
     
    Last edited: Oct 30, 2016
  13. Online

    timtower Administrator Administrator Moderator

    @PhantomUnicorns I am not sure either.
    I didn't start it.
    I didn't post other ways to do this.
     
  14. Offline

    I Al Istannen

    @PhantomUnicorns
    Use spoilers please.

    You can directly use a variable of type EntityType, you don't need a String for that.
    You do know Material#getID()?

    Besides that I actually took the time to look it up and unsurprisingly @Zombie_Striker was right.
    The return values of EntityType#getTypeID() match with what you listed.

    This means you do not need to do anything, just use the given methods.


    Now that that is hopefully settled:
    @oriamrm The EntityType#getTypeID() is probably nicer
    @PhantomUnicorns You will not need to make your own solution.


    @timtower I wish I knew :p
     
  15. Offline

    PhantomUnicorns

    @I Al Istannen
    Spoilers (what are those)? Also I used Material.getID() and Material.name() for the mats. And I used EntityType.getTypeId() and EntityType.getName() (unsure the method name but something to that effect) to get the entities, I was posting to oriamrm that those are all of both (so this thread could be a little more useful, well double useful :D)
     
Thread Status:
Not open for further replies.

Share This Page