You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The explanations are vague, i can't reproduce it in dev.
Some say their spells cast by themselves when it bugs out, others say it casts the wrong spell
I've tried looking at it, I just have a question on why there's two loops?
// Current problematic code
for (SpellKeybind key : keys) {
if (key.key.isDown()) {
number = key.getIndex();
}
}
for (SpellKeybind key : keys) {
if (key.key.getKeyModifier() != KeyModifier.NONE && key.key.isDown()) {
number = key.getIndex();
}
}
private static SpellKeybind lastPressedKey = null;
private static long lastPressTime = 0;
private static final long KEY_DEBOUNCE_MS = 50; // 50ms debounce
// Single pass to check for pressed keys
for (SpellKeybind key : keys) {
if (key.key.isDown()) {
// Only process if the key wasn't the last pressed key or enough time has passed
if (key != lastPressedKey || (currentTime - lastPressTime) > KEY_DEBOUNCE_MS) {
boolean isModifierPressed = key.key.getKeyModifier().isActive();
if (key.key.getKeyModifier() == KeyModifier.NONE || isModifierPressed) {
currentPressed = key;
spellIndex = key.getIndex();
break; // Only process one key at a time
}
}
} else if (key == lastPressedKey) {
// Reset last pressed key when it's released
lastPressedKey = null;
}
}
Wouldn't it be better with a single loop something like this in a way?
Describe the bug you're experiencing
The explanations are vague, i can't reproduce it in dev.
Some say their spells cast by themselves when it bugs out, others say it casts the wrong spell
Attempted to fix by consuming the keys in https://github.com/RobertSkalko/Mine-And-Slash-Rework/blob/9a9643107e05897113b8dcda836e0d57f4738ba1/src/main/java/com/robertx22/mine_and_slash/event_hooks/player/OnKeyPress.java
Still seems to happen
Reproducability
No clue
Mod up to date
Tested Without Custom Mine and Slash Datapacks
Mine and Slash version
5.9.34
Logs
none
The text was updated successfully, but these errors were encountered: