Add some extra code statements as NBT was not updating properly

This commit is contained in:
Tara 2023-01-21 19:41:10 -07:00
parent 8f475afc9f
commit 20f405a809
3 changed files with 14 additions and 6 deletions

View file

@ -5,4 +5,4 @@ org.gradle.daemon=false
mc_version=1.19.2
forge_version=43.2.3
myversion=1.0.3.1
myversion=1.0.3.2

View file

@ -56,10 +56,17 @@ public class LoreContainer {
AssertLoreExists();
// Set the Lore
ListTag lst = associatedItem.getTag().getCompound(ItemStack.TAG_DISPLAY).getList(ItemStack.TAG_LORE, Tag.TAG_STRING);
CompoundTag tag = associatedItem.getTag();
CompoundTag display = tag.getCompound(ItemStack.TAG_DISPLAY);
ListTag lore = display.getList(ItemStack.TAG_LORE, Tag.TAG_STRING);
// Set the lore entry
SetOrUpdateIndex(lst, loreEntryNumber, StringTag.valueOf(miscData.saveJson()));
SetOrUpdateIndex(lore, loreEntryNumber, StringTag.valueOf(miscData.saveJson()));
display.put(ItemStack.TAG_LORE, lore);
tag.put(ItemStack.TAG_DISPLAY, display);
associatedItem.setTag(tag);
}
private void SetOrUpdateIndex(ListTag lst, int pos, Tag insert)
@ -92,6 +99,7 @@ public class LoreContainer {
if(display==null)
{
tag.put(ItemStack.TAG_DISPLAY, new CompoundTag());
associatedItem.setTag(tag);
}
}
@ -105,8 +113,8 @@ public class LoreContainer {
{
lore = new ListTag();
display.put(ItemStack.TAG_LORE, lore);
//tag.put(ItemStack.TAG_DISPLAY, display);
//associatedItem.setTag(tag);
tag.put(ItemStack.TAG_DISPLAY, display);
associatedItem.setTag(tag);
}
}
}

View file

@ -19,7 +19,7 @@ modId="libzontreck" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
# see the associated build.gradle script for how to populate this completely automatically during a build
version="1.0.3.1" #mandatory
version="1.0.3.2" #mandatory
# A display name for the mod
displayName="LibZontreck" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/