TileEntityChest chest = blocks.GetTileEntity(x, y, z) as TileEntityChest;
if (chest == null) { // oops }
Item diamond = new Item();
diamond.ID = 264;
diamond.Count = 16;
chest.Items[4] = diamond;
I haven't tested this, although I will try to put up a real example later, but I think this should work if there are no bugs. Just create an item object, and assign it to the items collection using the indexer.
BlockReplace is a basic block replacement tool (and with only a few lines of code, still better than at least 90% of the other block replacement tools out there since Substrate maintains full consistency for lighting, tile entities, etc).
GoodyChest is a fun little example for creating and filling chests with items, and placing them randomly throughout the world. It depends on new code and bugfixes committed in the last few days, but haven't been released in a new version yet.
If I go into one of the small grey blocky buildings (there's four around the map, one in each quarter) and then block the doorway up with mud, it's still light inside.
Strangely if I create a new structure in-game which has no openings to the outside, that will be completely dark inside (as expected).
I can take a quick video of this, if that would help?
Edit: Here's .
Send me that part of the map so I can do some tests on it. I also can't accurately evaluate what is happening with lighting when smooth lighting is enabled.
EDIT: Though actually, once you're actually running MC, what happens with the lighting is beyond the control of third party tools. MC has been riddled with lighting bugs in the last few releases. But I can still look at it.
Thanks, I actually unearthed two serious lighting bugs (both related to heightmaps, which if incorrect really mess up MC's lighting routines).
Version 0.5.2 is now available for download. Changes include:
- Lighting bugfixes and performance improvements
- TileEntity fixes
- Beta 1.6 block and item types
- 'State' property to BlockInfo (solid/nonsolid/fluid)
- Chunk copying / setting
- ItemInfo classes and supporting data enums
- Re-exposed the PlayerManager
- All missing examples added
FlatMap is probably slower because of the heightmap calculation which wasn't being done appropriately before (although it should actually be toggled by autolight along with the others, since it'll get rebuilt at the end)
For the steps and lava, is that a result of placing/removing a block in both cases, or does it also happen with a global relight?
Thanks for the reports. I've posted 0.5.3 which should fix all these things.
Slabs and Lava are a couple of the weird blocks that need to be self-lit yet don't transmit light. If my update history hasn't already indicated, lighting is a major pain.
NBToolkit is not distributed directly with Substrate even though it's technically part of the solution. I wouldn't worry about it. VS and MD will complain but they should be happy to just build Substrate on its own. It will be separated in the future anyway.
But I don't understand the problem with Level.cs. I just downloaded a fresh copy of MonoDevelop, loaded up the project from 0.5.3, and built the project without any errors.
This adds an old request: fluid simulation for calculating flows of water and lava. The Blocks collection class adds functions similar to the lighting functions, like resetting, rebuilding, or updating fluids. Chunks and the BlockManager also have an AutoFluid property, like AutoLight, for automatically simulating fluids when they're placed. It is disabled by default since this may often be undesirable.
If you're generating new worlds, you probably want to wait and rebuild fluid flows all at once at the end. In an existing world, this will probably cause unsatisfactory results, since minor modifications to terrain since spawn can have drastic effects on how fluids flow. Also, it appears that fluids are calculated by different rules in the MC chunk generator than they would otherwise follow if you dropped a bucket of water, for example.
So far the simulator seems to do an okay job, but it's probably in the same state lighting was a month ago. There will be weird issues that will only be wrung out if it's used aggressively.
Hehe, there was a bug in 0.5.2, but you fixed it before I even investigated what caused it :biggrin.gif:
Now there seems to be a new bug on horizon... Blockmanager.GetHeight(x, z) seems to return always 0 :/
You'll have to send me a world and program demonstrating this, because I cannot reproduce it. BlockManager is returning positive values for me. HOWEVER it will return 0s if you try to query chunks that don't exist and/or are corrupt...
Did you remember to reset the lighting on all the chunks first? It's a really important step that cannot be combined with the Rebuild* functions unless you want to load the whole world into memory first...
All of the lighting algorithms make a critical assumption that the world is either properly lit or underlit.
Found it, there was a verification error for inventory-based tile entities, causing the Get function to return null. A fix has been pushed to source, but a new release probably won't be for a day or two.
I guess there's no way to use this library with Java code? Is there any way to edit blocks with Java that you know of?
Rollback Post to RevisionRollBack
I'm a decent Java programmer learning Python, and I'm skilled with server administration, WorldEdit, redstone circuitry, etc. Feel free to show me mod ideas, I'm thinking about starting to make mods, and I'd be happy to give insight as to how a mod could be implemented in Minecraft.
You should ask anyone who is supporting a Java tool if there is a library they are using. I would be surprised if you can't find one.
You could also try taking a stab at C#, which is very similar to Java.
Ok thanks. I kinda don't really like the whole .net windows exclusivity, but I may take a look at C-Sharp. I believe there's an old NBT library from alpha for Java, but isn't this a block editing library thing, and I don't know if it works with the beta save format.
Rollback Post to RevisionRollBack
I'm a decent Java programmer learning Python, and I'm skilled with server administration, WorldEdit, redstone circuitry, etc. Feel free to show me mod ideas, I'm thinking about starting to make mods, and I'd be happy to give insight as to how a mod could be implemented in Minecraft.
Alpha NBT libraries are no longer useful. You need to find one updated for regions. Granted, for Java there is no excuse because the region code has been distributed by Mojang. But even if you find one, a straight NBT library only gives you low-level access to a tree of data items. It won't do all the nice things that a high-level SDK like Substrate (or some of the Python SDKs) do, like recalculating lights or giving you a friendly API on top of NBT.
I also think Windows-exclusivity is a misnomer. CIL (what all .NET languages boil down to) has been standardized by ECMA, and the Mono runtimes exist for Linux and OSX. It's not much different than needing to download the JRE before you can run any Java applications. The JRE does have the benefit of being ported to more platforms.
Send it anyway (or ideally, both).
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
I haven't tested this, although I will try to put up a real example later, but I think this should work if there are no bugs. Just create an item object, and assign it to the items collection using the indexer.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
BlockReplace is a basic block replacement tool (and with only a few lines of code, still better than at least 90% of the other block replacement tools out there since Substrate maintains full consistency for lighting, tile entities, etc).
GoodyChest is a fun little example for creating and filling chests with items, and placing them randomly throughout the world. It depends on new code and bugfixes committed in the last few days, but haven't been released in a new version yet.
Other example documentation is cleaned up a bit.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
What is the bug?
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
Send me that part of the map so I can do some tests on it. I also can't accurately evaluate what is happening with lighting when smooth lighting is enabled.
EDIT: Though actually, once you're actually running MC, what happens with the lighting is beyond the control of third party tools. MC has been riddled with lighting bugs in the last few releases. But I can still look at it.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
Version 0.5.2 is now available for download. Changes include:
- Lighting bugfixes and performance improvements
- TileEntity fixes
- Beta 1.6 block and item types
- 'State' property to BlockInfo (solid/nonsolid/fluid)
- Chunk copying / setting
- ItemInfo classes and supporting data enums
- Re-exposed the PlayerManager
- All missing examples added
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
For the steps and lava, is that a result of placing/removing a block in both cases, or does it also happen with a global relight?
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
Slabs and Lava are a couple of the weird blocks that need to be self-lit yet don't transmit light. If my update history hasn't already indicated, lighting is a major pain.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
But I don't understand the problem with Level.cs. I just downloaded a fresh copy of MonoDevelop, loaded up the project from 0.5.3, and built the project without any errors.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
This adds an old request: fluid simulation for calculating flows of water and lava. The Blocks collection class adds functions similar to the lighting functions, like resetting, rebuilding, or updating fluids. Chunks and the BlockManager also have an AutoFluid property, like AutoLight, for automatically simulating fluids when they're placed. It is disabled by default since this may often be undesirable.
If you're generating new worlds, you probably want to wait and rebuild fluid flows all at once at the end. In an existing world, this will probably cause unsatisfactory results, since minor modifications to terrain since spawn can have drastic effects on how fluids flow. Also, it appears that fluids are calculated by different rules in the MC chunk generator than they would otherwise follow if you dropped a bucket of water, for example.
So far the simulator seems to do an okay job, but it's probably in the same state lighting was a month ago. There will be weird issues that will only be wrung out if it's used aggressively.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
You'll have to send me a world and program demonstrating this, because I cannot reproduce it. BlockManager is returning positive values for me. HOWEVER it will return 0s if you try to query chunks that don't exist and/or are corrupt...
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
All of the lighting algorithms make a critical assumption that the world is either properly lit or underlit.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
I've also begun the slow, tedious process of documenting the public APIs. Ultimately this will result in an MSDN-style help resource.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
You should ask anyone who is supporting a Java tool if there is a library they are using. I would be surprised if you can't find one.
You could also try taking a stab at C#, which is very similar to Java.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
I also think Windows-exclusivity is a misnomer. CIL (what all .NET languages boil down to) has been standardized by ECMA, and the Mono runtimes exist for Linux and OSX. It's not much different than needing to download the JRE before you can run any Java applications. The JRE does have the benefit of being ported to more platforms.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate