diff --git a/LATEST_CHANGES.MD b/LATEST_CHANGES.MD index e410c9a19..fdb960d4a 100644 --- a/LATEST_CHANGES.MD +++ b/LATEST_CHANGES.MD @@ -11,6 +11,8 @@ - Fixed Projectiles not being able to go through portals - Fixed client crash caused by upgrading curio items on a dedicated server - Fixed mismatched Russian translations between versions +- Fixed tooltip index operation potentially being out of bounds with other mod's editing the tooltip at the same time +- Fixed Arrow Volley spell's sub-arrows not keeping track of the original caster ### API - diff --git a/src/main/java/io/redspace/ironsspellbooks/entity/spells/ArrowVolleyEntity.java b/src/main/java/io/redspace/ironsspellbooks/entity/spells/ArrowVolleyEntity.java index 24fcf9b55..24f3014c1 100644 --- a/src/main/java/io/redspace/ironsspellbooks/entity/spells/ArrowVolleyEntity.java +++ b/src/main/java/io/redspace/ironsspellbooks/entity/spells/ArrowVolleyEntity.java @@ -44,6 +44,7 @@ public void tick() { var spawn = this.position().add(orth.scale(distance)); arrow.setPos(spawn); arrow.shoot(motion.add(Utils.getRandomVec3(.04f))); + arrow.setOwner(this.getOwner()); level.addFreshEntity(arrow); MagicManager.spawnParticles(level, ParticleTypes.FIREWORK, spawn.x, spawn.y, spawn.z, 2, .1, .1, .1, .05, false); } diff --git a/src/main/java/io/redspace/ironsspellbooks/player/ClientPlayerEvents.java b/src/main/java/io/redspace/ironsspellbooks/player/ClientPlayerEvents.java index 12923e7a0..ae9b77e70 100644 --- a/src/main/java/io/redspace/ironsspellbooks/player/ClientPlayerEvents.java +++ b/src/main/java/io/redspace/ironsspellbooks/player/ClientPlayerEvents.java @@ -179,7 +179,7 @@ public static void imbuedWeaponTooltips(ItemTooltipEvent event) { //Keybind notification additionalLines.add(Component.literal(" ").append(Component.translatable("tooltip.irons_spellbooks.press_to_cast_active", Component.keybind("key.use")).withStyle(ChatFormatting.GOLD))); int i = event.getFlags().isAdvanced() ? TooltipsUtils.indexOfAdvancedText(lines, stack) : lines.size(); - lines.addAll(i, additionalLines); + lines.addAll(i < 0 ? lines.size() : i, additionalLines); } } else if (ISpellContainer.isSpellContainer(stack) && !(stack.getItem() instanceof SpellBook)) { var spellContainer = ISpellContainer.get(stack); @@ -195,7 +195,7 @@ public static void imbuedWeaponTooltips(ItemTooltipEvent event) { }); //Add header to sword tooltip additionalLines.add(1, Component.translatable("tooltip.irons_spellbooks.imbued_tooltip").withStyle(ChatFormatting.GRAY)); - lines.addAll(i, additionalLines); + lines.addAll(i < 0 ? lines.size() : i, additionalLines); } // if (spellContainer.getActiveSpellCount() < spellContainer.getMaxSpellCount()) { // var component = Component.translatable("tooltip.irons_spellbooks.can_be_imbued", spellContainer.getActiveSpellCount(), spellContainer.getMaxSpellCount());