How can i get from datatype Block to datatype Crops

Discussion in 'Plugin Development' started by Kamisoyokaze, Oct 15, 2011.

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

    Kamisoyokaze

    On block break i check if the block was "CROPS" then i check if the crops were ripe, to do this i need to get the block from BlockBreakEvent to datatype Crops how can i do this?
    I tried casting it from block to Crops but ofc that didnt work :p
     
  2. Offline

    Kamisoyokaze

    Well i really can't figure it out... :p
    The only way i can see of chekcign whether it is ripe is by it beign in the type Crops and then chekcing its CropState. And i can't see how to get it into the type Crops :/
     
  3. I was trying to explain how to "get it into the type Crops".
    Think like that:
    1. Crops extends MaterialData.
    2. blockState.getData() returns MaterialData
    3. block.getState() returns a BlockState
    4. Together: (Crops)block.getState().getData()
     
  4. Offline

    Kamisoyokaze

    But that doesnt get the CropState does it?

    Oh snap i get it! It's the .getData that i wouldn't have even looked at!
     
  5. Offline

    Kamisoyokaze

    lol i edited it did you not read that, i posted that and 5 seconds later edited it... I was thinknig i was going to get a bunch of numbers out of it not Crop datatype... Thanks for the help but no need to be liek that after ._.
     
  6. related to this, how can you get the Type of crop? How can you check it it's wheat?
     
Thread Status:
Not open for further replies.

Share This Page