Fix a index out of bounds error
This commit is contained in:
parent
de66f0b7ca
commit
8f475afc9f
3 changed files with 12 additions and 3 deletions
|
@ -5,4 +5,4 @@ org.gradle.daemon=false
|
||||||
|
|
||||||
mc_version=1.19.2
|
mc_version=1.19.2
|
||||||
forge_version=43.2.3
|
forge_version=43.2.3
|
||||||
myversion=1.0.3.0
|
myversion=1.0.3.1
|
|
@ -59,7 +59,16 @@ public class LoreContainer {
|
||||||
ListTag lst = associatedItem.getTag().getCompound(ItemStack.TAG_DISPLAY).getList(ItemStack.TAG_LORE, Tag.TAG_STRING);
|
ListTag lst = associatedItem.getTag().getCompound(ItemStack.TAG_DISPLAY).getList(ItemStack.TAG_LORE, Tag.TAG_STRING);
|
||||||
|
|
||||||
// Set the lore entry
|
// Set the lore entry
|
||||||
lst.set(loreEntryNumber, StringTag.valueOf(miscData.saveJson()));
|
SetOrUpdateIndex(lst, loreEntryNumber, StringTag.valueOf(miscData.saveJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetOrUpdateIndex(ListTag lst, int pos, Tag insert)
|
||||||
|
{
|
||||||
|
if(lst.size() <= pos){
|
||||||
|
lst.add(insert);
|
||||||
|
// Update the loreEntryNumber
|
||||||
|
loreEntryNumber = lst.indexOf(insert);
|
||||||
|
}else lst.set(pos, insert);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AssertLoreExists()
|
private void AssertLoreExists()
|
||||||
|
|
|
@ -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
|
# 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
|
# ${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
|
# see the associated build.gradle script for how to populate this completely automatically during a build
|
||||||
version="1.0.3.0" #mandatory
|
version="1.0.3.1" #mandatory
|
||||||
# A display name for the mod
|
# A display name for the mod
|
||||||
displayName="LibZontreck" #mandatory
|
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/
|
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||||
|
|
Reference in a new issue