ChestGenHooks chestcontents = ChestGenHooks.getInfo("Category"); // create registered ChestGenHooks chestcontents.addItem(new WeightedRandomChestContent(Item.dyePowder, 3, 4, 6, 10)); // 4-6 cocoa beans chestcontents.addItem(new WeightedRandomChestContent(new ItemStack(Block.cloth, 1, 15), 2, 3, 20)); // 2-3 black wool ItemStack itemStack = new ItemStack(Item.shovelIron); itemStack.addEnchantment(Enchantment.efficiency, 1); chestcontents.addItem(new WeightedRandomChestContent(itemStack, 1, 2, 5)); // 1-2 Efficiency I enchanted iron shovels chestcontents.setMin(7); // inclusive chestcontents.setMax(9); // exclusive
(Ideally, this code could go wherever your mod's initialization method is)
In the above code, when a chest's contents are generated, it will try between 7-8 times (exclusive of max parameter) to select a random item to add to the inventory.
WeightedRandomChestContent has 2 constructors
WeightedRandomChestContent(int itemId, int damage, int minChance, int maxChance, int itemWeight)
WeightedRandomChestContent(ItemStack itemStack, int minChance, int maxChance, int itemWeight)
When a WeightedRandomChestContent entry is selected for generation, it will produce between minChance and maxChance items of that type (inclusive).
The probability of an entry being selected is the itemWeight for a particular item divided by the combined itemWeight for all the entries.
In the above example, the combined item weight is 35, so cocoa beans would have a probability of 10/35 (28.6%) of being selected.
To actually generate the items in your chest, you would use this code
TileEntity te = world.getBlockTileEntity(x, y, z); if (te instanceof IInventory) { ChestGenHooks info = ChestGenHooks.getInfo("Category"); WeightedRandomChestContent.generateChestContents(random, info.getItems(random), te, info.getCount(random)); }
Note the "Category" string, this name should be unique. 'world' and 'random' are your standard World and Random parameters, and x, y, z are is the position at which you previously created the chest.
This should work for any chest that implements IInventory.
1
If you want to pre-generate the chunks, try this --
- If you use Bukkit, then use the WorldBorder plugin. This allows you to generate all the chunks while the server is up. This is by far the best way to achieve it. https://dev.bukkit.org/bukkit-plugins/worldborder/
- If you use Forge, then I made a quick&dirty plugin that generates chunks in a radius, though it pauses the server while doing it. Only compiled for 1.8 at the moment but the source is available. https://mods.curse.com/mc-mods/minecraft/235916-world-generator
- If you have standalone, then there are a number of scripts that work by changing the spawn point and restarting the server to cause autogeneration. There are also a couple of scripts that generate a complex commandblock that teleports you around the world in a spiral to generate the chunks. This is messy but works with any version. http://gaming.stackexchange.com/questions/32316/how-do-i-pre-generate-a-minecraft-world
1
That's a pretty good idea! Are you able to make the World zip available as a download? I was planning on making a 2kx2k map with pregenerated dungeons, but have never managed to get around to it; this is far bigger :0
One point is that your map doesn't have any Desert biomes; this restricts the types of dungeons that can appear so that it doesn't cover as many possibilities, but this is a minor thing. There are also no examples of Treasure Hunts, though these might be better off in a separate map as this map is crammed full of dungeons.
Having a viewable map and playable demo world is awesome. Maybe this can be linked to and referenced from the MCDungeon site itself?
4
Cheshire Cat Builder's Helper Mod v2.7
Project moved to CurseForge: http://minecraft.curseforge.com/projects/builders-helper
See this link for all latest updates.
Download v2.7 from http://www.steveshipway.org/mc/builders-helper-2.7.zip (1.7.10, 1.8 )( includes src)
Download v2.5 from http://www.steveshipway.org/mc/builders-helper-2.5.zip (1.7.10, 1.8 )( includes src)
Download v2.4 from http://www.steveshipway.org/mc/builders-helper-2.4.zip (1.7.10, 1.8 )( includes src)
Download v2.3.2 from http://www.steveshipway.org/mc/builders-helper-2.3.2.zip (1.7.10, 1.8 )( includes src)
Download v2.3.1 from http://www.steveshipway.org/mc/builders-helper-2.3.1.zip (1.7.10, 1.8 )( includes src)
Download v2.2 from http://www.steveshipway.org/mc/builders-helper-2.2.zip (1.7.10, 1.8 )( includes src)
Download v0.3 from: http://www.steveshipway.org/mc/builders-helper-0.3.zip ( 1.7.10, 1.8 ) (includes src)
Download v0.2 from: http://www.steveshipway.org/mc/builders-helper-0.2.zip ( 1.7.10 only )
Download v1.0 from: http://www.steveshipway.org/mc/builders-helper-1.0.zip ( 1.7.10, 1.8 ) (includes src)
Download v2.0-beta1 from: http://www.steveshipway.org/mc/builders-helper-2.0-beta1.zip ( 1.8 only ) (includes src)
Download v2.1-beta1 from: http://www.steveshipway.org/mc/builders-helper-2.1-beta1.zip ( 1.7.10, 1.8 ) (includes src)
Copy and Paste structures and mobs to/from text files, with optional randomisations and autogeneration options.
Support for Ruins Templates and also MCEdit Schematics, as well as the native Blueprint language.
Larger Blueprint library coming slowly.
Screenshots:
This is a mod aimed at:
The mod adds a new item -- a Wand -- and a few commands ( /wand, /blueprint ). It allows the person holding the wand to create any of a number of predefined structures (plans) at the click of a right-button; it also allows them to save an existing structure as a file (blueprint) that can be loaded back in as a plan and used again multiple times.
Plans may use 'soft' blocks, which only place in air or water, and can also include reference to other place, at translation or rotation. There is also the option to use an element of randomness, so that it can generate varying structures from the same blueprint. It also preserves Block Entity data and can handle blocks added by other mods.
In Version 1.0, it is possible to set certain plans to auto-generate in new chunks as the world builds.
In version 2.0, there are SPAWNER and CHEST directives to allow randomly generated spawner targets and chest contents. You can also specify NBT for metadata, chests, spawners, mobs or items as either raw JSON or as an external .nbt file.
In version 2.2, there is the MOB directive to allow mobile entity creation. Also, MetaBlocks can be specified, which resolve to a different type of block depending on the current biome and randomness. For example, the cottage will be generated using different stone and wood if built in the desert as opposed to being built in the plains, and the Tower can have some randomly-chosen cobblestone blocks mossy.
In version 2.3.1, there are the IFBIOME and IFBLOCK test directives. These allow different structures in different biomes, and recursive structures (eg, a tunnel that stops at the other side of the hill)
In version 2.3.2, we get the MSG and PICTURE directives. PICTURE allows you to create a map-in-a-frame entity on a wall from an external image file -- so you can put your picture on the wall!
In version 2.4, you can now copy a structure by using the command '/wand copy', and then right-clicking with the wand to indicate which area to copy. There is also support for structures defined as Ruins Templates, from the Ruins mod. These are converted into Blueprints when they are loaded.
Version 2.5 adds Schematics support, and also an Undo buffer so that you can use '/bp undo' to back out your last change.
Example blueprint:
PUBLIC PLAN cottage A simple small one room cottage # Autogenerate with chance 10/100,000 AUTO 1000 Plains,Forest,Savanna,Savanna Plateau,Desert # shift to make the door in front of us when created CALL _cottage -2 -1 1 0 END
Another example:
BLOCK minecraft:flower_pot(4) 0,0,0 {Item:38,Data:4,id:"FlowerPot"}
END
An example from v2.0 with dynamic Spawner and Chest contents:
# Chest using BLOCK and NBT
BLOCK minecraft:chest(2) 1 0 1 {Items:[0:{Slot:0b,id:"minecraft:bone",Count:2b,Damage:0s,},],id:"Chest",Lock:"",}
# Chest using BLOCK and file
BLOCK minecraft:chest(5) 1 0 3 chest_box_redstone.nbt
# Chest using CHEST and nbt
CHEST 1 0 5 3 {id:"Chest",CustomName:"Test Chest",Items:[0:{Count:3b,Slot:1b,Damage:0s,id:"minecraft:stick"}]}
# Chest using CHEST and file
CHEST 1 0 7 4 chest_box_redstone.nbt
# Chest using CHEST and itemlist
CHEST 1 0 9 2 minecraft:cobblestone minecraft:cobblestone,2;100 minecraft:torch,3,64;90
# Chest using CHEST and itemlist with item files
CHEST 1 0 11 5 minecraft:cobblestone;0 item_sharp_sword.nbt;100 item_head_herobrine.nbt,2,2;100
# Spawner using BLOCK and NBT (Zombie with custom name and pumpkin head)
BLOCK minecraft:mob_spawner -1 0 1 {id:"MobSpawner",EntityId:"Zombie",SpawnData:{CustomName:"Mr Zombie",Equipment:[0:{},1:{},2:{},3:{},4:{Count:1b,Damage:0s,id:86,},],},MaxNearbyEntities:6s,RequiredPlayerRange:16s,SpawnCount:4s,MaxSpawnDelay:800s,SpawnRange:4s,Delay:20s,MinSpawnDelay:200s,}
# Spanwer using BLOCK and file
BLOCK minecraft:mob_spawner -1 0 3 spawner_skeleton_pumpkin.nbt
# Spawner using SPAWNER and file
SPAWNER -1 0 5 spawner_multi_creeper.nbt
# Spawner using SPAWNER and potential
SPAWNER -1 0 7 Skeleton;50
# Spawner using SPAWNER and potential file
SPAWNER -1 0 9 Skeleton;10 entity_skeleton_pumpkin.nbt;50 {EntityId:"Zombie",SpawnData:{Equipment:[0:{},1:{},2:{},3:{},4:{Count:1b,Damage:0s,id:86}]}};50
END
The main thing to note is that, once the structures have been built, the mod is not required for the world to work (provided you have removed the Wand from the player inventory of course), though you do need to keep the mod installed for autogeneration to happen, of course.
The mod comes with a number of example blueprints, demonstrating the various capabilities. For example:
More details and documentation are included with the mod in the download file.
Suggested uses:
Note: This is my first Minecraft Forge mod. All constructive criticism and suggestions welcomed.
1
http://www.steveshipway.org/mc/cc-worldgen-1.0.zip (mod version 1.0)
http://www.steveshipway.org/forum/viewtopic.php?f=44&p=17942 (support thread)
This is a simple mod that allows you to pre-generate chunks on a single-player world.
This is useful when
- You want to have chunks pre-generated for use in a multiplayer server
- You want to run an add-in program, such as MCDungeon, to add structures to your world
- You want to edit but with pre-generated terrain first
You need to be in Creative mode, and the server thread will appear to hang while the generation takes place (which is why you can't do it in multiplayer).
To use, install the mod, then set up the area to generate using /worldgen. You can use any of these options to specify a circle or a rectangle area.
/worldgen radius
/worldgen x y radius
/worldgen x1 y1 x2 y2
E.G.
/worldgen 0 0 1000
Finally use /worldgen go
to start the generation. Progress logs will appear in the Minecraft log file and log window (if open). A 1,000 block radius circle will take about 20min to generate but this varies considerably depending on CPU speed, memory, other installed mods, and so on.
I created this mod specifically to pre-gen large worlds for use with MCDungeon. Note that people using Bukkit have a (much better) alternative in WorldBorder and WorldGuard; there do exist script-based solutions for Forge but I could find no Mod-based ones.
Feedback welcome.
1
The documentation is here: http://mcdungeon-docs.bubblemod.org/en/latest/
The default.cfg file has a lot of comments in it indicating the meanings and significance of the various settings.
When you generate dungeons, as well as specifying the size of the dungeon, you also give the min and max distance from the spawn that they can be located at. If you have maximise_distance then they will be as far apart as possible. If your terrain is particularly steep, or has other structures, or odd biomes, then there may not be many valid potential locations to bury a dungeon. Your biggest problem is likely the max_distance setting in the default.cfg which is fairly low by default, or that the chunks do not yet exist -- MCDungeon can only create in already existing chunks!
First, start up Minecraft in your world. Fly about in creative mode over a large area to ensure all the chunks are actually generated. There are, I think, some other modules that can do this for you automatically, but MCDungeon cannot trigger the autogeneration as it runs outside of the game. Once you have flown about and triggered Minecraft to generate all the chunks you want dungeons to appear in, exit and shut down the world.
Now, edit default.cfg, and set these values:
min_dist 5
max_dist 100
maximize_distance: True
This makes the dungeons locate anywhere from 5 chunks (80 blocks) to 100 chunks (1600 blocks) from the spawn point. They are kept as far from each other as possible. Theother setings can be left as they are for now, but you may want to change things to make it harder.
Trya command line similar to "mcdungeon add myworld 2-10 2-10 2-5 -c default.cfg -write -n 40 "
This will make up to 40 dungeons (-n 40) with 2-5 levels, of size anywhere between 2-10 chunks in each direction (these could be very big). If there is not enough room in the world, you will not get all 40 created - this may happen depending on your world biomes but it is unlikely.
One idea I have had is that the max_dist should default to the size of the current world, rather than 20. This would avoid the most common problem of not setting it correctly.
1
This includes the new SPAWNER and CHEST directives for blueprints with randomly generated contents; support for external .nbt files to specify metadata for blocks, including chests, spawners, items and mobs; and a fix for an issue that would cause container objects to often be rendered with an empty inventory.
http://www.steveshipway.org/mc/builders-helper-2.0-beta1.zip
This includes the source code; the 2.0 increment is because of the new blueprint directives, and also the rewriting of the blueprint functions and objects into a properly self-contained and portable package.Still no support for copying and placing entities, though.