Open mathuin opened 10 years ago
Hello, thanks for the update. I was looking into also adding the new kinds of stone as found in the recent snapshots, but I'm not sure where to add it. Can you give me some pointers? Thanks.
I don't know what stone has been added in the recent snapshots, but whatever you do want to add has to be added to pymclevel first, and then the pymclevel submodule in the TopoMC repository has to be updated.
Here's a different example: let's say you wish to create a Minecraft world where all the water is transformed into packed ice as if ice-9 from Kurt Vonnegut's "Cat's Cradle" was released. The first problem is that TopoMC's version of pymclevel doesn't know what packed ice is -- but the master branch of pymclevel does. So after reading a bunch of web pages about how git submodules suck and calling me names in your head, you figure out how to update the pymclevel checkout, something like this:
$ cd ~/.git/TopoMC
$ git pull
$ cd ./pymclevel
$ git checkout 8bf7b3d7
$ cd ..
$ git add pymclevel
$ git commit
Once you're done with that, you open up terrain.py and look it over. You will eventually come across the method Terrain.placewater:
@staticmethod
def placewater(x, y, z, crustval, bathyval):
# NB: no longer valid for 12!
newcrustval = int(max(0, crustval-(bathyval/2)))
return (y, [(newcrustval, 'Sand'), (bathyval, 'Water')], None)
I no longer remember what that comment's about. Oops. Anyway. All you need to do is replace 'Water' with 'Packed Ice'. Now when water is placed on the map, packed ice will be placed instead. The same technique can be used for placing new types of stone. Were it me, I'd look at these lines and replace individual references to 'Stone' with the new types of stone:
# schematic defaults
# 21: 10%, 22: 35%, 23: 65%, 24: 90%, 25: 95%
layout21 = [[[(1, 'Stone' if random() < 0.1 else 'Grass')] for x in xrange(10)] for x in xrange(10)]
layout22 = [[[(1, 'Stone' if random() < 0.35 else 'Grass')] for x in xrange(10)] for x in xrange(10)]
layout23 = [[[(1, 'Stone' if random() < 0.65 else 'Grass')] for x in xrange(10)] for x in xrange(10)]
layout24 = [[[(1, 'Stone' if random() < 0.90 else 'Grass')] for x in xrange(10)] for x in xrange(10)]
layout25 = [[[(1, 'Stone' if random() < 0.95 else 'Grass')] for x in xrange(10)] for x in xrange(10)]
Just make sure you really like whatever you put in layout24 and layout25. :-)
This effort will collide with the changes I will be making -- I may use a different pymclevel checkout and the changes in the Terrain class I mention above may interfere as well -- but you should be good to go!
Jack.
This will be harder than I expected. A lot more changed in pymclevel than I thought.
Ok. thanks a lot for checking it out. I'll see what I can do, but this is really just a little side project.
Keith Dart
On Sun, Jun 1, 2014 at 9:00 PM, Jack Twilley notifications@github.com wrote:
This will be harder than I expected. A lot more changed in pymclevel than I thought.
— Reply to this email directly or view it on GitHub https://github.com/mathuin/TopoMC/issues/44#issuecomment-44800390.
Minecraft added biomes in 1.7.2. Looks like I should do the same.
Short-term fix: update the pymclevel checkout, that should at least provide placeholder values.
Long-term fix: separate the Terrain class into two classes, one that deals with file data and one that actually populates the Minecraft world. Call the latter class Biome. Start with ocean and plains. See what happens.
Future possibilities: Use additional data: specifically, temperature and/or climate data would really help. May need additional geek knobs for month and/or year. Shame Minecraft won't let you change biomes in realtime so you can have seasons. Bravo can, at least...