An excellent tutorial has been written on how to use this tool, step-by-step by Wuppy, among his impressive list of other tutorials. You can find it here: http://wuppy29.blogs...ion-part-1.html
Changelog / Old Versions:
Version 1.7
The converter is now compatible with Minecraft 1.3.2
Added some additional UI prompts defaults to ensure proper formatting (for example, it will warn you if you don't have any blocks specified as allowed spawn blocks)
The slice viewer can now scroll if you have a larger schematic footprint
Height Variance Tolerance now defaults to 3 blocks
Added supplementary textures for blocks that didn't normally appear in terrain.png (such as fences, stairs, fire, etc.)
Fixed mouseover text so that it now works with metadata
Fixed certain windows not adapting the style of the current OS and defaulting to the Java UI
Added smarter conditional spawning functionality. You can now specify allowed variance in the height of surrounding blocks (ie, how flat does the land have to be?)
A list of allowed spawn blocks can also be specified (note that it must be the block directly under the first air block found). Want your structure to only spawn on snow? Easily done!
Added the slice viewer window. Now you can see your schematic slice by slice! You can also use this tool as a blueprint viewer, just use the slice viewer to see what you need to build!
Within the slice viewer, click on any block to toggle its "Ignored" state - ignored blocks will not be included in the generated .java class.
Condensed exported classes' size when dealing with metadata. Fewer lines are needed.
Where possible, the block's in-code name will now be outputted instead of the Block's ID.
This topic is for a little tool that I wrote that will convert .schematic files into a java class. There is another version on the forums that has a much nicer user experience, but it didn't quite do what I wanted it to. So I made this.
What this means, is that you can design the structure you want to create in-game, export it using something like MCEdit, and use this tool to create the WorldGen class that allows it to spawn in the world. This saves literally DAYS of modders' time, as you don't have to go through line by line, figuring out coordinates...you just build it and let this tool do all the heavy lifting. There is no limit to the number of blocks that you can have in your .schematic, as the program will break the functions up to get around the function length limitation in java.
Some of the features that it has:
Smart Structure Generation
This will use the specified list to ensure that your structure will only spawn on certain types of blocks. Want your structure to only spawn on grass? Easily done!
Ignore Air Blocks
This will cause the program to not output any blocks that are air. This is useful if you want to keep your file sizes low. However, you may end up with a half tree in the middle of your structure! It's up to you, this is one of the things asked of you in the program's process.
Block Deferral
This is always on, and will cause the program to attempt to defer specific blocks to the end of the generation file. This helps with things like torches, ensuring that the rest of the structure is in place before attempting to generate the torch. This helps to minimize blocks popping off the walls, as there is just nothing there.
Metadata
This is always on, and will output statements to set metadata for blocks found in the .schematic file. This contributes to things like stair rotation, what block a torch is placed on, etc.
Slice Viewer
This tool will allow you to see your schematic layer by layer, meaning you can use this tool to treat .schematic files as blueprints. You can also control what blocks are ignored simply by clicking on the block in the slice viewer. A red 'x' will appear over the block, indicating that it is ignored. To re-include it, simply click the 'x' again. When mousing over a block, the block's name appears above the slice viewer - so if a texture is missing, or you're not sure, you can still see what it is.
Configuration File
This file will allow you to specify what block IDs are mapped to what indices in a texture file. To add to it, simply add a section to the .ini file with the name being the relative path to the texture file itself (use the existing one as an example). All items under there will assume the use of that texture file. Texture files currently must be 256x256. Blocks that are completely unknown will still work and export, and can be flagged as "Ignored", but will appear as a blue question mark in the slice viewer, and will not have a name when exported.
From there, add one line per block in the format as follows:
BlockID,MetaData,Index,Name,Code Identifier
BlockID: The ID of the block
Metadata: The metadata associated with the block ID (this allows the same block ID to have different textures based on metadata within the slice viewer)
Index: the index in the texture file, see minecraft's methods of texture indexing.
Name: The Block's name within the slice viewer
Code Identifier: This tells the converter what to output instead of the block's ID when exporting. You do not need to include the .blockID at the end, in fact, doing so will cause your exported file to have errors.
An example line, for stone:
1,0,1,Stone,Block.stone
The app is written in Java, and for now, is all command-line based. I plan to add a GUI to it shortly.
I have now added a GUI to the app, also written in Java. This should make it still nicely portable.
Now, on to how to use it:
Download the jar file here, extract the contents to a folder on your computer.
Run the jar file. This window will open:
Click "Add File" and browse to your .schematic file. You may add as many as you like.
To control export settings, click on the schematic that you want to modify. Schematic settings will persist between selections, but not when the program closes.
Modify the options to ignore air blocks and enable smart spawning to your preference. You can also control what blocks are ignored simply by clicking on the block in the slice viewer. A red 'x' will appear over the block, indicating that it is ignored. To re-include it, simply click the 'x' again.
Modify the output directory, if you so choose.
The class name is derived from the file name, and will appear in brackets in the list as shown above. Click the "Generate" button to begin generating the java files. One java file will be generated per schematic. Completed items will appear in green, errors will appear in red. Your current selection will remain blue.
Wait 0.25 seconds for the program to finish, and copy the resulting .java file into your mod.
So you would just copy that .java file into your mod, into eclipse, or whatever you are using.
I made it for my mod, which will be released shortly, and I thought I would share it with the community. I find it immensely useful and a great time saver.
Future Features Include: Compatibility with 1.3.1
Multiple config file support to allow them to be separated per mod, for example. GUI!
Advanced Air Block Export - attempt to analyze the structure and find air blocks that would be inside, and only export those
Ability to spawn chests with items in them, using the GUI. The slice viewer was the first step towards this. Option to use SetBlock or SetBlockWithNotify (currently it is only SetBlock), configurable on a per block basis This has been handled with deferred blocks. instead of outputting the number representing the block ID, output the name (i.e. Block.stone.blockID)
If you run into any problems, let me know, and I'll try to help you out.
Thank you a lot for this. I (and a lot of other people) have been waiting endlessly for the other converter to update with metadata support. This tool works flawlessly. Just add a GUI and it will be even better.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
This is awesome! Most likely I'm going to be using this tool for my new mod, Legendary Beasts (as a tool in nest spawning)! Thank you for making it!
I do have a tip for your GUI however. Adding this line of code to your main method will help create a more native look and feel for your GUI, notably the JFileChooser.
This is awesome! Most likely I'm going to be using this tool for my new mod, Legendary Beasts (as a tool in nest spawning)! Thank you for making it!
I do have a tip for your GUI however. Adding this line of code to your main method will help create a more native look and feel for your GUI, notably the JFileChooser.
Can you provide some more information, such as:
What OS are you running?
What steps have you taken?
What step does "nothing" appear to be happening at? (Opening the program, adding a .schematic file, performing the conversion, etc)
THIS IS AWESOME CAN'T WAIT TO TRY IT OUT I just made a huge structure and i planned about 3 days to create the whole stuff and then I accidentaly found this! +1
Doesn't open for me, cmd appears and closes instantly
The latest version doesn't have any command-line to it - try re-downloading it, it sounds like you may have downloaded the old version. The command line version can't be run by just double clicking it, it requires parameters.
If re-downloading it doesn't work, try opening a command prompt, navigating to the folder that you downloaded the jar to, and running the program with:
2 lame questions:
1. Is it modloader compatible?
2. prob not, but is it 1.3.1 compatible?
It is most definitely ModLoader compatible - it's actually independent of any mod system, in that this gives you a .java file that will spawn your specified structure. Where the mod system comes in (Forge, ModLoader, etc.) is that you have to call this code from somewhere. If you were calling this from ModLoader (or forge, they should work the same way), you would put the following in your mod_whatever class:
public void generateSurface(World world, Random random, int i, int j){
//10% chance per chunk to generate the structure
// change this how you like
if (random.nextInt(1000) < 100){
new class_name_here().generate(...)
}
}
As for 1.3.1, I haven't tested it yet. I imagine that it probably would work, and if not, I'll release a patch shortly after I test it.
so if i build and export something, it just converts it and once i have the file i just have to put it in and it will generate the structure? Correct?
OS:Mac Mountain Lion
Its in eclipse and error free, (It doesn't seem to have the chance to generate code though)
The structure doesn't generate, i built it on a super flat world and set smart spawning(so it spawns on grass) then i set 3 to setBlockWithNotify (no notifications) and generated a new super flat world. Nada. Im wondering if I have to add code or what, but PLEASE get back to me on this cuz I LOVE your tool and i want it to work.
OS:Mac Mountain Lion
Its in eclipse and error free, (It doesn't seem to have the chance to generate code though)
The structure doesn't generate, i built it on a super flat world and set smart spawning(so it spawns on grass) then i set 3 to setBlockWithNotify (no notifications) and generated a new super flat world. Nada. Im wondering if I have to add code or what, but PLEASE get back to me on this cuz I LOVE your tool and i want it to work.
generateSurface is never called with a super flat world, since no ores, etc. are generated either - so you'll need a non-superflat world to see it.
Simply importing the java file won't make it work, not entirely. You'll need to override the generateSurface method in your mod_whatever file. The following snippet will give a pretty good chance to generate a structure:
public void generateSurface(World world, Random rand, int x, int z)
{
if (world == null || rand == null){
return;
}
//15% chance to attempt to generate a structure
//note that this is an ATTEMPT - smart generation could still cause this to fail if the generated coordinates are deemed inadequate for spawning!
if (rand.nextInt(1000) < 150){
//once we have decided to attempt to generate within this chunk, check 15 random locations to see if we can find a suitable one to generate our structure at
for (int i = 0; i < 15; ++i){
//pick a random position
int RandPosX = x + rand.nextInt(16);
int RandPosY = rand.nextInt(150);
int RandPosZ = z + rand.nextInt(16);
//attempt to generate
if (new my_class_here().generate(world, rand, RandPosX, RandPosY, RandPosZ)){
{
//success! we're done here.
break; //set a breakpoint here when debugging to see when a structure generates
}
}
}
}
Your best bet would be to make that chance to generate a really high number, or remove the smart generation for the time being (I have a much smarter algorithm in place for the next release, it adds a bit of tolerance) and set a breakpoint where I indicated above. The current algorithm expects perfect conditions, which rarely happens. Once that breakpoint hits, record the location that it was generated at (x, y, and z), and head there.
generateSurface is never called with a super flat world, since no ores, etc. are generated either - so you'll need a non-superflat world to see it.
Simply importing the java file won't make it work, not entirely. You'll need to override the generateSurface method in your mod_whatever file. The following snippet will give a pretty good chance to generate a structure:
public void generateSurface(World world, Random rand, int x, int z)
{
if (world == null || rand == null){
return;
}
//15% chance to attempt to generate a structure
//note that this is an ATTEMPT - smart generation could still cause this to fail if the generated coordinates are deemed inadequate for spawning!
if (rand.nextInt(1000) < 150){
//once we have decided to attempt to generate within this chunk, check 15 random locations to see if we can find a suitable one to generate our structure at
for (int i = 0; i < 15; ++i){
//pick a random position
int RandPosX = x + rand.nextInt(16);
int RandPosY = rand.nextInt(150);
int RandPosZ = z + rand.nextInt(16);
//attempt to generate
if (new my_class_here().generate(world, rand, RandPosX, RandPosY, RandPosZ)){
{
//success! we're done here.
break; //set a breakpoint here when debugging to see when a structure generates
}
}
}
}
Your best bet would be to make that chance to generate a really high number, or remove the smart generation for the time being (I have a much smarter algorithm in place for the next release, it adds a bit of tolerance) and set a breakpoint where I indicated above. The current algorithm expects perfect conditions, which rarely happens. Once that breakpoint hits, record the location that it was generated at (x, y, and z), and head there.
Hope that helps.
where do i put this code, i have the java file with all the placement and stuff but i dont know where to put this bit of code.
generateSurface is never called with a super flat world, since no ores, etc. are generated either - so you'll need a non-superflat world to see it.
Simply importing the java file won't make it work, not entirely. You'll need to override the generateSurface method in your mod_whatever file. The following snippet will give a pretty good chance to generate a structure:
public void generateSurface(World world, Random rand, int x, int z)
{
if (world == null || rand == null){
return;
}
//15% chance to attempt to generate a structure
//note that this is an ATTEMPT - smart generation could still cause this to fail if the generated coordinates are deemed inadequate for spawning!
if (rand.nextInt(1000) < 150){
//once we have decided to attempt to generate within this chunk, check 15 random locations to see if we can find a suitable one to generate our structure at
for (int i = 0; i < 15; ++i){
//pick a random position
int RandPosX = x + rand.nextInt(16);
int RandPosY = rand.nextInt(150);
int RandPosZ = z + rand.nextInt(16);
//attempt to generate
if (new my_class_here().generate(world, rand, RandPosX, RandPosY, RandPosZ)){
{
//success! we're done here.
break; //set a breakpoint here when debugging to see when a structure generates
}
}
}
}
Your best bet would be to make that chance to generate a really high number, or remove the smart generation for the time being (I have a much smarter algorithm in place for the next release, it adds a bit of tolerance) and set a breakpoint where I indicated above. The current algorithm expects perfect conditions, which rarely happens. Once that breakpoint hits, record the location that it was generated at (x, y, and z), and head there.
Hope that helps.
i sound like a retard now, but how do u set a breakpoint?
where do i put this code, i have the java file with all the placement and stuff but i dont know where to put this bit of code.
It makes sense though, thanks.
When making a mod you will likely have a mod_***.java file, that's where you would put the sample code I provided. The method is an overload of one of the methods that exist in the BaseMod class. That's assuming you're using ModLoader or Forge, which I would recommend that you do (my personal preference is forge, but there's nothing wrong with ModLoader either). They will minimize if not eliminate conflicts with other mods.
i sound like a retard now, but how do u set a breakpoint?
ps, that last bit really helped
It all depends on how you're doing your development. If you're using Eclipse, then you put the cursor on the line that you want to set a breakpoint at, and press Ctrl+Shift+B. If you're using a different IDE, you'll have to find the specific method to set a breakpoint for your scenario.
Version 1.7 has been released, check the spoiler below for the list of changes.
Download Version 1.7
An excellent tutorial has been written on how to use this tool, step-by-step by Wuppy, among his impressive list of other tutorials.
You can find it here:
http://wuppy29.blogs...ion-part-1.html
Changelog / Old Versions:
Version 1.7
This topic is for a little tool that I wrote that will convert .schematic files into a java class. There is another version on the forums that has a much nicer user experience, but it didn't quite do what I wanted it to. So I made this.
What this means, is that you can design the structure you want to create in-game, export it using something like MCEdit, and use this tool to create the WorldGen class that allows it to spawn in the world. This saves literally DAYS of modders' time, as you don't have to go through line by line, figuring out coordinates...you just build it and let this tool do all the heavy lifting. There is no limit to the number of blocks that you can have in your .schematic, as the program will break the functions up to get around the function length limitation in java.
Some of the features that it has:
Smart Structure Generation
This will use the specified list to ensure that your structure will only spawn on certain types of blocks. Want your structure to only spawn on grass? Easily done!
Ignore Air Blocks
This will cause the program to not output any blocks that are air. This is useful if you want to keep your file sizes low. However, you may end up with a half tree in the middle of your structure! It's up to you, this is one of the things asked of you in the program's process.
Block Deferral
This is always on, and will cause the program to attempt to defer specific blocks to the end of the generation file. This helps with things like torches, ensuring that the rest of the structure is in place before attempting to generate the torch. This helps to minimize blocks popping off the walls, as there is just nothing there.
Metadata
This is always on, and will output statements to set metadata for blocks found in the .schematic file. This contributes to things like stair rotation, what block a torch is placed on, etc.
Slice Viewer
This tool will allow you to see your schematic layer by layer, meaning you can use this tool to treat .schematic files as blueprints. You can also control what blocks are ignored simply by clicking on the block in the slice viewer. A red 'x' will appear over the block, indicating that it is ignored. To re-include it, simply click the 'x' again. When mousing over a block, the block's name appears above the slice viewer - so if a texture is missing, or you're not sure, you can still see what it is.
Configuration File
This file will allow you to specify what block IDs are mapped to what indices in a texture file. To add to it, simply add a section to the .ini file with the name being the relative path to the texture file itself (use the existing one as an example). All items under there will assume the use of that texture file. Texture files currently must be 256x256. Blocks that are completely unknown will still work and export, and can be flagged as "Ignored", but will appear as a blue question mark in the slice viewer, and will not have a name when exported.
From there, add one line per block in the format as follows:
BlockID,MetaData,Index,Name,Code Identifier
1,0,1,Stone,Block.stone
The app is written in Java, and for now, is all command-line based. I plan to add a GUI to it shortly.I have now added a GUI to the app, also written in Java. This should make it still nicely portable.
Now, on to how to use it:
I made it for my mod, which will be released shortly, and I thought I would share it with the community. I find it immensely useful and a great time saver.
Future Features Include:
Compatibility with 1.3.1Multiple config file support to allow them to be separated per mod, for example.
GUI!Advanced Air Block Export - attempt to analyze the structure and find air blocks that would be inside, and only export those
Ability to spawn chests with items in them, using the GUI. The slice viewer was the first step towards this.
Option to use SetBlock or SetBlockWithNotify (currently it is only SetBlock), configurable on a per block basisThis has been handled with deferred blocks.instead of outputting the number representing the block ID, output the name (i.e. Block.stone.blockID)If you run into any problems, let me know, and I'll try to help you out.
Cheers!
together they are powerful beyond imagination."
I do have a tip for your GUI however. Adding this line of code to your main method will help create a more native look and feel for your GUI, notably the JFileChooser.
Note that it needs to be called before creating the JFileChooser.
Anyways, nicely done. ;D
You have my thanks!
http://halocraft.glitchyscripts.com/
And you haven't even started working on the complex builds yet.....
Thank you very much for making this Mithion!
and Haxman12, for getting me started and linking me here
http://halocraft.glitchyscripts.com/
Thanks very much, I'll add it in!
Can you provide some more information, such as:
What OS are you running?
What steps have you taken?
What step does "nothing" appear to be happening at? (Opening the program, adding a .schematic file, performing the conversion, etc)
The latest version doesn't have any command-line to it - try re-downloading it, it sounds like you may have downloaded the old version. The command line version can't be run by just double clicking it, it requires parameters.
If re-downloading it doesn't work, try opening a command prompt, navigating to the folder that you downloaded the jar to, and running the program with:
If the problem persists, let me know.
It is most definitely ModLoader compatible - it's actually independent of any mod system, in that this gives you a .java file that will spawn your specified structure. Where the mod system comes in (Forge, ModLoader, etc.) is that you have to call this code from somewhere. If you were calling this from ModLoader (or forge, they should work the same way), you would put the following in your mod_whatever class:
As for 1.3.1, I haven't tested it yet. I imagine that it probably would work, and if not, I'll release a patch shortly after I test it.
OS:Mac Mountain Lion
Its in eclipse and error free, (It doesn't seem to have the chance to generate code though)
The structure doesn't generate, i built it on a super flat world and set smart spawning(so it spawns on grass) then i set 3 to setBlockWithNotify (no notifications) and generated a new super flat world. Nada. Im wondering if I have to add code or what, but PLEASE get back to me on this cuz I LOVE your tool and i want it to work.
generateSurface is never called with a super flat world, since no ores, etc. are generated either - so you'll need a non-superflat world to see it.
Simply importing the java file won't make it work, not entirely. You'll need to override the generateSurface method in your mod_whatever file. The following snippet will give a pretty good chance to generate a structure:
Your best bet would be to make that chance to generate a really high number, or remove the smart generation for the time being (I have a much smarter algorithm in place for the next release, it adds a bit of tolerance) and set a breakpoint where I indicated above. The current algorithm expects perfect conditions, which rarely happens. Once that breakpoint hits, record the location that it was generated at (x, y, and z), and head there.
Hope that helps.
where do i put this code, i have the java file with all the placement and stuff but i dont know where to put this bit of code.
It makes sense though, thanks.
i sound like a retard now, but how do u set a breakpoint?
ps, that last bit really helped
When making a mod you will likely have a mod_***.java file, that's where you would put the sample code I provided. The method is an overload of one of the methods that exist in the BaseMod class. That's assuming you're using ModLoader or Forge, which I would recommend that you do (my personal preference is forge, but there's nothing wrong with ModLoader either). They will minimize if not eliminate conflicts with other mods.
It all depends on how you're doing your development. If you're using Eclipse, then you put the cursor on the line that you want to set a breakpoint at, and press Ctrl+Shift+B. If you're using a different IDE, you'll have to find the specific method to set a breakpoint for your scenario.