Solved Complete Material List

Discussion in 'Spigot Plugin Development' started by ComputerPassword, Jan 14, 2019.

Thread Status:
Not open for further replies.
  1. Hello Spigot community,

    I am trying to code a plugin where there is a certain value to each block. I am check when the plugin is enabled, if my custom .yml file (emcValues.yml) exists. If not, then it creates the file, and then iterates through EVERY material value from the method "Material.values()." However (I am using System.println() to test the list), there isn't the completed list from the console.

    [19:13:27 INFO]: AIR
    [19:13:27 INFO]: STONE
    [19:13:27 INFO]: GRASS
    [19:13:27 INFO]: DIRT
    [19:13:27 INFO]: COBBLESTONE
    [19:13:27 INFO]: DIAMOND_BOOTS
    [19:13:27 INFO]: GOLD_HELMET
    [19:13:27 INFO]: GOLD_CHESTPLATE
    [19:13:27 INFO]: GOLD_LEGGINGS
    [19:13:27 INFO]: GOLD_BOOTS
    [19:13:27 INFO]: FLINT
    [19:13:27 INFO]: PORK
    [19:13:27 INFO]: GRILLED_PORK
    [19:13:27 INFO]: PAINTING
    [19:13:27 INFO]: GOLDEN_APPLE
    [19:13:27 INFO]: SIGN
    [19:13:27 INFO]: WOOD_DOOR
    [19:13:27 INFO]: BUCKET
    [19:13:27 INFO]: WATER_BUCKET
    [19:13:27 INFO]: LAVA_BUCKET
    [19:13:27 INFO]: MINECART
    [19:13:27 INFO]: SADDLE
    [19:13:27 INFO]: IRON_DOOR
    [19:13:27 INFO]: REDSTONE
    [19:13:27 INFO]: SNOW_BALL
    [19:13:27 INFO]: BOAT
    [19:13:27 INFO]: LEATHER
    [19:13:27 INFO]: MILK_BUCKET
    [19:13:27 INFO]: CLAY_BRICK
    [19:13:27 INFO]: CLAY_BALL
    [19:13:27 INFO]: SUGAR_CANE
    [19:13:27 INFO]: PAPER
    [19:13:27 INFO]: BOOK
    [19:13:27 INFO]: SLIME_BALL
    [19:13:27 INFO]: STORAGE_MINECART
    [19:13:27 INFO]: POWERED_MINECART
    [19:13:27 INFO]: EGG
    [19:13:27 INFO]: COMPASS
    [19:13:27 INFO]: FISHING_ROD
    [19:13:27 INFO]: WATCH
    [19:13:27 INFO]: GLOWSTONE_DUST
    [19:13:27 INFO]: RAW_FISH
    [19:13:27 INFO]: COOKED_FISH
    [19:13:27 INFO]: INK_SACK
    [19:13:27 INFO]: BONE
    [19:13:27 INFO]: SUGAR
    [19:13:27 INFO]: CAKE
    [19:13:27 INFO]: BED
    [19:13:27 INFO]: DIODE
    [19:13:27 INFO]: COOKIE
    [19:13:27 INFO]: MAP
    [19:13:27 INFO]: SHEARS
    [19:13:27 INFO]: MELON
    [19:13:27 INFO]: PUMPKIN_SEEDS
    [19:13:27 INFO]: MELON_SEEDS
    [19:13:27 INFO]: RAW_BEEF
    [19:13:27 INFO]: COOKED_BEEF
    [19:13:27 INFO]: RAW_CHICKEN
    [19:13:27 INFO]: COOKED_CHICKEN
    [19:13:27 INFO]: ROTTEN_FLESH
    [19:13:27 INFO]: ENDER_PEARL
    [19:13:27 INFO]: BLAZE_ROD
    [19:13:27 INFO]: GHAST_TEAR
    [19:13:27 INFO]: GOLD_NUGGET
    [19:13:27 INFO]: NETHER_STALK
    [19:13:27 INFO]: POTION
    [19:13:27 INFO]: GLASS_BOTTLE
    [19:13:27 INFO]: SPIDER_EYE
    [19:13:27 INFO]: FERMENTED_SPIDER_EYE
    [19:13:27 INFO]: BLAZE_POWDER
    [19:13:27 INFO]: MAGMA_CREAM
    [19:13:27 INFO]: BREWING_STAND_ITEM
    [19:13:27 INFO]: CAULDRON_ITEM
    [19:13:27 INFO]: EYE_OF_ENDER
    [19:13:27 INFO]: SPECKLED_MELON
    [19:13:27 INFO]: MONSTER_EGG
    [19:13:27 INFO]: EXP_BOTTLE
    [19:13:27 INFO]: FIREBALL
    [19:13:27 INFO]: BOOK_AND_QUILL
    [19:13:27 INFO]: WRITTEN_BOOK
    [19:13:27 INFO]: EMERALD
    [19:13:27 INFO]: ITEM_FRAME
    [19:13:27 INFO]: FLOWER_POT_ITEM
    [19:13:27 INFO]: CARROT_ITEM
    [19:13:27 INFO]: POTATO_ITEM
    [19:13:27 INFO]: BAKED_POTATO
    [19:13:27 INFO]: POISONOUS_POTATO
    [19:13:27 INFO]: EMPTY_MAP
    [19:13:27 INFO]: GOLDEN_CARROT
    [19:13:27 INFO]: SKULL_ITEM
    [19:13:27 INFO]: CARROT_STICK
    [19:13:27 INFO]: NETHER_STAR
    [19:13:27 INFO]: PUMPKIN_PIE
    [19:13:27 INFO]: FIREWORK
    [19:13:27 INFO]: FIREWORK_CHARGE
    [19:13:27 INFO]: ENCHANTED_BOOK
    [19:13:27 INFO]: REDSTONE_COMPARATOR
    [19:13:27 INFO]: NETHER_BRICK_ITEM
    [19:13:27 INFO]: QUARTZ
    [19:13:27 INFO]: EXPLOSIVE_MINECART
    [19:13:27 INFO]: HOPPER_MINECART
    [19:13:27 INFO]: PRISMARINE_SHARD
    [19:13:27 INFO]: PRISMARINE_CRYSTALS
    [19:13:27 INFO]: RABBIT
    [19:13:27 INFO]: COOKED_RABBIT
    [19:13:27 INFO]: RABBIT_STEW
    [19:13:27 INFO]: RABBIT_FOOT
    [19:13:27 INFO]: RABBIT_HIDE
    [19:13:27 INFO]: ARMOR_STAND
    [19:13:27 INFO]: IRON_BARDING
    [19:13:27 INFO]: GOLD_BARDING
    [19:13:27 INFO]: DIAMOND_BARDING
    [19:13:27 INFO]: LEASH
    [19:13:27 INFO]: NAME_TAG
    [19:13:27 INFO]: COMMAND_MINECART
    [19:13:27 INFO]: MUTTON
    [19:13:27 INFO]: COOKED_MUTTON
    [19:13:27 INFO]: BANNER
    [19:13:27 INFO]: SPRUCE_DOOR_ITEM
    [19:13:27 INFO]: BIRCH_DOOR_ITEM
    [19:13:27 INFO]: JUNGLE_DOOR_ITEM
    [19:13:27 INFO]: ACACIA_DOOR_ITEM
    [19:13:27 INFO]: DARK_OAK_DOOR_ITEM
    [19:13:27 INFO]: GOLD_RECORD
    [19:13:27 INFO]: GREEN_RECORD
    [19:13:27 INFO]: RECORD_3
    [19:13:27 INFO]: RECORD_4
    [19:13:27 INFO]: RECORD_5
    [19:13:27 INFO]: RECORD_6
    [19:13:27 INFO]: RECORD_7
    [19:13:27 INFO]: RECORD_8
    [19:13:27 INFO]: RECORD_9
    [19:13:27 INFO]: RECORD_10
    [19:13:27 INFO]: RECORD_11
    [19:13:27 INFO]: RECORD_12

    from the for loop:

    Code (Java):
    for (Material materialType : Material.values()) {
        System.out.println(materialType);
    }
    If you have any ideas, please let me know as soon as possible. I am getting frustrated that not all the materials are being sent to the console.
     
  2. Don't want to do this but, BUMP
     
  3. There's a rate limit on Sysout when printing it into the console (50 to 100 lines max per second, not sure tho). Check on ur log file, its 100% will contains all of the material values that you've printed

    CMIIW
     
    • Agree Agree x 1
  4. Also, for debugging things like this you may find it easier to just use the evaluate function in intellij using the remote run type! Then you'll be able to see the values of any line of code, and all visible variables. Much better solution than having to sift through lines and lines of sys outs.
     
  5. The list also doesn't include all different types of materials, like stone is the original but you have different types of stone.
    dfasfef.png

    As you can see all these items have the same id, but there value is different, the 1.12.2 spigot API will only show Stone, and not all the other options.
     
    • Agree Agree x 1
  6. In
    In 1.13, all types have a material
     
    • Agree Agree x 1
  7. yes i know, but looking at the list I think he is using 1.12.2. I also said that this only counts in the 1.12.2 spigot API
     
    • Agree Agree x 1
  8. @x313 is right, I am using 1.13.2. Is there a way to get all types of one material?
     
  9. because @DrOreo002 was right, there are 385 in the logs, but there is only the normal version of each block. I need all the different types.
     
  10. Have you added the api-version to your plugin config? If not, thats why
     
    • Agree Agree x 1
  11. Wait, what? I have never added an api version to the plugin.yml
     
  12. Well, you will need to add as follow: "api-version: 1.13", and all new materials would be displayed
     
    #12 MrMaurice211, Jan 15, 2019 at 2:05 AM
    Last edited: Jan 15, 2019 at 2:11 AM
  13. I'm still only seeing 385 values from this: System.out.println(Material.values().length); with : api-version: 1.13.2
     
  14. upload_2019-1-14_20-24-57.png
    Just "api-version: 1.13" not "api-version: 1.13.x"
     
  15. Still receiving 385. I assume that this is the number of blocks, but not the different states, like cracked stone, stone, stone bricks, etc. I want all of these blocks.
     
  16. Got the saving to work, just not the amount of items I need and want.
     
  17. There is no "states" on 1.13, can you try to use Material.valueOf("LEGACY_WOOL"); and check if it works? Or if it throws an IAE
     
  18. In 1.13, ALL block states have a material
    Like wool:0 > WHITE_WOOL
     
    • Optimistic Optimistic x 1
  19. I don't see anything wrong and I get 870 in total using '.length' and a loop. (api-version: 1.13)
    Code (Text):

           int count = Material.values().length;
           System.out.println("Materials Total Count = " + count);
           count = 0;
           for (Material materialType : Material.values()) {
               count++;
           }
           System.out.println("Materials Total Count = " + count);
     
     
  20. Why do you use a loop?
     
Thread Status:
Not open for further replies.

Share This Page