Iron's Spells 'n Spellbooks

Iron's Spells 'n Spellbooks

10M Downloads

[Bug] Players can cast spells while bleeding from PlayerRevive mod

CreativeMD opened this issue ยท 8 comments

commented

Hey there,

I'm the author of PlayerRevive and someone reported an issue with your mod: CreativeMD/PlayerRevive#143

During bleedout state of the PlayerRevive mod, you are still able to cast spells, which should be blocked. In theory PlayerRevive blocks all interactions using the event InteractionKeyMappingTriggered. Seems like IronSpells does ignore this event somehow?

Steps to reproduce

  1. Open singleplayer world
  2. Open to LAN
  3. Type in /kill
  4. Do spells

In Regards
CreativeMD

commented

I cannot cancel all key and mouse input, this will break the game entirely. Furthermore these specific events cannot be cancelled. Not sure why you do things as you do, but I think it would be better if you rely on the vanilla interaction stuff. If not possible I don't see any solution to the problem besides a check if the player is downed. I could make this easily accessible for you to check, but not sure if you want to go down that route.

commented

spell casting is not done via item interaction, but on any keypress

commented

What would be necessary to block this as well?

commented

cancelling all key/mouse input, or including specific compat. more might be gleaned from our input handler https://github.com/iron431/irons-spells-n-spellbooks/blob/1.19.2/src/main/java/io/redspace/ironsspellbooks/player/ClientInputEvents.java

commented

You can subscribe to the SpellCastEvent and cancel it to prevent casting while in that state

commented

I don't think this is a good fix. I hoped we could figure out a more general solution which other mods could use as well.

commented

what if you made the revival sequence a GUI with a revival button and a respawn button?

commented

I could add a new method to the Player to check whether the player should be allowed to interact. This method could be accessed via reflection. @lab3 if you agree I can create a pull request for it, too.