Hello there all. I have recently seen a few structure spawning mods, and really like the idea. I am wondering where to begin to create my own mod, for my own personal use. Is there a program that is used to create structures? Is there a base script for creating a mod. I have never created a mod before, hence the cluelessness. Thanks.
Since you have never created a mod before, the best place for you to start would probably be by searching for 'Schematic To Java' and learning how to export your world save to a schematic.
Many of the tools are, however, outdated, and they certainly do not produce very good Java code, but they are extremely popular because people can build in Minecraft and convert that to code which they can turn into a mod. Schematics are probably how 95% of the instant structure mods work.
I've plugged this concept before, but if it were me I would write my own helper that reads plain-text files and processes them as setBlock commands. Such a schematic would look something like this:
[level0]
wwwww
w w
d w
w w
wwwww
[level1]
(some more stuff, level2, etc...)
[key]
w=minecraft:planks
d=minecraft:wooden_door
(so on)
Text-parsing in Java is quite easy; however I'm not sure how this would work with obfuscation.
EDIT: Forum sucks, the "w w" lines are supposed to be white-spaced evenly to match a 5x5 square.
I've plugged this concept before, but if it were me I would write my own helper that reads plain-text files and processes them as setBlock commands. Such a schematic would look something like this:
I imagine that is how schematics work already. World save files are a form of text (likely NBT), perhaps obfuscated by some compression algorithm, but still basically text. Sure, you could make one that processes plain-text, but why reinvent the wheel (unless you are doing so to learn)?
Schematic is a dying, non-human-readable format.
"Converting schematic into Java" is a anti-design.
You have all the power of Java behing you, why produce inneffecient, unreadable, unupdatable code ?
Just parse any template files you care about, then order it into properly organized data, and generate however you want.
I think "Schematica" does it for schematics, if you need an open source example.
I imagine that is how schematics work already. World save files are a form of text (likely NBT), perhaps obfuscated by some compression algorithm, but still basically text. Sure, you could make one that processes plain-text, but why reinvent the wheel (unless you are doing so to learn)?
What alternative is there? I can't think of a better way for a few reasons... 1) For me, typing ASCII schematics is much faster than going into a game and manually scanning buildings; 2) plain-text formatting makes dynamic/modular "room building" for varied structures much easier to code, 3) It's far easier to organize and code some pretty fancy meshing; 4) They can be created/modified easily by contributors without having to recompile the mod, and/or without having much technical skill.
I guess if you want your spawned structure to be 100% identical everywhere you go, then fair enough - just use some helper tool to build the setBlock commands manually. But if you want to make randomized dungeons or town layouts, I can't think of a better way. Please do share alternative methods if you can, as I'm interested and don't claim this to be *the* best way.
Schematic is a dying, non-human-readable format.
"Converting schematic into Java" is a anti-design.
You have all the power of Java behing you, why produce inneffecient, unreadable, unupdatable code ?
Just parse any template files you care about, then order it into properly organized data, and generate however you want.
I think "Schematica" does it for schematics, if you need an open source example.
Is that a reply to me? I'm guessing not, because my example literally is a "template file" in the way you describe, for the same purposes you mention - as I said above to coolAlias.
But again, if there's a better way than plain-text, I'd like to know. Manually building in-game and scanning them is not "better" in my opinion, I don't know what other options there are.
The Meaning of Life, the Universe, and Everything.
Join Date:
10/20/2012
Posts:
50
Member Details
CosmicDan actually did give us a great way, that could be converted in a simple api to be used in any mod, this kind of api makes the life of programmers much easier.
So for the OP's benefit, here is what many of us do to spawn structures in a mod:
Find a schematic or world map that has the structure needed (or make your own).
Place the structure in a flat world, edit as needed.
Export the schematic using mcedit.
Use a Schematic to Java converter to generate a Java class file.
Edit the Java code created for use in the mod. (Almost no converter creates code that works without some changes.)
Test it out and fix it until it spawns like we want.
To make it generate, you also need either an item that when held and right clicked will spawn the structure or have it generate when the world is first created (new game or unexplored areas). There are tutorials on world generation, and some converters include most of the code for that.
The above is a lot of work, so if there is a better way, I'd like to see it too, but so far I've not seen it.
CosmicDan actually did give us a great way, that could be converted in a simple api to be used in any mod, this kind of api makes the life of programmers much easier.
What alternative is there? I can't think of a better way for a few reasons... 1) For me, typing ASCII schematics is much faster than going into a game and manually scanning buildings; 2) plain-text formatting makes dynamic/modular "room building" for varied structures much easier to code, 3) It's far easier to organize and code some pretty fancy meshing; 4) They can be created/modified easily by contributors without having to recompile the mod, and/or without having much technical skill.
I guess if you want your spawned structure to be 100% identical everywhere you go, then fair enough - just use some helper tool to build the setBlock commands manually. But if you want to make randomized dungeons or town layouts, I can't think of a better way. Please do share alternative methods if you can, as I'm interested and don't claim this to be *the* best way.
I'm not disagreeing with you, I was saying that Schematics ARE text files, and while you may not be able to manually edit them as easily as what you have in mind, for a lot of people being able to build it in 3D makes the task much easier.
Plus, you will have to come up with a way to represent blocks with metadata, tile entities with complex NBT tags, etc., unless you plan on having only plain blocks.
I actually tried making a structure generation API of my own back in 1.6.4, and although I never got around to making it read from text files, it wouldn't be hard to do so.
Could you explain what advantages a text file has over schematics / Java for randomized dungeons and towns? It seems to me like each text file would represent a static structure that would be the same each time it generated, much like a schematic. Perhaps I'm just not seeing the difference.
Anyway, no, I don't know of a better way to generate structures.
As GotoLink says, using Java to generate and randomize structures IS the best way - you can get things like Nether Fortresses (or even much better), but the trouble with that is you have to be really freaking smart and good with both Java and math to do it, as well as have ton of time on your hands. I think we can safely assume that the vast majority of people fall outside that category, otherwise fairly limited tools like Schematics wouldn't be so popular.
I'm not disagreeing with you, I was saying that Schematics ARE text files, and while you may not be able to manually edit them as easily as what you have in mind, for a lot of people being able to build it in 3D makes the task much easier.
Plus, you will have to come up with a way to represent blocks with metadata, tile entities with complex NBT tags, etc., unless you plan on having only plain blocks.
I actually tried making a structure generation API of my own back in 1.6.4, and although I never got around to making it read from text files, it wouldn't be hard to do so.
Could you explain what advantages a text file has over schematics / Java for randomized dungeons and towns? It seems to me like each text file would represent a static structure that would be the same each time it generated, much like a schematic. Perhaps I'm just not seeing the difference.
Anyway, no, I don't know of a better way to generate structures.
As GotoLink says, using Java to generate and randomize structures IS the best way - you can get things like Nether Fortresses (or even much better), but the trouble with that is you have to be really freaking smart and good with both Java and math to do it, as well as have ton of time on your hands. I think we can safely assume that the vast majority of people fall outside that category, otherwise fairly limited tools like Schematics wouldn't be so popular.
Hrm very fair enough. I suppose my main interest is ease of 3rd-party contribution... maybe with a bit of "because I can/it'll be fun" too haha.
So really my comment as just been a "write your own schematic API" which really is only good if contributions are a primary concern and you have a lot of spare time to actually do it
The whole randomness thing can still be done, but it has to follow some kind of sane structure regardless of how it's coded. Blocks could be wildcards taken from a list, and "floor" or "roompart" schematics can be as small as 2x2 and follow some intermediate property system which defines when and where this room segment should be a placement candidate for a previously specified pool of room segments, with varying degrees of "intelligence" that can be used (e.g. floor/corner detection, entry/exits known beforehand, and total possible/required size of generate room) in order to provide that randomness. Metadata and/or NBT could be specified in ASCII or as separate files for inclusion...
..and a schematic scanner could still be done.
TL;DR: Essentially a room "tilemap" system with basic scripting language; as would be done in games with official modding API's - especially procedurally-generated dungeon crawlers. Only Minecraft is three dimensional and generally more complex, I know
Many of the tools are, however, outdated, and they certainly do not produce very good Java code, but they are extremely popular because people can build in Minecraft and convert that to code which they can turn into a mod. Schematics are probably how 95% of the instant structure mods work.
Text-parsing in Java is quite easy; however I'm not sure how this would work with obfuscation.
EDIT: Forum sucks, the "w w" lines are supposed to be white-spaced evenly to match a 5x5 square.
I imagine that is how schematics work already. World save files are a form of text (likely NBT), perhaps obfuscated by some compression algorithm, but still basically text. Sure, you could make one that processes plain-text, but why reinvent the wheel (unless you are doing so to learn)?
"Converting schematic into Java" is a anti-design.
You have all the power of Java behing you, why produce inneffecient, unreadable, unupdatable code ?
Just parse any template files you care about, then order it into properly organized data, and generate however you want.
I think "Schematica" does it for schematics, if you need an open source example.
What alternative is there? I can't think of a better way for a few reasons... 1) For me, typing ASCII schematics is much faster than going into a game and manually scanning buildings; 2) plain-text formatting makes dynamic/modular "room building" for varied structures much easier to code, 3) It's far easier to organize and code some pretty fancy meshing; 4) They can be created/modified easily by contributors without having to recompile the mod, and/or without having much technical skill.
I guess if you want your spawned structure to be 100% identical everywhere you go, then fair enough - just use some helper tool to build the setBlock commands manually. But if you want to make randomized dungeons or town layouts, I can't think of a better way. Please do share alternative methods if you can, as I'm interested and don't claim this to be *the* best way.
Is that a reply to me? I'm guessing not, because my example literally is a "template file" in the way you describe, for the same purposes you mention - as I said above to coolAlias.
But again, if there's a better way than plain-text, I'd like to know. Manually building in-game and scanning them is not "better" in my opinion, I don't know what other options there are.
The above is a lot of work, so if there is a better way, I'd like to see it too, but so far I've not seen it.
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]
Link?
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]
I'm not disagreeing with you, I was saying that Schematics ARE text files, and while you may not be able to manually edit them as easily as what you have in mind, for a lot of people being able to build it in 3D makes the task much easier.
Plus, you will have to come up with a way to represent blocks with metadata, tile entities with complex NBT tags, etc., unless you plan on having only plain blocks.
I actually tried making a structure generation API of my own back in 1.6.4, and although I never got around to making it read from text files, it wouldn't be hard to do so.
Could you explain what advantages a text file has over schematics / Java for randomized dungeons and towns? It seems to me like each text file would represent a static structure that would be the same each time it generated, much like a schematic. Perhaps I'm just not seeing the difference.
Anyway, no, I don't know of a better way to generate structures.
As GotoLink says, using Java to generate and randomize structures IS the best way - you can get things like Nether Fortresses (or even much better), but the trouble with that is you have to be really freaking smart and good with both Java and math to do it, as well as have ton of time on your hands. I think we can safely assume that the vast majority of people fall outside that category, otherwise fairly limited tools like Schematics wouldn't be so popular.
Hrm very fair enough. I suppose my main interest is ease of 3rd-party contribution... maybe with a bit of "because I can/it'll be fun" too haha.
So really my comment as just been a "write your own schematic API" which really is only good if contributions are a primary concern and you have a lot of spare time to actually do it
The whole randomness thing can still be done, but it has to follow some kind of sane structure regardless of how it's coded. Blocks could be wildcards taken from a list, and "floor" or "roompart" schematics can be as small as 2x2 and follow some intermediate property system which defines when and where this room segment should be a placement candidate for a previously specified pool of room segments, with varying degrees of "intelligence" that can be used (e.g. floor/corner detection, entry/exits known beforehand, and total possible/required size of generate room) in order to provide that randomness. Metadata and/or NBT could be specified in ASCII or as separate files for inclusion...
..and a schematic scanner could still be done.
TL;DR: Essentially a room "tilemap" system with basic scripting language; as would be done in games with official modding API's - especially procedurally-generated dungeon crawlers. Only Minecraft is three dimensional and generally more complex, I know