Implement a number of small fixes

This commit is contained in:
2025-12-17 11:56:14 +01:00
parent ac334ccd6d
commit a88364d190
4 changed files with 24 additions and 4 deletions
@@ -20,11 +20,11 @@ public final class SkillEngineAPI {
private SkillEngineAPI() {}
public static ResourceLocation id(String path) {
return new ResourceLocation(SkillEngine.MODID, path);
return ResourceLocation.fromNamespaceAndPath(SkillEngine.MODID, path);
}
public static ResourceLocation rl(String namespace, String path) {
return new ResourceLocation(namespace, path);
return ResourceLocation.fromNamespaceAndPath(namespace, path);
}
public static SkillNode getSkillNode(ResourceLocation id) {
@@ -451,7 +451,16 @@ public class SkilltreeScreen extends Screen {
} else if (unlocked) {
color = 0xFF44CC44;
} else {
color = 0xFF444444;
int cost = node.getCost();
if (cost <= 1) {
color = 0xFF444444;
} else if (cost == 2) {
color = 0xFFFF6633;
} else if (cost == 3) {
color = 0xFF33CCCC;
} else {
color = 0xFFFFD700;
}
}
return color;
}
@@ -32,6 +32,17 @@ public class SkillEnginePlayerEvents {
}
}
@SubscribeEvent
public static void onClone(PlayerEvent.Clone event) {
if (event.getEntity() instanceof ServerPlayer newPlayer && event.getOriginal() instanceof ServerPlayer oldPlayer) {
oldPlayer.getCapability(SkillEngineCapabilities.PLAYER_SKILLS).ifPresent(oldData ->
newPlayer.getCapability(SkillEngineCapabilities.PLAYER_SKILLS).ifPresent(newData -> {
newData.load(oldData.save());
})
);
}
}
@SubscribeEvent
public static void onRespawn(PlayerEvent.PlayerRespawnEvent event) {
if (event.getEntity() instanceof ServerPlayer player) {