Add Barrier Reflection!

This commit is contained in:
Kam committed 2026-02-23 00:17:34 -05:00
1 parent b5534b4a39
commit adf9cd7012
19 files changed
+792 -61

No files matched your search

@@ -104,9 +104,13 @@ public class ClientEventHandler {
int hudKeyCode = ClientProxy.AbilityHudKey.getKeyCode();
boolean hudKeyHeld = false;
if (hudKeyCode > 0) {
hudKeyHeld = org.lwjgl.input.Keyboard.isKeyDown(hudKeyCode);
hudKeyHeld = hudKeyCode < org.lwjgl.input.Keyboard.getKeyCount()
&& org.lwjgl.input.Keyboard.isKeyDown(hudKeyCode);
} else if (hudKeyCode < 0) {
hudKeyHeld = org.lwjgl.input.Mouse.isButtonDown(hudKeyCode + 100);
int mouseButton = hudKeyCode + 100;
hudKeyHeld = mouseButton >= 0
&& mouseButton < org.lwjgl.input.Mouse.getButtonCount()
&& org.lwjgl.input.Mouse.isButtonDown(mouseButton);
}
if (hudKeyHeld) {
AbilityHotbarComponent comp = (AbilityHotbarComponent) ClientHudManager.getInstance()
@@ -604,7 +604,20 @@ public class AbilityHotbarComponent extends HudComponent {
private boolean isHudKeyHeld() {
if (ClientProxy.AbilityHudKey == null) return false;
int keyCode = ClientProxy.AbilityHudKey.getKeyCode();
return keyCode != 0 && org.lwjgl.input.Keyboard.isKeyDown(keyCode);
if (keyCode == 0 || keyCode == -1) return false;
// Mouse bindings are encoded as negative key codes (offset by 100).
if (keyCode < -1) {
int mouseButton = keyCode + 100;
return mouseButton >= 0
&& mouseButton < org.lwjgl.input.Mouse.getButtonCount()
&& org.lwjgl.input.Mouse.isButtonDown(mouseButton);
}
// Guard against invalid/out-of-range keyboard codes to avoid Buffer.checkIndex crashes.
return keyCode > 0
&& keyCode < org.lwjgl.input.Keyboard.getKeyCount()
&& org.lwjgl.input.Keyboard.isKeyDown(keyCode);
}
public boolean hasAnyAbilities() {
@@ -121,6 +121,22 @@ public class ScriptEnergyBarrier<T extends EntityAbilityBarrier> extends ScriptE
entity.getBarrierData().absorbing = absorbing;
}
public boolean isReflect() {
return entity.getBarrierData().reflect;
}
public void setReflect(boolean reflect) {
entity.getBarrierData().reflect = reflect;
}
public float getReflectStrengthPct() {
return entity.getBarrierData().reflectStrengthPct;
}
public void setReflectStrengthPct(float strengthPct) {
entity.getBarrierData().setReflectStrengthPct(strengthPct);
}
public int getBarrierType() {
return entity instanceof EntityAbilityDome ? 0 : 1;
}