diff --git a/CommonLib.csproj b/CommonLib.csproj index e4f233f..af909fd 100644 --- a/CommonLib.csproj +++ b/CommonLib.csproj @@ -1,6 +1,8 @@ - net8 + net10.0 + false + bin/$(Configuration)/Mods/CommonLib true latest enable @@ -13,7 +15,35 @@ CS1591 + + $(VINTAGE_STORY) + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Config/ConfigUtil.cs b/Config/ConfigUtil.cs index 6eb646b..aa4d083 100644 --- a/Config/ConfigUtil.cs +++ b/Config/ConfigUtil.cs @@ -107,11 +107,11 @@ public static void ValidateConfig(ICoreAPI api, Type type, ref object config, IL if (checkerAttr != null) { var value = prop.GetValue(config); - if (!checkerAttr.Check(api, (IComparable)value)) + if (!checkerAttr.Check(api, (IComparable)value!)) { if (checkerAttr is RangeAttribute rangeAttr) { - var clampedValue = rangeAttr.ClampRange((IComparable)value); + var clampedValue = rangeAttr.ClampRange((IComparable)value!); if (clampedValue != value) { logger.Warning($"{type.FullName}.{prop.Name} value {value} out of bounds, set to {clampedValue}"); @@ -188,7 +188,7 @@ public static object ConvertType(object value, Type type, object? defaultValue) if (type.IsArray) { var list = (IList)value; - var elementType = type.GetElementType(); + var elementType = type.GetElementType()!; var convertedArray = Array.CreateInstance(elementType, list.Count); for (int i = 0; i < list.Count; i++) { diff --git a/Extensions/ParsersExtensions.cs b/Extensions/ParsersExtensions.cs index d3fd0df..5baf1fe 100644 --- a/Extensions/ParsersExtensions.cs +++ b/Extensions/ParsersExtensions.cs @@ -68,7 +68,7 @@ public override string[] GetValidRange(CmdArgs args) return api.World.AllPlayers.Select((IPlayer p) => p.PlayerName).ToArray(); } - public override object? GetValue() + public override object GetValue() { return player; } diff --git a/Mod.xml b/Mod.xml deleted file mode 100644 index 2a491fa..0000000 --- a/Mod.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - CommonLib - commonlib - 2.8.0 - DArkHekRoMaNT - 1.21.0 - 1.21.1 - false - true - - - - - - - diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index 3d667ff..cf25ffd 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -2,27 +2,27 @@ "profiles": { "Client": { "commandName": "Executable", - "executablePath": "%VINTAGE_STORY%/$(GameVersion)/Vintagestory.exe", - "commandLineArgs": "--addModPath $(ModsDir) --addOrigin $(AssetsDir) --tracelog", - "workingDirectory": "%VINTAGE_STORY%/$(GameVersion)" + "executablePath": "$(VINTAGE_STORY)/$(GameVersion)/Vintagestory.exe", + "commandLineArgs": "--addModPath \"$(MSBuildProjectDirectory)/bin/$(Configuration)/Mods\" --tracelog", + "workingDirectory": "$(VINTAGE_STORY)" }, "Test World": { "commandName": "Executable", - "executablePath": "%VINTAGE_STORY%/$(GameVersion)/Vintagestory.exe", - "commandLineArgs": "--playStyle \"preset-surviveandbuild\" --openWorld \"$(ProjectName) Test World\" --addModPath $(ModsDir) --addOrigin $(AssetsDir) --tracelog", - "workingDirectory": "%VINTAGE_STORY%/$(GameVersion)" + "executablePath": "$(VINTAGE_STORY)/$(GameVersion)/Vintagestory.exe", + "commandLineArgs": "--playStyle \"preset-surviveandbuild\" --openWorld \"$(MSBuildProjectName) Test World\" --addModPath \"$(MSBuildProjectDirectory)/bin/$(Configuration)/Mods\" --tracelog", + "workingDirectory": "$(VINTAGE_STORY)" }, "Test World (Flat)": { "commandName": "Executable", - "executablePath": "%VINTAGE_STORY%/$(GameVersion)/Vintagestory.exe", - "commandLineArgs": "--openWorld \"$(ProjectName) Test World\" --addModPath $(ModsDir) --addOrigin $(AssetsDir) --tracelog", - "workingDirectory": "%VINTAGE_STORY%/$(GameVersion)" + "executablePath": "$(VINTAGE_STORY)/$(GameVersion)/Vintagestory.exe", + "commandLineArgs": "--openWorld \"$(MSBuildProjectName) Test World\" --addModPath \"$(MSBuildProjectDirectory)/bin/$(Configuration)/Mods\" --tracelog", + "workingDirectory": "$(VINTAGE_STORY)" }, "Server": { "commandName": "Executable", - "executablePath": "%VINTAGE_STORY%/$(GameVersion)/VintagestoryServer.exe", - "commandLineArgs": "--addModPath $(ModsDir) --addOrigin $(AssetsDir) --tracelog", - "workingDirectory": "%VINTAGE_STORY%/$(GameVersion)" + "executablePath": "$(VINTAGE_STORY)/$(GameVersion)/VintagestoryServer.exe", + "commandLineArgs": "--addModPath \"$(MSBuildProjectDirectory)/bin/$(Configuration)/Mods\" --tracelog", + "workingDirectory": "$(VINTAGE_STORY)" } } } diff --git a/Utils/WorldUtil.cs b/Utils/WorldUtil.cs index cb9cee9..1bd933e 100644 --- a/Utils/WorldUtil.cs +++ b/Utils/WorldUtil.cs @@ -13,7 +13,7 @@ public static class WorldUtil /// public static CollectibleObject GetCollectibleObject(this IWorldAccessor world, AssetLocation code) { - return (CollectibleObject)world.GetItem(code) ?? world.GetBlock(code); + return (CollectibleObject?)world.GetItem(code) ?? world.GetBlock(code)!; } /// diff --git a/modinfo.json b/modinfo.json new file mode 100644 index 0000000..ee5bf24 --- /dev/null +++ b/modinfo.json @@ -0,0 +1,10 @@ +{ + "type": "Code", + "name": "CommonLib", + "modid": "commonlib", + "version": "3.0.0", + "authors": ["DArkHekRoMaNT"], + "dependencies": { + "game": "1.22.0" + } +}