Check out the latest source code from the GitHub repo. A biome API was contributed by another person. I haven't personally done anything with it yet, but it should be a basic property of chunks.
The biome enumeration is matched up with the biome IDs in game, so if your generator gives you those numbers directly, you can just cast them directly to the biome enum type.
Hello, I am trying to delete all instances of a certain block in my world. It removes them, but it doesn't seem to be saving the world. Any idea? The block is from Feed The Beast, specifically Factorization's Wrath Lamp.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Substrate;
using Substrate.Core;
namespace EntityFinder
{
/// <summary>
///
/// </summary>
class Program
{
static void Main(string[] args)
{
//Diresctory containing the world.
Console.WriteLine("Enter World Directory");
String directory = Console.ReadLine();
NbtWorld world = NbtWorld.Open(directory);
IChunkManager sourceCM = world.GetChunkManager();
int delCount = 0;
foreach (ChunkRef cr in sourceCM)
{
int xdim = cr.Blocks.XDim;
int ydim = cr.Blocks.YDim;
int zdim = cr.Blocks.ZDim;
for (int x = 0; x < xdim; x++)
{
for (int z = 0; z < zdim; z++)
{
for (int y = 0; y < ydim; y++)
{
if (cr.Blocks.GetID(x, y, z) == 1000)
{
cr.Blocks.ClearTileTick(x, y, z);
cr.Blocks.ClearTileEntity(x, y, z);
delCount++;
}
}
}
sourceCM.Save();
Console.WriteLine("Processed Chunk {0},{1}", cr.X, cr.Z);
}
}
world.Save();
Console.WriteLine("Complete, {0} blocks deleted", delCount);
Console.ReadLine();
}
}
}
You're only clearing the TileEntity, but you also need to replace the block itself with another block (like AIR), using cr.Blocks.SetID(x, y, z, value).
If you're dealing with an Item object, just give it a block ID and set the damage value as normal. If you're dealing with blocks already placed, you set the Data value instead.
If you're dealing with an Item object, just give it a block ID and set the damage value as normal. If you're dealing with blocks already placed, you set the Data value instead.
I'll have to test when I get home. The SDK needs some updates because Minecraft added new fields to chunks that it might be expecting. But I don't know that's actually the problem. You are using the latest version from September?
Ok, I will have to look at it when I get home. If you'd like to help speed up that process, send me a sample project that's generating bad worlds. It will be easier for me to verify the right things are fixed.
It looks like I never exposed a Sections property in AnvilChunk. I just checked one in now, so you'll have to download and build from source.
Getting AnvilChunk objects is still a challenge though. Iterating through a ChunkManager will give you ChunkRef objects behind an IChunk interface. You can use "GetChunkRef" on the IChunk object, and then cast the return value to an AnvilChunk. But when you're done with it you need to set it back with a call to "SetChunk".
The reason this is all a pain is because the API was supposed to hide the underlying data representation. You're specifically trying to pull some of those details out.
I am creating a custom map file format. At first I implemented my own code to read the MC World but then I decided to just switch to Substrate and that is why I need low level access. Thanks for the fast reply, I will take a look at the code.
I am using it to develop a tool I am calling More Interesting Minecraft (MIM) - something which adds additional structures and tinkers with existing worlds to make them more interesting.
Anyway, I noticed that somewhere between 1.6.2 and the current release substrate has broken and it doesn't appear to be able to read the level.dat file. Is this something you are aware of or do you want some more information on the problem? Is it likely to be fixed?
I would recommend updating the first post. The code provided does not compile.
1.) the less than sign is replaced with funky characters (escape sequence I assume)>
2.) the BetaChunkManager is not found.
3.) Chunk no longer accepts zero arguments for .save();
How would one find a Skull of any kind (397 or 397:1 or 397:2 etc).
I understand these are TileEntities or Items ?
looks like chunk.Blocks.GetID(x, y, z) will not ever find 397, since its not entirely a block.
Getting the TitleEntity at a given location will find ID="Skull" however, I'm trying to match up the actual ID value (like the block id or item id or what have you)..
Interesting, It finds 144 (I should have checked that I apologize). Apparently 144 is "Mob Head" per this random minecraft Block ID lookup site: http://minecraft-ids...medgecombe.com/
So I guess the question I have is, why does it show as 397 and 144 on those sites?
Here is the blockID and Data, I get back mostly Data=1, but in 1 situation it was 5
Skull: ID=144 Data=1
Skull: ID=144 Data=5
I placed 6-10 blocks at different angles to see if it changed the block data or something. (Ignore obsidian, that was a test of Substrate to see if it worked as an API)
TileEntity te = chunk.Blocks.GetTileEntity(x, y, z);
if (te != null)
{
//te.ID is the name of it, not the ID
if (te.ID == "Skull")
{
PrintMessage("Skull: ID=" + chunk.Blocks.GetID(x, y, z) + " Data=" + chunk.Blocks.GetData(x, y, z).ToString());
}
}
The biome enumeration is matched up with the biome IDs in game, so if your generator gives you those numbers directly, you can just cast them directly to the biome enum type.
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
How do I set a wool blocks to be different colors?
Sorry I got it like a second after I posted this
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
Thanks
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
Basically
Getting AnvilChunk objects is still a challenge though. Iterating through a ChunkManager will give you ChunkRef objects behind an IChunk interface. You can use "GetChunkRef" on the IChunk object, and then cast the return value to an AnvilChunk. But when you're done with it you need to set it back with a call to "SetChunk".
This example program (https://github.com/jaquadro/Substrate/blob/master/SubstrateCS/Examples/Convert/Program.cs) does something similar, but it's actually transferring ownership of chunks between two different worlds.
The reason this is all a pain is because the API was supposed to hide the underlying data representation. You're specifically trying to pull some of those details out.
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
Seems to work quite good
I am using it to develop a tool I am calling More Interesting Minecraft (MIM) - something which adds additional structures and tinkers with existing worlds to make them more interesting.
Anyway, I noticed that somewhere between 1.6.2 and the current release substrate has broken and it doesn't appear to be able to read the level.dat file. Is this something you are aware of or do you want some more information on the problem? Is it likely to be fixed?
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
1.) the less than sign is replaced with funky characters (escape sequence I assume)>
2.) the BetaChunkManager is not found.
3.) Chunk no longer accepts zero arguments for .save();
I understand these are TileEntities or Items ?
looks like chunk.Blocks.GetID(x, y, z) will not ever find 397, since its not entirely a block.
Getting the TitleEntity at a given location will find ID="Skull" however, I'm trying to match up the actual ID value (like the block id or item id or what have you)..
Mods I Develop: Garden Stuff -- Storage Drawers -- Hunger Strike
Tools I Develop: NBTExplorer -- Substrate
And this site shows the blocks twice, once as 144 and once as 397.
http://www.minecraft....com/idlist.htm
So I guess the question I have is, why does it show as 397 and 144 on those sites?
Here is the blockID and Data, I get back mostly Data=1, but in 1 situation it was 5
Skull: ID=144 Data=1
Skull: ID=144 Data=5
I placed 6-10 blocks at different angles to see if it changed the block data or something. (Ignore obsidian, that was a test of Substrate to see if it worked as an API)