getTypeId() question

Discussion in 'Plugin Development' started by cha0s, Mar 12, 2022.

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

    cha0s

    Hi there,

    I'm in the process of updating a very old plugin of mine. I haven't programmed for a long time and now I have an error and can't get any further.


    for whatever reason i get an error in line 75. Wasn't that how it used to be?

    How should the line be correct?


    upload_2022-3-12_21-46-8.png
     
  2. Offline

    CraftCreeper6

    @cha0s
    What are you trying to do here?

    Also, for newer Minecraft versions, getItemInHand is deprecated since the player can have a main hand and an offhand now.
     
  3. Offline

    cha0s

    @CraftCreeper6
    it should be read back which object the player has in hand. This should be compared to the list of locked items
     
  4. Offline

    CraftCreeper6

    @cha0s
    getTypeId() doesn't exist anymore, that's back in 1.8

    We now use Materials to compare items, so you want to update your block list to include Materials rather than item IDs, and compare it with event#getClickedBlock()#getType()
     
  5. Offline

    cha0s

    Thanks. error is gone.

    How can i update from IDs to Materials? Ingame the plugin only found old items. If i try to use newer items like a
    pig iron block - plugin says: no block names pig iron block

    here is the ID-List

    upload_2022-3-12_23-29-46.png
     
  6. Online

    timtower Administrator Administrator Moderator

    @cha0s isn't pigiron modded only?
     
Thread Status:
Not open for further replies.

Share This Page