Skip to content

Commit

Permalink
fix: Fixed Words of Unbinding randomly choosing the upgrade to remove…
Browse files Browse the repository at this point in the history
… while holding a off-hand upgrade scroll. This only affected wand upgrade scrolls added by Ancient Spellcraft. Fixes #202
  • Loading branch information
WinDanesz committed Jun 7, 2024
1 parent 472e1f4 commit d07ed57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ public static boolean removeUpgrade(EntityPlayer player, ItemStack wand, @Nullab

String upgradeString = upgrade.getRegistryName().getPath().replace("_upgrade", "");

// AS upgrades have a _suffix, but I won't fix this now as it would break existing worlds, this is a bit ugly but won't cause a breaking change
if (upgrade.getRegistryName().getNamespace().toString().equals(AncientSpellcraft.MODID)) {
upgradeString += "_upgrade";
}

if (upgrades.hasKey(upgradeString)) {
int counter = upgrades.getInteger(upgradeString);
counter--;
Expand Down Expand Up @@ -174,7 +179,7 @@ private static void removeRandomUpgrade(EntityPlayer player, ItemStack wand, boo
upgrades.removeTag(upgradeToDecrease);
}

if (upgradeToDecrease.equals("attunement")) {
if (upgradeToDecrease.equals("attunement")) {
if (wand.getItem() instanceof IWorkbenchItem) {
Spell[] spells = WandHelper.getSpells(wand);
Spell[] newSpells = new Spell[((IWorkbenchItem) wand.getItem()).getSpellSlotCount(wand)];
Expand Down

0 comments on commit d07ed57

Please sign in to comment.