Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
Fix Key Pressed with continuous keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
MerchantPug committed May 18, 2024
1 parent deb16cb commit 79e1ece
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 8 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
## Bugfixes
- Fixed `damage_nearby_x_hit` power type running attacker, target bientity conditions without an attacker. ([toomanyorigins#87](https://github.com/MerchantPug/toomanyorigins/issues/87))
- Fixed `damage_nearby_x_hit` power type running attacker, target bientity conditions without an attacker. ([toomanyorigins#87](https://github.com/MerchantPug/toomanyorigins/issues/87))
- Fixed Explosion Sync packet desync. Which should affect the `apugli:explode` and `explosion_raycast` entity action types, and the `rocket_jump` power type.
- Fixed `key_pressed` entity condition type not functioning properly with `continuous` keys.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"type": "apoli:action_over_time",
"interval": 1,
"entity_action": {
"type": "apugli:explode",
"power": 5,
"damage_self": false
},
"condition": {
"type": "apoli:and",
"conditions": [
{
"type": "apoli:or",
"conditions": [
{
"type": "apoli:block_collision",
"offset_x": 1.5
},
{
"type": "apoli:block_collision",
"offset_x": -1.5
},
{
"type": "apoli:block_collision",
"offset_y": 1.5
},
{
"type": "apoli:block_collision",
"offset_y": -1.5
},
{
"type": "apoli:block_collision",
"offset_z": 1.5
},
{
"type": "apoli:block_collision",
"offset_z": -1.5
}
]
},
{
"type": "apoli:fall_flying"
},
{
"type": "apugli:key_pressed",
"key": {
"key": "key.use",
"continous": true
}
}
]
},
"hidden": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientLoginConnectionEvents;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.merchantpug.apugli.client.renderer.CustomProjectileRenderer;
import net.merchantpug.apugli.client.util.TextureUtilClient;
import net.merchantpug.apugli.component.ApugliEntityComponents;
import net.merchantpug.apugli.component.KeyPressComponent;
import net.merchantpug.apugli.condition.factory.entity.CachedBlockInRadiusCondition;
import net.merchantpug.apugli.integration.pehkui.PehkuiUtil;
import net.merchantpug.apugli.mixin.fabric.client.accessor.ApoliClientAccessor;
import net.merchantpug.apugli.network.ApugliPackets;
import net.merchantpug.apugli.network.c2s.UpdateKeysPressedPacket;
Expand Down Expand Up @@ -70,12 +67,12 @@ public static void handleActiveKeys(Minecraft minecraft) {
if (!currentKeyBindingStates.containsKey(key.key)) {
currentKeyBindingStates.put(key.key, keyBinding.isDown());
}
if (currentKeyBindingStates.get(key.key) && (key.continuous || !lastKeyBindingStates.getOrDefault(key.key, false))) {
if (currentKeyBindingStates.getOrDefault(key.key, false) && (key.continuous || !lastKeyBindingStates.getOrDefault(key.key, false))) {
component.addKey(key);
if (!lastKeyBindingStates.getOrDefault(key.key, false)) {
addedKeys.add(key);
}
} else if ((!currentKeyBindingStates.get(key.key) || !key.continuous) && lastKeyBindingStates.getOrDefault(key.key, false)) {
} else if (!currentKeyBindingStates.getOrDefault(key.key, false) && lastKeyBindingStates.getOrDefault(key.key, false)) {
component.removeKey(key);
removedKeys.add(key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ public static void handleActiveKeys() {
if (!currentKeyBindingStates.containsKey(key.key())) {
currentKeyBindingStates.put(key.key(), keyBinding.isDown());
}
if (currentKeyBindingStates.get(key.key()) && (key.continuous() || !lastKeyBindingStates.getOrDefault(key.key(), false))) {
if (currentKeyBindingStates.getOrDefault(key.key(), false) && (key.continuous() || !lastKeyBindingStates.getOrDefault(key.key(), false))) {
capability.addKey(key);
if (!lastKeyBindingStates.getOrDefault(key.key(), false)) {
addedKeys.add(key);
}
} else if ((!currentKeyBindingStates.get(key.key()) || !key.continuous()) && lastKeyBindingStates.getOrDefault(key.key(), false)) {
} else if (!currentKeyBindingStates.getOrDefault(key.key(), false) && lastKeyBindingStates.getOrDefault(key.key(), false)) {
capability.removeKey(key);
removedKeys.add(key);
}
Expand Down

0 comments on commit 79e1ece

Please sign in to comment.