Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[SDK] Substrate - Map editing library for C#/.NET [1.3.8]

sdk alpha beta anvil library

  • Please log in to reply
708 replies to this topic

#701

jaquadro
    jaquadro

    Lapis Lazuli Collector

  • Curse Premium
  • Curse Premium
  • 1051 posts

Posted 04 March 2014 - 01:58 PM

It should absolutely find the block ID.  What value do you get back when you ask for the ID at that location?
NBTExplorer - NBT editor for Windows and Mac
Substrate - Minecraft map editing library for C#/.NET

Register or log in to remove.

#702

Kaltinril
  • Minecraft: Kaltinril

Posted 05 March 2014 - 01:13 AM

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/

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)
Posted Image

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());
}
}


#703

jaquadro
    jaquadro

    Lapis Lazuli Collector

  • Curse Premium
  • Curse Premium
  • 1051 posts

Posted 05 March 2014 - 03:04 AM

144 is the block version.  397 is the item version.

For standard minecraft, all IDs >255 are items.
NBTExplorer - NBT editor for Windows and Mac
Substrate - Minecraft map editing library for C#/.NET

#704

Kaltinril
  • Minecraft: Kaltinril

Posted 05 March 2014 - 03:37 AM

Ok, thanks jaquadro.  That makes sense.  

What area would I see the Rotation value in (Notice each head is a different angle slightly).

I"m asking all this because, while there is a tool that exist to "convert" worlds, it felt clunky, and relied on NEI Dumps in specific formats. (mIDas and mIDas gold I believe).

My friend and I would like to create a modpack world migration toolkit and your API (as a base for loading/saving/editing the world) seems like the best choice.

For loading, saving, and editing world files:
  • We looked at Craft.Net (Using the Craft.Net.Anvil)
  • We looked at fNBT
  • We looked at the source MOJANG posted for the NBT format (The converter from alpha to Region in Java code)
  • We looked at mIDas
  • We then found your Substrate and NBT Explorer.

We made the furthest progress in proof of concept with your API.

#705

jaquadro
    jaquadro

    Lapis Lazuli Collector

  • Curse Premium
  • Curse Premium
  • 1051 posts

Posted 05 March 2014 - 06:11 AM

Substrate was purpose-built for third party world editing.  Everything else is either wrapped up in a larger project, or only tackles the lower-level NBT layers.  Though due to the way Minecraft has evolved, certain parts of the API have fallen out of date.

The rotation value of heads is stored in the block's data field.  You're already printing it in your code snippet.  It ranges 0-15, each increment represents 22 degrees to give you 360-degree coverage.  blocks.SetData(x, y, z, rotation);
NBTExplorer - NBT editor for Windows and Mac
Substrate - Minecraft map editing library for C#/.NET

#706

Kaltinril
  • Minecraft: Kaltinril

Posted 05 March 2014 - 10:13 PM

Hmm, so am I seeing only data=1 because of some sort of conversion issue?  There are enough heads at different angles I would have expected to see 6 or 7 different values.  I only see Data=1 a bunch of times, and a single time it printed Data=5.  I tested it with carpet and got 0,1,2,3,4,5,6 etc so that seems to be as expected for different types of carpet.

With respect to the API falling out of date, are there issues we can fork and assist with to get it up to date?  Again, your API seems to be the best we've found so far.

#707

jaquadro
    jaquadro

    Lapis Lazuli Collector

  • Curse Premium
  • Curse Premium
  • 1051 posts

Posted 05 March 2014 - 11:42 PM

Looks like I was actually wrong on the heads: http://minecraft.gam...ta_values#Heads
The data values are like torch data values.  They determine whether it's affixed to a wall, or on the floor.  You saw a 5 because you (accidentally?) stuck one on a wall.

http://minecraft.gam...e_Entity_Format
The skull TileEntity has a "Rot" flag.  The values range from 0-15, and they are identical to the sign data values in their meaning.

For the API, there's certain parts that I've stopped adding to, like Entities and TileEntities.  I used to create classes for each one and bind properties to all the tags.  The problem is Mojang adds these pretty frequently, and they also change them from time to time.  Manipulating the NBT tree is less convenient, but more adaptable.

If there's a part of the API that you think needs to be improved, you are certainly welcome to submit pull requests.  I usually get to them in a timely manner.
NBTExplorer - NBT editor for Windows and Mac
Substrate - Minecraft map editing library for C#/.NET

#708

Dodgyg33za

Posted 26 March 2014 - 10:59 AM

@jaquadro (sorry for the delay in responding - see previous email in Mid Feb)

I am having problems in OpenWorld->LoadLevel(). It is getting as far as:

    public virtual Level LoadTreeSafe (TagNode tree)
    {
    if (!ValidateTree(tree)) {
    return null;
    }

    return LoadTree(tree);
    }

but then failing to validate the tree (the failure is in the NbtVerifier.Verify() method. Works fine for 1.62 but fails for a newly created world with no changes.

It gets to the following line in VerifyCompound(..)

pass = Verify(tag, value, node) && pass;

iterates through successfully a few times, then pass goes false on the node "AttackTime" as the value is null.

#709

einsteinsci
  • Location: Over there
  • Minecraft: einsteinsci

Posted 03 April 2014 - 12:47 AM

You should put this on NuGet. It's a very good API.
Posted Image

I love clever mods, and I've found so many I have no room for them in this signature.