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
+1 -1
View File
@@ -48,7 +48,7 @@ mod_name=Fretux's Skill Engine
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved mod_license=All Rights Reserved
# The mod version. See https://semver.org/ # The mod version. See https://semver.org/
mod_version=1.2.4 mod_version=1.2.5
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html
@@ -20,11 +20,11 @@ public final class SkillEngineAPI {
private SkillEngineAPI() {} private SkillEngineAPI() {}
public static ResourceLocation id(String path) { 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) { public static ResourceLocation rl(String namespace, String path) {
return new ResourceLocation(namespace, path); return ResourceLocation.fromNamespaceAndPath(namespace, path);
} }
public static SkillNode getSkillNode(ResourceLocation id) { public static SkillNode getSkillNode(ResourceLocation id) {
@@ -451,7 +451,16 @@ public class SkilltreeScreen extends Screen {
} else if (unlocked) { } else if (unlocked) {
color = 0xFF44CC44; color = 0xFF44CC44;
} else { } else {
int cost = node.getCost();
if (cost <= 1) {
color = 0xFF444444; color = 0xFF444444;
} else if (cost == 2) {
color = 0xFFFF6633;
} else if (cost == 3) {
color = 0xFF33CCCC;
} else {
color = 0xFFFFD700;
}
} }
return color; 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 @SubscribeEvent
public static void onRespawn(PlayerEvent.PlayerRespawnEvent event) { public static void onRespawn(PlayerEvent.PlayerRespawnEvent event) {
if (event.getEntity() instanceof ServerPlayer player) { if (event.getEntity() instanceof ServerPlayer player) {