Inactive [EDIT/MECH/WGEN] WorldFeatures v2.0 - Randomly Generate .Schematics [1337]

Discussion in 'Inactive/Unsupported Plugins' started by dkramer, Sep 3, 2011.

  1. Offline

    dkramer

    Here is the Bukkit-Dev link.
    WorldFeatures, A Plugin Inspired by this Reddit post.
    Version: 2.0
    Plugin name by tmcaffeine :D
    (Please donate here if you like what I do. This is my only job.)

    Description:
    You will need WorldEdit.jar in your plugins folder for this to work. Save .schematics to your Created folder in-game or download someone else's .schematics to be generated randomly when new chunks are formed. Each has its own customizable chance to spawn.​
    Permissions:
    • WorldFeatures.commands
    This permission allows the player to use every command. Use this wisely.

    Commands:
    /wf <name>​
    Creates a schematic named <name> of the selected cuboid. A cuboid can be selected by holding seeds or a customized item.​
    /wf copy <name>​
    Copies and pastes this created schematic from your Created folder into the ToUse world folder of the world you are in. Your world will automatically start generating this structure without needing a reset.​
    Download:
    Static link for bukkituptodate: http://dl.dropbox.com/u/36326695/WorldFeatures.jar
    Show Spoiler

    Installation:
    Insert WorldFeatures.jar into your plugins folder.

    Customizing:
    After starting up the server for the first time, a WorldFeatures folder will be made. Inside this will be three things:​
    • The "Created" folder - this is where the schematics you create in-game will go to.
    • The "ToUse" folder - this is where you can place yours or someone else's created schematics. Inside, you will need to create folders that have names of the worlds you want schematics to spawn in. Every .schematic needs a matching .yml. This is explained below.
    • "Settings.yml" This is explained below.
    The Settings.yml has 2 things right now:
    • wandID - number - what should be held when selecting a cuboid for a schematic?
    • chunkchance - number between 1 and 100 - chance is explained below.

    Individual .ymls for schematics
    Show Spoiler

    Each schematic needs its own .yml in the ToUse folder (it should be named <schematicname>.yml). If you are loading a .schematic from elsewhere, copy and paste any .yml and change its name. In each .yml should be these things:
    • min/max - the minimum and maximum height the structure can spawn at if "place" is set to "anywhere"
    • chance - When a chunk is loaded, it checks the chance of the chunk to generate something (by chunkchance in the Settings.yml). If it can, it runs through all the schematics and checks this number for each one. If multiple structures are chosen to generate on one chunk, it will randomly choose one of them to be generated. This means that this "chance" is relative and not an exact amount.
    • maxspawns - the maximum amount of times this .schematic can spawn
    • basement - if you have blocks that should be below-ground, this is the number of vertical blocks you want underground, so if I had a building of 30 blocks high, and I only wanted 10 to be above-ground, I would put '20' as the "basement".
    • biome - can be "none" or any of these values:
      • DESERT
      • EXTREME_HILLS
      • FOREST
      • OCEAN
      • PLAINS
      • RAINFOREST
      • RIVER
      • SAVANNA
      • SEASONAL_FOREST
      • SHRUBLAND
      • SWAMPLAND
      • TAIGA
      • TUNDRA
    • randomrotate - should this schematic randomly rotate? Default is true.
    • place can be set to any of these values:
    1. ground - the schematic will stick to the ground and not spawn over water
    2. anywhere - it can spawn anywhere within the .yml range of min and max
    3. air - it will only spawn in the air
    4. underground - it can only spawn underground
    ToDo:
    • Find bugs
    Changelog:
    2.0:​
    • biome options: see above for details
    • Multiworld support: a different folder with names of the worlds you want schematics to spawn in should be in your ToUse folder now, and the schematics and their .ymls will go in this folder, example: plugins/WorldFeatures/ToUse/WORLD_NAME/
    • rewrote a lot of code for readability and efficiency
    • more information is put in the .yml
    1.82: added the permissions to the plugin.yml​
    1.81: added in the "basement" feature​
    Show Spoiler
    Show Spoiler

    1.8:​
    • can't spawn on leaves
    • adding in rotation screwed up the spawning, but don't worry, I fixed it now!
    • option for limited number of spawns for each schematic
    • more error checks
    • more efficient code
    1.7:​
    • Performance improvements
    • added "underground" to the place list
    • The schematics now randomly rotate when being placed!
    1.6:​
    • Fixed it so that structures cannot spawn if they are too high up
    • Removed the accidental debugging code that spammed the output *oops*
    • added "air" to the place list - if a schematic's appropriate .yml is set to this, it will only spawn in the air
    1.5:​
    • .schematic files are now fully supported and are the only means of saving and loading structures
    • the file system is different. Read above for information^
    • it performs a lot better now
    1.1:​
    • Loading a schematic not from RAM is now a lot faster.
    • Schematics set to "ground" can no longer spawn over water
    1.05: Fixed an error where a chunk decided not to generate a structure and throw an exception
    1.0: Release


    Supports .schematics now!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  2. Offline

    Gicon

    get down.. definitely checking this out...
     
  3. Offline

    dkramer

    Sweet deal!
    I should have a video up in a day or two that explains things.
     
  4. Offline

    Gicon

    oh I get it.... been dreaming up how to do this for a while now.

    now it's... oh my.. SOOO many schematics to choose from...

    question though.. are there any size limitations of schematics? is it limited to 1 chunk? or can schematics span several chunks?
     
  5. Offline

    Specops343

    @dkramer Holy crap this is awesome. So basically, if I throw a ton of town schematics in to that folder, when I generate a new map/new chunks, towns will appear around my server?

    Also, another concern: If things take more than one chunk, will it generate just that chunks's worth of the building or will it generate all of the necessary chunks?
     
  6. Offline

    dkramer

    The limitation is 200,000 blocks per schematic, but I'll probably eventually put in a configurable number since this is a janky number to begin with.
    Schematics are not limited to one chunk: if it spans into another chunk not loaded, it'll load it and place in the appropriate blocks.
     
  7. Offline

    gameswereus

    Is it possible that it the schematics would spawn on top of oceans and the like?
     
  8. Offline

    dkramer

    Yes, you can throw any number of schematics in (but make sure you also have a .yml for each one).

    On the city idea, I am thinking about how to make high-density places, then lower density other places (like individual cities), but idk if that will be implemented any time soon.

    Like I said to Gicon, Schematics are not limited to one chunk: if it spans into another chunk not loaded, it'll load it and place in the appropriate blocks.

    These are the different options for spawning of individual schematics as of 1.5 (I plan to add several more):
    • "anywhere" - can simply spawn anywhere
    • "ground" - it snaps to the ground and cannot spawn on water

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  9. Offline

    gameswereus

    Sorry to pry on the same subject, but how about hills? :p
     
  10. Offline

    dkramer

    It takes a random place and lowers the spawn height until the 4 bottom corners are touching something, then spawns it there, so the schematics can partially spawn in a hill/mountain.
     
    tmcaffeine likes this.
  11. When I complete the recode I request that you add .rsf files :D
    They save in similar ways to schematics.

    EDIT : In fact you would be able to use the API to spawn them.
     
  12. Offline

    dkramer

    If you give me some code example, I'll gladly see if I can.
     
  13. Offline

    dkramer

  14. I gave you the wrong link ,my bad ;)
    I'd just like you to add support for .rsf files (Region Share File). All you'd have to do is check if they're using regios and then you can just call the API to load the region when I have completed the plugin.
     
  15. Offline

    Gicon

    @dkramer yeah, i figured it.. haven't stopped playing with it (and volcanos) long enough to come back adn respond.. thanks!

    @Adamki11s what are the benefits of rsf over schematic?
     
  16. Offline

    dkramer

    Sweet!
    Side note: I have "place: air" coded and will test soon.

    Oh ok, if it is easy enough, I'll be sure to implement it.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  17. A few things; they save in a similar way, they are no benefits of either as they both are more or less the same and supporting .rsf will make your plugin appeal to a larger variety of users.
     
  18. Offline

    Gicon

    is there really a larger amount of people using regios as opposed to worldedit, mcedit, and a handful of other plugins that all use schematics?
     
  19. I don't know, I'm not saying anything like that but all you have to do is a few simple API calls ;)
     
  20. Offline

    Zarius

    Looks great :)

    Three more options on where they spawn: biomes, height (eg. "deep dungeon" only below height 20 or "air-temple" only above height 100), and regions.

    Another trickier option could be determining the surrounding environment (a little like mAtmos does) and allowing conditions such as plains, mountains, forest, ocean, etc.
     
  21. Offline

    dkramer

    Thanks!

    The "anywhere" place has a limiter option (min/max in the settings), but I do agree that more options would be great.

    I shall look into environment spawning.

    A video is up! I plan on making more videos showing the different ways you can use this.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  22. Offline

    rushone2009

    Sexy.......
     
  23. Offline

    dkramer

    Thanks! I have 1.8 coded, but there seems to be odd placement bugs with it. Some things to look forward to so far though:
    • fixed a rotation and placement issue
    • now there's an option for a limited number of spawns for each schematic
    • loadToRAM function
    • more error checks
    • more efficient code
     
  24. Offline

    rushone2009

    How long have you been coding? (I started Java this spring, haven't done shit yet)
     
  25. It takes time ;)
     
  26. Offline

    dkramer

    I started java last school year with a Computer Science AP course at my high school, but I started coding Minecraft plugins some time during the summer as a hobby.
     
  27. Offline

    rushone2009

    Done with my first program :)

    Code:
    
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    
    void main()
    {
        //First Stock
    
        char stockOne[10];
        char stockCompare[10] = "Clippers";
        int numberShares;
        float priceShare;
        float currentPrice;
        float yearlyFees;
    
        fflush(stdin);
        printf("Hello!\n");
        printf("Please enter the first stock's name\n");
    
        //This is just a joke
        gets(stockOne);
        if(strncmp (stockOne,stockCompare,10) == 0)
        {
            printf("\tClippers suck");
            printf("\n");
        }
    
        printf("Please enter the Number of Shares for this stock\n");
        scanf("%d", &numberShares);
    
        printf("Please enter the Buying Price Per Share\n");
        scanf("%f", &priceShare);
    
        printf("Please enter the Current Price Per Share\n");
        scanf("%f", &currentPrice);
    
        printf("Please enter the Yearly Fees\n");
        scanf("%f", &yearlyFees);
    
        float  intCost, currentCost, Profit;
        intCost = (float) numberShares * priceShare;
        currentCost = (float) numberShares * currentPrice;
        Profit = currentCost - intCost - yearlyFees;
    
        printf("Your stock name is %s\n", stockOne);
        printf("\tYour Initial cost is $%0.2f\n", intCost);
        printf("\t\tYour Current cost is $%0.2f\n", currentCost);
        printf("\t\t\tAnd your Profit is $%0.2f\n", Profit);
        printf("\n");
        printf("Good job! ");
    
        //Second Stock
    
        char stockTwo[10];
        char stockCompare2[10] = "Clippers";
        int numberShares2;
        float priceShare2;
        float currentPrice2;
        float yearlyFees2;
    
        fflush(stdin);
        printf("Please enter the second stock's name\n");
    
        //This is just a joke
        gets(stockTwo);
        if(strncmp (stockTwo,stockCompare2,10) == 0)
        {
            printf("\tClippers suck\n");
            printf("\n");
        }
    
        printf("Please enter the Number of Shares for this stock\n");
        scanf("%d", &numberShares2);
    
        printf("Please enter the Buying Price Per Share\n");
        scanf("%f", &priceShare2);
    
        printf("Please enter the Current Price Per Share\n");
        scanf("%f", &currentPrice2);
    
        printf("Please enter the Yearly Fees\n");
        scanf("%f", &yearlyFees2);
    
        float  intCost2, currentCost2, Profit2;
        intCost2 = (float) numberShares2 * priceShare2;
        currentCost2 = (float) numberShares2 * currentPrice2;
        Profit2 = currentCost2 - intCost2 - yearlyFees2;
    
        printf("Your stock name is %s\n", stockTwo);
        printf("\tYour Initial cost is $%0.2f\n", intCost2);
        printf("\t\tYour Current cost is $%0.2f\n", currentCost2);
        printf("\t\t\tAnd your Profit is $%0.2f\n", Profit2);
        printf("\n");
        printf("Good job! ");
    
        //Third Stock
    
        char stockThree[10];
        char stockCompare3[10] = "Clippers";
        int numberShares3;
        float priceShare3;
        float currentPrice3;
        float yearlyFees3;
    
        fflush(stdin);
        printf("Please enter the third stock's name\n");
    
        //This is just a joke
        gets(stockThree);
        if(strncmp (stockThree,stockCompare3,10) == 0)
        {
            printf("\tClippers suck\n");
            printf("\n");
        }
    
        printf("Please enter the Number of Shares for this stock\n");
        scanf("%d", &numberShares3);
    
        printf("Please enter the Buying Price Per Share\n");
        scanf("%f", &priceShare3);
    
        printf("Please enter the Current Price Per Share\n");
        scanf("%f", &currentPrice3);
    
        printf("Please enter the Yearly Fees\n");
        scanf("%f", &yearlyFees3);
    
        float  intCost3, currentCost3, Profit3;
        intCost3 = (float) numberShares3 * priceShare3;
        currentCost3 = (float) numberShares3 * currentPrice3;
        Profit3 = currentCost3 - intCost3 - yearlyFees3;
    
        printf("Your stock name is %s\n", stockThree);
        printf("\tYour Initial cost is $%0.2f\n", intCost3);
        printf("\t\tYour Current cost is $%0.2f\n", currentCost3);
        printf("\t\t\tAnd your Profit is $%0.2f\n", Profit3);
        printf("\n");
        printf("Good job! ");
    
        //Four Stock
    
        char stockFour[10];
        char stockCompare4[10] = "Clippers";
        int numberShares4;
        float priceShare4;
        float currentPrice4;
        float yearlyFees4;
    
        fflush(stdin);
        printf("Please enter the fourth stock's name\n");
    
        //This is just a joke
        gets(stockFour);
        if(strncmp (stockFour,stockCompare4,10) == 0)
        {
            printf("\tClippers suck\n");
            printf("\n");
        }
    
        printf("Please enter the Number of Shares for this stock\n");
        scanf("%d", &numberShares4);
    
        printf("Please enter the Buying Price Per Share\n");
        scanf("%f", &priceShare4);
    
        printf("Please enter the Current Price Per Share\n");
        scanf("%f", &currentPrice4);
    
        printf("Please enter the Yearly Fees\n");
        scanf("%f", &yearlyFees4);
    
        float  intCost4, currentCost4, Profit4;
        intCost4 = (float) numberShares4 * priceShare4;
        currentCost4 = (float) numberShares4 * currentPrice4;
        Profit4 = currentCost4 - intCost4 - yearlyFees4;
    
        printf("Your stock name is %s\n", stockFour);
        printf("\tYour Initial cost is $%0.2f\n", intCost4);
        printf("\t\tYour Current cost is $%0.2f\n", currentCost4);
        printf("\t\t\tAnd your Profit is $%0.2f\n", Profit4);
        printf("\n");
        printf("Good job! ");
    
        //Fifth Stock
    
        char stockFive[10];
        char stockCompare5[10] = "Clippers";
        int numberShares5;
        float priceShare5;
        float currentPrice5;
        float yearlyFees5;
    
        fflush(stdin);
        printf("Please enter the fifth stock's name\n");
    
        //This is just a joke
        gets(stockFive);
        if(strncmp (stockFive,stockCompare5,10) == 0)
        {
            printf("\tClippers suck\n");
            printf("\n");
        }
    
        printf("Please enter the Number of Shares for this stock\n");
        scanf("%d", &numberShares5);
    
        printf("Please enter the Buying Price Per Share\n");
        scanf("%f", &priceShare5);
    
        printf("Please enter the Current Price Per Share\n");
        scanf("%f", &currentPrice5);
    
        printf("Please enter the Yearly Fees\n");
        scanf("%f", &yearlyFees5);
    
        float  intCost5, currentCost5, Profit5;
        intCost5 = (float) numberShares5 * priceShare5;
        currentCost5 = (float) numberShares5 * currentPrice5;
        Profit5 = currentCost5 - intCost5 - yearlyFees5;
    
        printf("Your stock name is %s\n", stockFive);
        printf("\tYour Initial cost is $%0.2f\n", intCost5);
        printf("\t\tYour Current cost is $%0.2f\n", currentCost5);
        printf("\t\t\tAnd your Profit is $%0.2f\n", Profit5);
    
        printf("\n");
        printf("Good job! ");
        printf("\n");
    
        float totalProfit;
        totalProfit = Profit + Profit2 + Profit3 + Profit4 + Profit5;
    
        printf("Your total profit is $0.2%f\n", totalProfit);
    
        printf("Have a nice day!\n");
    
        system("PAUSE");
    }
    
    /***************************************************
    Output
    
    Hello!
    Please enter the first stock's name
    Clippers
            Clippers suck
    Please enter the Number of Shares for this stock
    150
    Please enter the Buying Price Per Share
    1.33
    Please enter the Current Price Per Share
    3.33
    Please enter the Yearly Fees
    5.00
    Your stock name is Clippers
            Your Initial cost is $199.50
                    Your Current cost is $499.50
                            And your Profit is $295.00
    
    Good job! Please enter the second stock's name
    Spurs
    Please enter the Number of Shares for this stock
    215
    Please enter the Buying Price Per Share
    15.77
    Please enter the Current Price Per Share
    14.25
    Please enter the Yearly Fees
    3.50
    Your stock name is Spurs
            Your Initial cost is $3390.55
                    Your Current cost is $3063.75
                            And your Profit is $-330.30
    
    Good job! Please enter the third stock's name
    Lakers
    Please enter the Number of Shares for this stock
    355
    Please enter the Buying Price Per Share
    25.55
    Please enter the Current Price Per Share
    35.75
    Please enter the Yearly Fees
    12.25
    Your stock name is Lakers
            Your Initial cost is $9070.25
                    Your Current cost is $12691.25
                            And your Profit is $3608.75
    
    Good job! Please enter the fourth stock's name
    Celtics
    Please enter the Number of Shares for this stock
    75
    Please enter the Buying Price Per Share
    12.34
    Please enter the Current Price Per Share
    12.34
    Please enter the Yearly Fees
    6.00
    Your stock name is Celtics
            Your Initial cost is $925.50
                    Your Current cost is $925.50
                            And your Profit is $-6.00
    
    Good job! Please enter the fifth stock's name
    Suns
    Please enter the Number of Shares for this stock
    50
    Please enter the Buying Price Per Share
    12.36
    Please enter the Current Price Per Share
    10.86
    Please enter the Yearly Fees
    1.50
    Your stock name is Suns
            Your Initial cost is $618.00
                    Your Current cost is $543.00
                            And your Profit is $-76.50
    
    Good job!
    Your total profit is $3490.94
    Have a nice day!
    Press any key to continue . . .
    ***************************************************/
    I just started this semester in college (Sophomore) due to unavailabilty of classes. I'm doing C, Java and Database Management

    That program is in C btw

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  28. Offline

    dkramer

    Awesome stuff. Yeah, this plugin is mainly block manipulation, so the hardest part was thinking about how to do it and finding out how to support .schematics.
     
  29. Offline

    dkramer

    1.8 and 1.81 out!
    It took me a while because I could not figure out how to fix the placement issue for the longest time.
    Sadly, loadToRAM flubbed things up, so maybe it'll be in a patch down the road.
     

Share This Page