Farmable Valuables

Discussion in 'Archived: Plugin Requests' started by Egolfius, Jun 15, 2013.

  1. Offline

    Egolfius

    Plugin category: Unsure

    Suggested name: Unsure (Can't think of anything clever.)

    What I want: I think it would be cool if you could right click on soil with coal, redstone, iron, gold, or diamond and it would place what looks like a melon stem. Over time though it would instead grow into an ore block (depending on what was planted) that could then be mined. Permissions don't seem necessary as you could prevent the item from being used on soil with a plugin like modifyworld. If possible configurable growth times would be cool. I apologize if this isn't possible, it just seemed like an awesome idea. Don't ask, don't receive.

    Ideas for commands: No commands needed for this plugin. <---

    Ideas for permissions: player.canread. Set it to false if they can't read this post.

    When I'd like it by: No Hurry.
     
  2. Offline

    slayr288

    Egolfius
    Do you want the melon stem to grow the ore next to it like a melon would grow? Or do you want the stem to be replaced by the ore? Because if it's the latter, then there would be no point.

    I might be interested in making this quickly.
     
  3. Offline

    Egolfius


    I want the ore to grow as if the melon would :) Thanks for taking an interest in this.
     
  4. Offline

    Egolfius

    slayr288 is no longer interested in developing this.

    Apparently it is not possible to detect when a melon or pumpkin grows with bukkit api, but is anyone interested in giving it a try?
     
  5. Offline

    gorbb


    That is certainly one interesting idea, I'll be willing to give it a go.

    I'll start on Sunday, assuming no-one else beats me to it. :)
     
  6. Offline

    Egolfius

    Thank-you gorbb for taking an interest. Also thank-you slayr288 for trying.
     
  7. Offline

    Jatoc

    Egolfius

    I'll probably start my take on this as well. Sounds really fun.
     
  8. Offline

    Egolfius

    Jatoc gorbb

    Perhaps the following items/blocks could be considered?
    - *Clay - Clay Block
    - *Glowstone - Block
    - *Gunpowder - TnT
    - *Coal - Coal Ore
    - *Lapis - Ore
    - *Quartz - Ore
    - Redstone - Ore
    - Iron - Ore
    - Gold - Ore
    - Diamond - Ore
    - Emerald - Ore
    - *Fully Configurable - The user decides what they put in and what they get out

    Ultimately, as the developer, its your decision what makes it into the plugin, but the * indicates items/blocks that I wouldn't be too sad over losing. I imagine the last suggestion would be even more difficult to setup. Again, just ideas.

    EDIT: wouldn't, not would.
     
  9. Offline

    Jatoc

    Egolfius

    I did a little bit of research and testing, and I can't find a way to make stems visually connect to the blocks to be mined. Is that what you were going for?
     
  10. Offline

    Egolfius


    I expected that, I tried doing it myself with world edit. Don't worry about it, but if it's possible to stop another block from growing from that stem before the block is mined though, that would be great :). Again, thanks.
     
  11. Offline

    Jatoc

    Alright. Started some event listening and code now. Maybe I'll have a working alpha version soon Egolfius
     
  12. Offline

    hawkfalcon

    Here's an idea. Let it grow like a melon, and when it becomes a melon, send a block change event to the client. Might work:eek:
     
  13. Offline

    Skye

    BlockGrowEvent is probably what you're looking for. ;)
     
  14. Offline

    Egolfius

  15. Offline

    hawkfalcon

  16. Offline

    Skye

    It just gives the BlockState of the Block where the plant is going to grow... you'll have to use getRelative() in all directions and check for the MELON_STEM material. It'd be nice if the event provided the information you were looking for without so many checks, but I'm not really sure why it hasn't been programmed to do so.
     
  17. Offline

    Jatoc


    I'm already working on a solution that does so.

    hawkfalcon
    That's exactly what I'm doing, except the blocks are server-sided.


    edit: oh I misunderstood you. I see what you're saying now. How would I go about sending the block change to every player then? (I haven't tested it so I don't even know if it will work)
     
  18. Offline

    hawkfalcon

    Something like
    Code:
    for(Entity e : player.getNearbyEntities(100,100,100)) {
            if(e instanceof Player) {
                    Player player = (Player)e;
            }
    }
     
  19. Offline

    Jatoc


    This would have to be run on a scheduler right? Otherwise every time someone logs in, etc they will see a melon?
     
  20. Offline

    hawkfalcon

    Right ;)
    Edit:
    Code:
        public void repeat() {
            new BukkitRunnable() {
     
                @Override
                public void run() {
                    //dostuff
                }
            }.runTaskTimer(plugin, 0L, 20L);
     
  21. Offline

    Jatoc


    Welp, no point in that :(

    I actually tried the code and it doesn't keep stems attached even when sending the player a blockchange instead of actually changing the block from the server. So I might as well just actually set the block lol..
     
  22. Offline

    hawkfalcon

    Aww ;( well it was worth a try.
     
  23. Offline

    Jatoc

    heh. Yeah. It's fine. It's still pretty cool to have ores grow even if the stems aren't attached.

    Update: I've got a semi-working version done. The plants act just like normal melons, but instead of melons spawning, they have ores spawn instead. You plant them by right clicking farmland with the "seed" (e.g. redstone or iron ingots) and you mine the blocks normally (e.g. with a pickaxe)

    However, because I used metadata for this version, I'll have to work on making my changes persistent. I'll probably have a working alpha release by tomorrow.

    hawkfalcon, sorry bout the random tagging, but do you happen to know any efficient ways to keep metadata persistent? I was considering using hashmaps along with metadata and resetting all metadata every time the plugin loads, but I don't know too much about the efficiency of this... (I want to use block metadata so that any plugin can easily tell whether a stem is custom or natural)

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

    Egolfius

    Awesome, thanks for the update. Good luck with your metadata and what not (no idea what you're talking about :p)
     
  25. Offline

    hawkfalcon

    Are you sure block metadata is not persistant?
     
  26. Offline

    Jatoc


    Yea. I just tested it. Metadata resets on server restart.
     
  27. Offline

    hawkfalcon

    Hmm, I would save the locations to a config, then load on enable.
     
  28. Offline

    Jatoc

    Alright that's what I was thinking . Thanks for the input.
     

Share This Page