Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited


  • Gender
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

sshipway's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. http://www.steveshipway.org/forum/viewtopic.php?f=44&p=17942 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.
  2. When you use /wand copy, instead of /bp copy, you click on the lower corners of the volume to be copied, and the height is automatically worked out by coming down until it hits a hard block. The lower Y coordinate is the minimum of the two clicked corners. So, if you click on [10,60,0] and [15,65,5] then the volume copied will be [10-15,60-H,0-5] where H is the highest block in the [10-15,0-5] column - which may well be 100 if there is something up that high. It works this way because you cannot click on an air block, and usually the top of your structure volume will have air in the corners. If you want to copy a specific volume, you can use /bp copy to specify the exact corners. The /wand copy command is intended to make things easier when copying an outside structure with nothing else above it. The problem might occur if you have an overhanging cliff, or a tree, or something floating in the air 69 blocks above you. Then you'll end up copying higher than you intended - though you could save with /bp save and subsequently edit the saved .bp file in a text editor and remove the offending block(s), before doing a /bp load to reload the blueprints.
  3. Thanks for this; I'd found IChunkProvider but not ChunkProvderServer. Obviously now I can call dropChunk() to get rid on the individual chunks (for some reason, dropChunk does not appear to exist in IChunkProvider). I assume that the instance of ChunkProviderServer to use this one -- ChunkProviderServer cps; cps = MinecraftServer.getServer().worldServers[0].theChunkProviderServer; cps.saveChunks(true,null); // make sure we have no pending updates cps.dropChunk(x,z); ... and indeed, the getLoadedChunkCount() from both the IChunkProvider and the ChunkProviderServer now never goes above approx 700, and the memory death is averted. Thanks for the help
  4. I have a (server-side) mod which is accessing a large number of chunks when it activates. Once accessed, these chunks do not need to remain in the cache as they are not likely to be accessed again for a long time. The problem is that the Java heap memory runs out. This is because the IChunkProvider.getLoadedChunkCount() shows me that I have many thousands of chunks still in the cache, exhausting the available memory. My question is, how can I kick these out of the cache? I've tried all of these: world.getChunkProvider().saveChunks(true,null); world.getSaveHandler().flush(); world.getChunkProvider().unloadQueuedChunks(); world.getWorldChunkManager().cleanupCache(); (new Chunk(world, x, y)).setChunkLoaded(false); However none of them seem to affect the cache size, which goes relentlessly upwards until a malloc error ends its life. What is the correct way to flag these cached chunks for unloading? TIA
  5. Version 2.5 is available from http://www.steveshipway.org/mc/builders-helper-2.5.zip This supports Ruins Templates and MCEdit Schematics, and can convert them to Blueprint format. There is also an 'undo' command to back out your changes, and you can select a structure by clicking on the corners of the base. It also supports a 'flatten' command to smooth out the land below a structure to avoid overhangs.
  6. Version 2.4 is available from http://www.steveshipway.org/mc/builders-helper-2.4.zip Changes: You can select the area to copy using right-click on the wand, rather than having to type in the coordinates. It also adds support for Ruins Templates (from the Ruins mod); these are automatically converted to Blueprint format and made available. Additional blueprints added Corrections to Float and Soft code Support for ChestGenHooks
  7. Version 2.3.2 is now available. This fixes some bugs, and adds the MSG and PICTURE directives. You can now create maps displaying the pictures from external image files!
  8. Aha! It seems that, in Minceraft 1.7, the data.markDirty() call is essential -- this is what causes the initial NBT file to be written. In Minecraft 1.8, it happens implicitly. I've added this call immediately after world.setItemData call, and now my code also works in 1.7.10. Thanks for the help -- I've posted here for the benefit of any future readers with a similar problem.
  9. While the method above works in 1.8, it seems that in 1.7 things are somewhat different. The code will create the object in-game, but the 'map' picture displays progressively, column by column. The worse part is that the map_#.dat NBT file is not written on save (though the idcounts ARE updated) and when the game is restarted, the 'map' is now a basic 0,0 blank map. Clearly, under 1.7, there is something else that needs to be done in order to add the map data to the world. Writing the map_#.dat NBT file myself only results in the previously mentioned "the world has been modified by something else" error, even if I try the trick of setting the file last modification time. The other problems, of ItemFrame being an entity and its Tile* attributes being different under 1.7 and 1.8 have been solved, and that's behaving, at least... V1.8 seem to me to be far easier to code for, and far more forgiving of missing or invalid data. They seem to have coded with the expectation of mods being created.
  10. Many thanks! The mystery was the correct usage of the MapData object. Although I had managed to avoid the error in the previous code by writing the NBT file and then setting the last modification time into the past, that solution was... suboptimal The function now all works, and I can generate framed-map 'pictures' in-game from external image files on the fly. public static short createMap(World world, String imgFilename , Logger logger ) { short mapNo; String mapFilename; NBTTagCompound map; MapData data; // build map object NBT map = imgToNBT(imgFilename,logger); if( map == null ) { return -1; } // unable to convert // get a new unique ID for the new map mapNo = (short) world.getUniqueDataId("map"); // save the data data = new MapData("map_"+mapNo); data.readFromNBT(map); world.setItemData("map_"+mapNo,data); return mapNo; }
  11. So, I'm trying to create a new filled_map item, preloaded with data (it is converted from an external image file). I have already created the code to convert my chosen image to an NBTCompoundTag corresponding to the Map Data. I can obtain a new, unique mapID, and write the NBT file to the correct data/map_#.dat location: mapNo = (short) world.getUniqueDataId("map"); String folderName = MinecraftServer.getServer().getFolderName(); ISaveFormat saveFormat = MinecraftServer.getServer().getActiveAnvilConverter(); SaveHandler saveHandler = (SaveHandler)saveFormat.getSaveLoader(folderName, false); String worldsavedir = saveHandler.getWorldDirectory().getPath(); mapFilename = worldsavedir + File.separator + "data" + File.separator + "map_" + mapNo + ".dat"; CompressedStreamTools.writeCompressed(map,new FileOutputStream(mapFilename)); This then allows me to make an object in the game, should I wish: mapItemStack = new ItemStack(Items.filled_map,1,mapNo); The new object appears in the game, has the correct contents, and seems happy. The problem is that, when I try to save the world, Minecraft complains that the world has been modified by something else -- the cause is the writing of the map_#.dat file, which must break some save-time integrity test. It is valid NBT (because exiting Minecraft and restarting allows things to work) but clearly, I should be using some internal function to write the new map out, not the CompressedStreamTools. I can create a MapData object like this: md = new MapData("map"); // what is the parameter for? md.readFromNBT(map); However, I cannot identify how to write this and obtain the unique DataId. There is a MapStorage class, and an ItemMap class, but I cannot work out how to link the MapData to these, obtain a unique ID, and force a save. I can possibly do this: im = Items.filled_map; im.updateMapData(world, entity, md); ... but it is unclear what the 'entity' refers to, and again there seems to be no way to specify the mapNumber. Conversely, the MapStorage class allows me to make a new mapNumber and apparently to save the maps, but I have no way to assign the MapData object to the new mapNumber. Any help and pointers on this would be appreciated. I feel like I'm so close, but blocked by a lack of documentation... Steve
  12. Many thanks for the tip. Your camera mod looks awesome, though it does not generate a filled_map but a custom photo object; if only this were available for 1.7.10 or 1.8 I'd install it immediately. Fortunately for me, my chosen niche is not yet completely filled, as I'm planning on doing in-game conversion from external jpgs to filled_map objects. I'll skip the 'camera' object part as you've already done that so well...
  13. To copy a structure in-game: [*]Hold the Wand, or be in Creative mode [*]Use the command: /bp copy myname x1 y1 z1 x2 y2 z2 Replace myname with the name you want to store the new blueprint under. The coordinates are for opposite corners of the box to copy; so "1 2 3 4 5 6" will copy from block 1,2,3 to block 4,5,6 (a 3x3x3 cube). It will not copy Air blocks. [*]You can now use /wand set myname to make the wand produce your newly copied blocks when you right-click at a location. [*]Use /bp savemyname to save your new blueprint to disk as confg/bp/myname.cfg . This will make it persist after game restarts. [*]Note that the 'origin' as defined by a /bp copy may not be precisely where you want it to be. In this case, you can edit the new blueprint file to wrap the new plan in another plan that simply does an offset and/or rotation. See the cottage.cfg example blueprint for a demonstration of this. To use the wand: [*]The wand is initially not set to do anything. You need to "enchant" it (I.E., associate it with an existing Blueprint). [*]Use /bp list to list the Public blueprints. [*]Use /wand set name to set the wand to produce a specific blueprint. This works with public or private blueprints. [*]Right-click (use) the wand on a block. You must be targetting a block; just clicking in the air does nothing. This will create the specified structure at this point. [*]You may need to wait a few seconds for the structure to appear, depending on the complexity of the structure, or the speed of your server. A chat message will tell you when the build is completed (or if it failed for any reason). Using Blueprints [*]A blueprint is a file containing one or more plans, which contain sequences of instructions to create a structure. The directory of blueprints is called the portfolio. [*]A particular plan may call one or more other plans multiple times; in fact, this is a recommended way to define structures. The sub-plans can be marked 'private', which means their names do not normally display when listing plans. [*]A plan may be marked as 'autocreate' with a probability and biome list. This is used by the autogenerator to randomly create this structure in the world as new chunks are defined. [*]Blueprints can be created by the /bp save command, usually after running /bp copy to copy something in-world. However, it is usually more efficient to write or edit them by hand. [*]The Blueprint language is structured similarly to the language Logo. It has basic testing and branching, and can use 'soft' blocks (which only place in Air) or 'meta' blocks (which have an element of randomness or dependence on biome). The language is detailed in the readme.cfg sample blueprint; there are also many other example blueprints provided to help you. [*]Plans in one blueprint may call plans from another; however this is not generally recommended as you cannot be certain which order they will be evaluated in. It is best to keep all related plans in a single blueprint file. Also, it is Best Practice (though not required) to prefix private plans with an underscore, and have all plans in a blueprint with a common prefix -- for example, "hut", "_hut_roof", "_hut_window". [*]Be careful with recursion. An infinitely-recurring plan will hang the server thread (this will be hopefully prevented in a future release) I hope this helps! Documentation is slowly being written. I'm hoping that other module writers may pick up on the blueprint language as being a convenient way to define structures, and it could become a common language for exchanging structural definitions.
  14. So, I am trying to create a new microsoft:filled_map item. It's pretty easy to make an empty one, or even one that will fill from the world map, but how do I set the contents dynamically? If the game were offline, I could increment the counter in the idcounts.dat NBT, then create a new maps/map_#.dat file for the new ID, and create the item with the appropriate id set. However, I'd like to do this online... Is there an API call that I can use to set the map data (creating the map_#.dat and incrementing the idcounts.dat) from a colors array? The intention for this is to be able to create a 'picture' (actually a filled map) in game from either an external file, or a view via a 'camera' object, that can be placed in an item frame for display. Thanks for any suggestions or help...
  15. Version 2.3.1 is now available, and implements the IFBIOME and IFBLOCK tests. This now supports 1.7.10 and 1.8, and fixes the issues with metablocks not always working as well as the issues with log rotation in 1.8.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.