diff --git a/.gitignore b/.gitignore index cc44a45..f3d335e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,12 @@ +usefulstuff*.csproj +usefulstuff*.csproj.user +usefulstuff*.dll +usefulstuff*.pdb +screenshots +/bin/Debug Normal +/obj/Debug Normal + + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. diff --git a/BlockAnimTest/BlockAnimTest.csproj b/BlockAnimTest/BlockAnimTest.csproj index e3fc6e1..774a59a 100644 --- a/BlockAnimTest/BlockAnimTest.csproj +++ b/BlockAnimTest/BlockAnimTest.csproj @@ -9,9 +9,10 @@ Properties BlockAnimTest BlockAnimTest - v4.5.2 + v4.8 512 true + true diff --git a/BlockPhysics/StandaloneBlockPhysics.csproj b/BlockPhysics/StandaloneBlockPhysics.csproj index 065f1eb..2168e20 100644 --- a/BlockPhysics/StandaloneBlockPhysics.csproj +++ b/BlockPhysics/StandaloneBlockPhysics.csproj @@ -9,9 +9,10 @@ Properties StandAloneBlockPhysics BlockPhysics - v4.5.2 + v4.8 512 true + true diff --git a/CivMods/CivMods.csproj b/CivMods/CivMods.csproj index 18c0457..4fb135e 100644 --- a/CivMods/CivMods.csproj +++ b/CivMods/CivMods.csproj @@ -9,9 +9,10 @@ Properties CivMods CivMods - v4.5.2 + v4.8 512 true + true diff --git a/Collectible Exchange/Collectible Exchange.csproj b/Collectible Exchange/Collectible Exchange.csproj index 20c0c2e..66f76a3 100644 --- a/Collectible Exchange/Collectible Exchange.csproj +++ b/Collectible Exchange/Collectible Exchange.csproj @@ -9,9 +9,10 @@ Properties Collectible_Exchange Collectible Exchange - v4.5.2 + v4.8 512 true + true diff --git a/CustomGLSetter/CustomGLSetter.csproj b/CustomGLSetter/CustomGLSetter.csproj index a13de90..79df994 100644 --- a/CustomGLSetter/CustomGLSetter.csproj +++ b/CustomGLSetter/CustomGLSetter.csproj @@ -9,7 +9,7 @@ Properties CustomGLSetter CustomGLSetter - v4.5.2 + v4.8 512 true publish\ @@ -27,6 +27,7 @@ false false true + true diff --git a/CustomGLSetter/app.config b/CustomGLSetter/app.config index 6a33c1c..f9bfadc 100644 --- a/CustomGLSetter/app.config +++ b/CustomGLSetter/app.config @@ -1,18 +1,18 @@ - + - - + + - - + + - + - \ No newline at end of file + diff --git a/CustomMeshMod/CustomMeshMod.csproj b/CustomMeshMod/CustomMeshMod.csproj index c091d0e..1877234 100644 --- a/CustomMeshMod/CustomMeshMod.csproj +++ b/CustomMeshMod/CustomMeshMod.csproj @@ -9,11 +9,12 @@ Properties CustomMeshMod CustomMeshMod - v4.5.2 + v4.8 512 true + true diff --git a/DeepOreBits/DeepOreBits.csproj b/DeepOreBits/DeepOreBits.csproj index 3115683..1bd1cf7 100644 --- a/DeepOreBits/DeepOreBits.csproj +++ b/DeepOreBits/DeepOreBits.csproj @@ -9,9 +9,10 @@ Properties DeepOreBits DeepOreBits - v4.5.2 + v4.8 512 true + true diff --git a/GravelSandFix/GravelSandFix.csproj b/GravelSandFix/GravelSandFix.csproj index ce250d0..2157f68 100644 --- a/GravelSandFix/GravelSandFix.csproj +++ b/GravelSandFix/GravelSandFix.csproj @@ -9,9 +9,10 @@ Properties GravelSandFix GravelSandFix - v4.6.1 + v4.8 512 true + true diff --git a/HarvestCraftLoader/HarvestCraftLoader.csproj b/HarvestCraftLoader/HarvestCraftLoader.csproj index 8f8e0b0..841e01c 100644 --- a/HarvestCraftLoader/HarvestCraftLoader.csproj +++ b/HarvestCraftLoader/HarvestCraftLoader.csproj @@ -9,7 +9,7 @@ Properties HarvestCraftLoader HarvestCraftLoader - v4.6.1 + v4.8 512 true diff --git a/Instruments/Instruments.csproj b/Instruments/Instruments.csproj index 110a710..ad4df2f 100644 --- a/Instruments/Instruments.csproj +++ b/Instruments/Instruments.csproj @@ -9,9 +9,10 @@ Properties Instruments Instruments - v4.5.2 + v4.8 512 true + true diff --git a/ItemSorting/ItemSorting.csproj b/ItemSorting/ItemSorting.csproj index a626343..4d5b768 100644 --- a/ItemSorting/ItemSorting.csproj +++ b/ItemSorting/ItemSorting.csproj @@ -9,9 +9,10 @@ Properties ItemSorting ItemSorting - v4.5.2 + v4.8 512 true + true diff --git a/JarLoaderTest/JarLoaderTest.csproj b/JarLoaderTest/JarLoaderTest.csproj index f5e5db0..e83f3c4 100644 --- a/JarLoaderTest/JarLoaderTest.csproj +++ b/JarLoaderTest/JarLoaderTest.csproj @@ -9,7 +9,7 @@ Properties JarLoader JarLoader - v4.6.1 + v4.8 512 true diff --git a/LightingForReshade/LightingForReshade.csproj b/LightingForReshade/LightingForReshade.csproj index f59f67a..b773dc0 100644 --- a/LightingForReshade/LightingForReshade.csproj +++ b/LightingForReshade/LightingForReshade.csproj @@ -9,7 +9,7 @@ Properties LightingForReshade LightingForReshade - v4.6.1 + v4.8 512 true diff --git a/RandomTests/RandomTests.csproj b/RandomTests/RandomTests.csproj index ed5cf09..170d802 100644 --- a/RandomTests/RandomTests.csproj +++ b/RandomTests/RandomTests.csproj @@ -9,7 +9,7 @@ Properties RandomTests RandomTests - v4.6.2 + v4.8 512 true diff --git a/ShaderLoader/Shaders.csproj b/ShaderLoader/Shaders.csproj index 147d26b..9fab8fa 100644 --- a/ShaderLoader/Shaders.csproj +++ b/ShaderLoader/Shaders.csproj @@ -6,7 +6,7 @@ Library false OthographicShadersLoader - v4.5.2 + v4.8 512 diff --git a/SwingingDoorMod/SwingingDoorMod.csproj b/SwingingDoorMod/SwingingDoorMod.csproj index 6e4eb90..6600ae9 100644 --- a/SwingingDoorMod/SwingingDoorMod.csproj +++ b/SwingingDoorMod/SwingingDoorMod.csproj @@ -9,11 +9,12 @@ Properties SwingingDoorMod SwingingDoorMod - v4.5.2 + v4.8 512 true + true diff --git a/VSHUD/Commands/CommandPlacementPreview.cs b/VSHUD/Commands/CommandPlacementPreview.cs index 3ffc411..520e84a 100644 --- a/VSHUD/Commands/CommandPlacementPreview.cs +++ b/VSHUD/Commands/CommandPlacementPreview.cs @@ -1,10 +1,43 @@ using Vintagestory.API.Client; +using Vintagestory.API.Common; +using Vintagestory.API.Common.CommandAbbr; using Vintagestory.API.MathTools; namespace VSHUD { public class CommandPlacementPreview : VSHUDCommand { + + protected void RegisterCommands(ICoreClientAPI capi) + { + var parsers = capi.ChatCommands.Parsers; + + capi.ChatCommands + .GetOrCreate("pconfig") + .IgnoreAdditionalArgs() + .WithDesc("Configure placement preview.") + .HandleWith(_ => TextCommandResult.Error("Specify subcommand.")) + .BeginSub("show") + .WithDesc("Switches placement preview on/off") + .WithArgs(parsers.OptionalBool("on/off")) + .HandleWith(TogglePlacementPreview) + .EndSub() + .BeginSub("tint") + .WithDesc("Switches tinting placement preview meshes on/off") + .WithArgs(parsers.OptionalBool("on/off")) + .HandleWith(TogglePlacementPreviewTint) + .EndSub(); + } + private TextCommandResult TogglePlacementPreview(TextCommandCallingArgs args) + { + Config.PRShow = (args.Parsers[0].IsMissing) ? !Config.PRShow : (bool)args[0]; + return TextCommandResult.Success($"Block placement preview set to {Config.PRShow}."); + } + private TextCommandResult TogglePlacementPreviewTint(TextCommandCallingArgs args) + { + Config.PRTint = (args.Parsers[0].IsMissing) ? !Config.PRTint : (bool)args[0]; + return TextCommandResult.Success($"Block placement preview set to {Config.PRTint}."); + } public CommandPlacementPreview(ICoreClientAPI capi) : base(capi) { Command = "pconfig"; diff --git a/VSHUD/Renderer/PlacementRenderer.cs b/VSHUD/Renderer/PlacementRenderer.cs index c53f8a5..34b6533 100644 --- a/VSHUD/Renderer/PlacementRenderer.cs +++ b/VSHUD/Renderer/PlacementRenderer.cs @@ -24,7 +24,7 @@ class PlacementRenderer : IRenderer VSHUDConfig config { get => capi.ModLoader.GetModSystem().Config; } ShapeTesselatorManager tesselatormanager { get => capi.TesselatorManager as ShapeTesselatorManager; } bool shouldDispose = true; - + List NonCulledTypes { get; set; } List IgnoredTypes { get; set; } List SneakPlacedTypes { get; set; } @@ -66,7 +66,7 @@ public PlacementRenderer(ICoreClientAPI capi) }; } - public Block GetInvBlock() + public Block GetInvBlock() { Block block = invStack?.Block; if (block == null && invItem != null) @@ -108,7 +108,7 @@ public void UpdateBlockMesh(Block toBlock, BlockPos altPos) } else if (toBlock is BlockChisel) { - mRef = capi.ModLoader.GetModSystem().GetOrCreateMeshRef(invStack); + mRef = capi.ModLoader.GetModSystem().GetOrCreateMeshRef(invStack); shouldDispose = false; return; } @@ -133,7 +133,7 @@ public void UpdateBlockMesh(Block toBlock, BlockPos altPos) mesh.CompactBuffers(); } else - { + { mesh = lod1; mesh.IndicesMax = mesh.Indices.Count(); if (lod0 != null) @@ -157,7 +157,7 @@ public void UpdateBlockMesh(Block toBlock, BlockPos altPos) if (mRef != null && shouldDispose) mRef.Dispose(); shouldDispose = true; MeshData rotMesh = mesh.Clone().Rotate(new Vec3f(0.5f, 0.5f, 0.5f), 0, toBlock.GetRotY(playerPos, playerSelection), 0); - + mRef = rpi.UploadMesh(rotMesh); } @@ -200,12 +200,12 @@ public void OnRenderFrame(float deltaTime, EnumRenderStage stage) toBlock = capi.World.BlockAccessor.GetBlock(SetBlockRedirectMaster.blockId); if (toBlock == null || toBlock.Id == 0) return; - + BlockPos adjPos = selClone.Position; UpdateBlockMesh(toBlock, adjPos); if (mRef == null) return; - + if (!capi.World.BlockAccessor.GetBlock(adjPos).IsReplacableBy(invBlock)) return; rpi.GlToggleBlend(true); @@ -214,14 +214,15 @@ public void OnRenderFrame(float deltaTime, EnumRenderStage stage) Vec2f offset = adjPos.GetOffset(toBlock); IStandardShaderProgram prog = rpi.PreparedStandardShader(adjPos.X, adjPos.Y, adjPos.Z); - prog.Tex2D = capi.BlockTextureAtlas.AtlasTextureIds[0]; + //prog.Tex2D = capi.BlockTextureAtlas.AtlasTextureIds[0]; capi.BlockTextureAtlas.AtlasTextures[0] + prog.Tex2D = capi.BlockTextureAtlas.AtlasTextures[0].TextureId; prog.ModelMatrix = ModelMat .Identity() .Translate(adjPos.X - camPos.X, adjPos.Y - camPos.Y, adjPos.Z - camPos.Z) .Translate(offset.X, 0, offset.Y) .Values; - + prog.ViewMatrix = rpi.CameraMatrixOriginf; prog.ProjectionMatrix = rpi.CurrentProjectionMatrix; Vec4f col = new Vec4f(1.0f, 1.0f, 1.0f, config.PROpacity); @@ -230,7 +231,7 @@ public void OnRenderFrame(float deltaTime, EnumRenderStage stage) { col.Add(new Vec4f(config.PRTintColor[0], config.PRTintColor[1], config.PRTintColor[2], 0.0f)); } - + prog.SsaoAttn = 0; prog.AlphaTest = 0.05f; prog.RgbaTint = new Vec4f(col.R, col.G, col.B, config.PROpacity); diff --git a/VSHUD/Systems/Patches/ChunkPartGrabber.cs b/VSHUD/Systems/Patches/ChunkPartGrabber.cs index 96d4fe5..5cf10ea 100644 --- a/VSHUD/Systems/Patches/ChunkPartGrabber.cs +++ b/VSHUD/Systems/Patches/ChunkPartGrabber.cs @@ -31,7 +31,7 @@ public override void StartClientSide(ICoreClientAPI api) for (int i = 0; i < mgr.Atlasses.Count; i++) { - mgr.Atlasses[i].Export(Path.Combine(path, "blockAtlas-" + i), game, mgr.AtlasTextureIds[i]); + mgr.Atlasses[i].Export(Path.Combine(path, "blockAtlas-" + i), game, mgr.AtlasTextures[i].TextureId); } fileExport = api.VSHUD().fileExport; @@ -61,7 +61,7 @@ public static void PushToStack(MeshData mesh, int chunkX, int chunkY, int chunkZ grabber.fileExport.Push(new ExportableChunkPart(mesh, filePath, fileName, id)); } - + public static void Postfix(ChunkTesselator __instance, int chunkX, int chunkY, int chunkZ, TesselatedChunk tessChunk) { if (!Process) return; diff --git a/VSHUD/Utility/Extensions.cs b/VSHUD/Utility/Extensions.cs index 87f6d9c..da2d94f 100644 --- a/VSHUD/Utility/Extensions.cs +++ b/VSHUD/Utility/Extensions.cs @@ -182,10 +182,7 @@ public static BlockEntity BlockEntity(this BlockSelection sel, IWorldAccessor wo public static void InitializeAnimators(this BlockEntityAnimationUtil util, Vec3f rot, params string[] CacheDictKeys ) { - foreach (var val in CacheDictKeys) - { - util.InitializeAnimator(val, rot); - } + util.InitializeAnimators(rot, CacheDictKeys); } public static void InitializeAnimators(this BlockEntityAnimationUtil util, Vec3f rot, List CacheDictKeys) @@ -300,7 +297,7 @@ public static Vec2f GetOffset(this BlockPos pos, Block block) public static float GetRotY(this Block block, Vec3d entityPos, BlockSelection blockSel) { BlockPos targetPos = blockSel.DidOffset ? blockSel.Position.AddCopy(blockSel.Face.Opposite) : blockSel.Position; - + if (targetPos != null) { if (block is BlockAnvil) @@ -509,7 +506,7 @@ public static Thread InjectClientThread(this IClientWorldAccessor world, string List clientThreads = (world as ClientMain).GetField>("clientThreads"); Stack vanillaSystems = new Stack((world as ClientMain).GetField("clientSystems")); - + foreach (var system in systems) { vanillaSystems.Push(system); @@ -522,9 +519,9 @@ public static Thread InjectClientThread(this IClientWorldAccessor world, string IsBackground = true, Name = name }; - + thread.Start(); - + clientThreads.Add(thread); return thread; diff --git a/VSHUD/VSHUD.csproj b/VSHUD/VSHUD.csproj index 83e0f4f..8eebc13 100644 --- a/VSHUD/VSHUD.csproj +++ b/VSHUD/VSHUD.csproj @@ -9,7 +9,7 @@ Properties VSHUD VSHUD - v4.6.1 + v4.8 512 true @@ -172,6 +172,7 @@ - call "$(ProjectDir)\package.bat" + + \ No newline at end of file diff --git a/VSHUD/VSHUDMain.cs b/VSHUD/VSHUDMain.cs index 87dcbd6..c51beea 100644 --- a/VSHUD/VSHUDMain.cs +++ b/VSHUD/VSHUDMain.cs @@ -9,14 +9,14 @@ Side = "Client", Authors = new[] { "Novocain" }, IconPath = "creative/textures/block/command01-inside.png", - Version = "2.1.2")] + Version = "2.2.0")] namespace VSHUD { public class VSHUDMain : ClientModSystem { ICoreClientAPI capi; - + public MassFileExportSystem fileExport; public VSHUDTaskSystem taskSystem; diff --git a/VSHUD/mods/VSHUD.dll b/VSHUD/mods/VSHUD.dll index 014dfba..9fb5729 100644 Binary files a/VSHUD/mods/VSHUD.dll and b/VSHUD/mods/VSHUD.dll differ diff --git a/WorldGenTests/WorldGenTests.csproj b/WorldGenTests/WorldGenTests.csproj index d2f22c0..38a784a 100644 --- a/WorldGenTests/WorldGenTests.csproj +++ b/WorldGenTests/WorldGenTests.csproj @@ -9,9 +9,10 @@ Properties OreVeins OreVeins - v4.6.1 + v4.8 512 true + true