How to force string ID or ignore/change schema?
Hazerd opened this issue · 0 comments
(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 asminecraft: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 changeitem["id"]
to438
(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
withid:"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);