Solved TreeSpecies from LOG_2

Discussion in 'Plugin Development' started by AnorZaken, Mar 28, 2014.

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


    Getting back to plugin development to update SaplingAssist for the new tree types.

    But... is there still no proper way of grabbing the TreeSpecies from the LOG_2 type blocks?
    (I was told on irc that this was being worked on back in december, which is why I'm hoping I might have missed something?)

    Basically the (relevant part of the) code would look something like this at the moment:

    1. if (isLogMaterial(block.getType()))
    2. {
    3. MaterialData mData = block.getState().getData();
    4. TreeSpecies ts;
    5. if (mData instanceof Tree)
    6. ts = ((Tree)mData).getSpecies();
    7. else //(LOG_2 not using Tree::MaterialData)
    8. ts = mData.getData() == 0 ? TreeSpecies.ACACIA : TreeSpecies.DARK_OAK;
    9. }

    isLogMaterial() simply checks if Material is LOG || LOG_2

    I'm hoping there is some better way? (not overly optimistic)

    I'm going to interpret the lack of replies as there not being a better way and mark it as solved.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 7, 2016
  2. AnorZaken likes this.
  3. Offline


    Thank you!
    Watching it now.

    (I agree with the expected behavior - it would also mean the above code would not break once this gets fixed, which is very nice!)
Thread Status:
Not open for further replies.

Share This Page