Solved How to check if Bukkit.Material has texture?

Discussion in 'Spigot Plugin Development' started by Xearox, Apr 22, 2017.

  1. Hello there,

    I have a simple question.

    Code (Java):
    for(XItem item : XItem.values()){
       System.out.println(item.getItemName());
       ItemStack is = item.asItemStack();
    }
    XItem = Enum

    The code above prints all items in Minecraft. Like "Green Wool".
    Also it is possible to get the ItemStack like this:

    Code (Java):
    XItem.GREEN_WOOL.asItemStack();
    My problem is now, some items don't have a texture like
    Code (Text):
    [17:16:05 INFO]: WATER
    [17:16:07 INFO]: STATIONARY_WATER
    [17:16:08 INFO]: LAVA
    [17:16:09 INFO]: STATIONARY_LAVA
    They are valid Bukkit.Material types but don't have a texture
    pic1.png

    How do I check, if they have a texture? Is that possible? So I could skip them.


    Thank you for your hints and advices =)
     
  2. maldahleh

    Wiki Team

  3. I've done the some already :D But thank you anyway. I thought there was a way to check if the Material has a texture.

    Code (Java):
    enum SkippedItems{
            AIR,
            WATER,
            STATIONARY_WATER,
            LAVA,
            STATIONARY_LAVA,
            PISTON_EXTENSION,
            DOUBLE_STEP,
            FIRE,
            REDSTONE_WIRE,
            CROPS,
            BURNING_FURNACE,
            SIGN_POST,
            WOODEN_DOOR,
            WALL_SIGN,
            IRON_DOOR_BLOCK,
            GLOWING_REDSTONE_ORE,
            REDSTONE_TORCH_OFF,
            PORTAL,
            CAKE_BLOCK,
            DIODE_BLOCK_OFF,
            DIODE_BLOCK_ON,
            PUMPKIN_STEM,
            MELON_STEM,
            ENDER_PORTAL,
            REDSTONE_LAMP_ON,
            WOOD_DOUBLE_STEP,
            COCOA,
            TRIPWIRE,
            CARROT,
            POTATO,
            SKULL,
            REDSTONE_COMPARATOR_OFF,
            REDSTONE_COMPARATOR_ON,
            STANDING_BANNER,
            WALL_BANNER,
            DAYLIGHT_DETECTOR_INVERTED,
            DOUBLE_STONE_SLAB2,
            SPRUCE_DOOR,
            BIRCH_DOOR,
            JUNGLE_DOOR,
            ACACIA_DOOR,
            DARK_OAK_DOOR,
            PURPUR_DOUBLE_SLAB,
            BEETROOT_BLOCK,
            END_GATEWAY,
            FROSTED_ICE;
        }