Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to force string ID or ignore/change schema? #59

Open
Hazerd opened this issue Apr 19, 2019 · 0 comments
Open

How to force string ID or ignore/change schema? #59

Hazerd opened this issue Apr 19, 2019 · 0 comments

Comments

@Hazerd
Copy link

Hazerd commented Apr 19, 2019

(Edit: I'm looking through past commits to the 2.x branch and finding that NameIDs were added, but I'm not finding any way to make items use the NameID. Still looking.)

(Edit2: So apparently, Item.ID is the NameID, but I can't find an instance of splash_potion in the entire repository. I'll experiment with a fork and see what I can figure out in the meantime.)

I'm trying to convert old custom maps (from as far back as 1.2.5) to 1.13.2. The only issue I am running into is with potions.

  • If I don't touch them, they will convert up to 1.12 automatically. However, in 1.13 they turn into water bottles.
  • If I set item["tag"]["Potion"] to the 1.9+ potion effect string ID (such as minecraft:regeneration), the potions work even in 1.13, but splash potions turn into regular potions (breaking potion dispenser traps).
  • If I set item["tag"]["Potion"] appropriately, and change item["id"] to 438 (the numerical ID of splash potions, as of 1.9), all splash potions disappear completely.
  • If I perform the above, then use NBTExplorer to replace all instances of id:438 with id:"minecraft:splash_potion" everything works perfectly.

If I can change a short ID to a string ID in NBTExplorer, I should be able to do the same with Substrate, but every way I've tried either results in cannot cast string to short or the current block type is incompatible with the given Tile Entity

Here's the relevant snippet of my code, is there something I am doing wrong?

TileEntity te = chunk.Blocks.GetTileEntity(x, y, z);
TagNodeCompound nbt = te.BuildTree().ToTagCompound();
foreach (TagNode items in nbt["Items"].ToTagList())
  {
    TagNodeCompound item = items.ToTagCompound();
    if (item != null && item["id"].ToTagShort() == ItemType.POTION)
    {
      // *snip* Determine which potion it is *snip*
      item["tag"] = new TagNodeCompound();
      item["tag"].ToTagCompound()["Potion"] = new TagNodeString("minecraft:"+potionPrefix+potionEffect);
      item["id"] = new TagNodeString(potionId);
    }
    chunk.Blocks.SetTileEntity(x, y, z, te);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant