Get different type of stone with ItemStack.getType

Discussion in 'Plugin Development' started by ouchie, May 5, 2020.

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

    ouchie

    When I open my hopper inventory I want to see the material type from the first slot. While this work I can't get other types of stone.

    If there is a chest in the first slot I see CHEST but when putting Diorite in there I get STONE

    Code:
    Hopper hopper = (Hopper) block.getState();
    Inventory inv = hopper.getInventory();
    inv.getItem(0).getType().toString()
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    ouchie

    @timtower CraftBukkit version git-Spigot-2040c4c-893ad93 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)
     
  4. Offline

    timtower Administrator Administrator Moderator

    @ouchie Did you specify the api-version in your plugin.yml?
    Because there are Material values for DIORITE
     
  5. Offline

    ouchie

    @timtower That was indeed the problem. Adding api version fixed it.

    Thanks
     
    timtower likes this.
Thread Status:
Not open for further replies.

Share This Page