extend unlock logic to support multi-node unlock plans and update version number

This commit is contained in:
2026-05-19 23:58:54 +02:00
parent 3d54b3ffc1
commit f2aa1e82cc
10 changed files with 39 additions and 21 deletions
@@ -34,9 +34,11 @@ public class ServerboundActivateAbilityPacket {
if (player == null) return;
player.getCapability(SkillEngineCapabilities.PLAYER_SKILLS).ifPresent(data -> {
if (msg.slot < 1 || msg.slot > 3) return;
ResourceLocation abilityId = data.getAbilityInSlot(msg.slot);
if (abilityId == null) return;
if (!data.isAbilityUnlocked(abilityId)) return;
AbilityNode ability = AbilityNodeRegistry.get(abilityId);
if (ability == null) return;
@@ -1,6 +1,7 @@
package net.fretux.skillengine.network;
import net.fretux.skillengine.capability.SkillEngineCapabilities;
import net.fretux.skillengine.skilltree.AbilityNodeRegistry;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
@@ -32,9 +33,12 @@ public class ServerboundBindAbilityPacket {
ServerPlayer player = ctx.get().getSender();
if (player == null) return;
player.getCapability(SkillEngineCapabilities.PLAYER_SKILLS).ifPresent(data ->
data.bindAbility(msg.slot, msg.abilityId)
);
player.getCapability(SkillEngineCapabilities.PLAYER_SKILLS).ifPresent(data -> {
if (msg.slot < 1 || msg.slot > 3) return;
if (AbilityNodeRegistry.get(msg.abilityId) == null) return;
if (!data.isAbilityUnlocked(msg.abilityId)) return;
data.bindAbility(msg.slot, msg.abilityId);
});
PacketHandler.syncSkillsTo(player);
});
ctx.get().setPacketHandled(true);