Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • New Scattered Features
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
Draco18s

New Scattered Features

By Draco18s, October 4, 2013 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16012 posts
Posted October 4, 2013

Anyone have any experience with this?

 

I would like to add to world generation additional structures that are on the same level as pyramids and temples.  Other than having to build the code for the structure itself, what do I need to do to get this to happen in the cleanest way possible?

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted October 4, 2013

Avoding the bunch of .setBlock's and instead use schematics for the structures is probably the best tip I could give you.

Tehbeards has a good API for loading schematics called LibSchematic [Link: https://github.com/tehbeard/LibSchematic], also check out his example of use in the LibSchematic.Sh which is also on github.

 

I believe you can do the generation just like you would for any other world gen, like trees and ores.

Check if it's the biome types you want, then do a simple check to see that it's ground and not air under the location of it's corner locations and place it.

  • Quote

If you guys dont get it.. then well ya.. try harder...

Share this post


Link to post
Share on other sites

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16012 posts
Posted October 4, 2013

ScatteredFeatures has code to insuring that they don't generate in neighboring chunks (cursory glance indicates minimum distance of 8 chunks, maximum 32 chunks).  Which implies that that code has some method of determining where other instances of it are.

 

That isn't going to be something I can replicate with an IWorldProvider.

 

Avoding the bunch of .setBlock's and instead use schematics for the structures is probably the best tip I could give you.

 

I was going to be designing via schematic anyway.  Then use a schematic -> Java converter I'd found (it was last updated for 1.3.2, but that is still sufficient to use replacement blocks, ie. "iron ore is my blockA, coal ore is my blockB...." so I could go in and replace blockID references)

I was unaware that there was a direct schematic loading API.  Neat.

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted October 4, 2013

The code from the java converters becomes rather messy, also they may hit the line limit for massive structures lol ^^

 

Aha I have no idea on how to easily implement ScatteredFeatures, my initial thoughts with saving the chunk coords in a list and checking against that is probably not the cleanest way to do that.

  • Quote

If you guys dont get it.. then well ya.. try harder...

Share this post


Link to post
Share on other sites

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16012 posts
Posted October 4, 2013

The code from the java converters becomes rather messy, also they may hit the line limit for massive structures lol ^^

 

I'm not making a massive structure.  The one converter I was looking at has a limit of...1500 blocks in a single segment.  Waaay more than I need. :)

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

vdvman1    12

vdvman1

vdvman1    12

  • Stone Miner
  • vdvman1
  • Members
  • 12
  • 72 posts
Posted October 4, 2013

You could have a look at how the eye of ender finds the stronghold to find the nearby structures

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16012 posts
Posted October 4, 2013

You could have a look at how the eye of ender finds the stronghold to find the nearby structures

 

The stronghold generator holds references to the three it creates and there's a special magical function in the IChunkProvider that allows retrieving that info.  Not really valid for a structure that isn't limited, nor does it work for arbitrary structures:

 

public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5)
    {
        return "Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(par1World, par3, par4, par5) : null;
    }

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

coolAlias    746

coolAlias

coolAlias    746

  • Reality Controller
  • coolAlias
  • Members
  • 746
  • 2805 posts
Posted October 5, 2013

For structures such as villages and such, whenever one generates the chunk coordinates are stored in a map in MapGenStructure:

if (this.canSpawnStructureAtCoords(par2, par3))
{
     StructureStart structurestart = this.getStructureStart(par2, par3);
     this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par2, par3)), structurestart);
     this.func_143026_a(par2, par3, structurestart);
}

This way the generator can check 'structureMap' to see if the coordinates currently generating already have a structure and, if so, skip it.

 

I'm sure you could do something similar for your scattered feature.

  • Quote

width=228 height=100http://i.imgur.com/NdrFdld.png[/img]

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • LessyDoggy
      Forge 1.12.2 Installing Bug

      By LessyDoggy · Posted 1 hour ago

      So I used forge 1.16.5 but now I cant change it too 1.12.2 no mather what. I have tried Installing client, Installing server and extract but nothing works. I even removed forge 1.16.5 from my computer but I still have that verison on and idk how to change it.
    • Yourskillx2
      !!Keeps crashing during launch!!

      By Yourskillx2 · Posted 1 hour ago

      I have a decent sized mod pack with around 90 mods and every time I go to launch the game, it loads some stuff then crashes with exit code 0, I cannot figure out if its a mod in the pack doing it, like maybe not a release version or if it just doesn't work with Mc like its supposed to.
    • IMaironI
      server error

      By IMaironI · Posted 8 hours ago

      2021-03-06-8.log
    • diesieben07
      server error

      By diesieben07 · Posted 8 hours ago

      Like I already said: The logs folder.
    • prototype204
      Attacking/Hitting issue

      By prototype204 · Posted 8 hours ago

      I am no longer able to attack animals or mobs in the game, however they are still able to attack me. I checked to verify that the mods I downloaded weren't the issue. I think they might be an error code in forge 1.16.5 however if anyone knows what I could do to fix this. P.S. I could still break bricks. 
  • Topics

    • LessyDoggy
      0
      Forge 1.12.2 Installing Bug

      By LessyDoggy
      Started 1 hour ago

    • Yourskillx2
      0
      !!Keeps crashing during launch!!

      By Yourskillx2
      Started 1 hour ago

    • IMaironI
      13
      server error

      By IMaironI
      Started 12 hours ago

    • prototype204
      0
      Attacking/Hitting issue

      By prototype204
      Started 8 hours ago

    • BeardlessBrady
      3
      [1.16.5] Adding arguments to DeferredRegister and RegistryObject

      By BeardlessBrady
      Started 12 hours ago

  • Who's Online (See full list)

    • zlappedx3
    • DavidM
    • troublemaker_47
    • VecsonON
    • Kreepydude
    • chaseoqueso
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • New Scattered Features
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community