Generalized API for crops

Discussion in 'Spigot Plugin Development' started by Crypnotic, Sep 9, 2018.

  1. Even then, there is no method that defines what the product and seeds are for a crop, so I still can't modify them individually without defining them
     
  2. Doesn't really help what I need to do. I need to modify the seeds after, but I can't define them myself
     
  3. I need to know the material yields. I'm calculating everything else myself. I just need to know the Material of the product and the seed
     
  4. What I was saying was that he wants someone to make an API that touches the materials for him, when he can just do it himself. Don't be rude in a thread when your asking for help, gets you less help.
     
  5. No, I was seeing if there was an API is place that would keep me from having to hard code a crop material enum so that it doesn't break every update. I asked if someone had the time and know how to expose the NMS method to the API because I don't have the time at the moment. I can do the enum route, and I have already done it. If you read my replies, which it is obvious you haven't or that you just simply don't comprehend them, I show what I have to do currently, and why I don't like it. I also show the case that would work the best, which I proceeded to follow saying if someone could do it, I would be grateful. So once again, if you don't understand my needs, don't reply pretending like you do. Thanks.
     
  6. I am literally just seeing if anyone has the time to expose the g() and f() NMS methods in BlockCrops to the API. They return the material for the seed and product. I just need to know what Material the block, if it is a crop, produces and what is the seed for it.
     
  7. NathanWolf

    Supporter

    If you are looking for someone to PR some new API, this is the wrong way to go about it. Open a JIRA issue for a new feature making your requests very clear.

    In the meantime, if you know what you want to get at via NMS, just do it. Use reflection, use modules, whatever- make your own API lib.

    I think the only thing clear so far from this thread is that there is no API or external library that does what you want, so you're going to have to write it yourself. Otherwise if you plan on waiting for a Spigot PR, prepare to wait a long time.
     
  8. Senmori

    Senmori Retired Resource Staff
    Retired Patron

    The last few feature requests that JIRA has received were implemented in just a few days, so I don't know where you're getting the 'wait a long time' from.
     
  9. My goal wasn't to get a PR. I literally stated that I was trying to figure out if there was an API in place that I was missing.
     
  10. There isn't, and you did end up asking for it to be PR'd.
     
    • Agree Agree x 1
  11. I may be missing something, but why can't you just check if the MaterialData is an instance of Crops? I only have the 1.13 javadocs, but judging by all the 'LEGACY_' prefixes, it likely exists in 1.12 and earlier too.
    Then you could just do this:
    Code (Java):
    BlockState state = event.getNewState();
    MaterialData rawData = state.getData();
    if (rawData instanceof Crops) {
        Crops crops = (Crops) rawData;
        if (crops.getState() == CropState.RIPE) {
            ...
        }
    }
    Or do you need it to work without having access to a BlockState?
     
  12. NathanWolf

    Supporter

    I wasn't trying to be disrespectful, but I don't think that's always the case. Cool to hear though!
     
  13. I can determine if it is a crop, the problem is getting the seed and product without checking against Material enums
     
  14. I think you're missing the point of what I was asking. I'm not being lazy, I don't have the time to sit there and write that sort of API and test it thoroughly. "If anyone has the time and know-how to PR this for API, I would be very thankful. I just don't have the time"