Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Add PeterO.CBOR
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver-makes-code committed Dec 7, 2023
1 parent beb403b commit 461de28
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions Client/Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.7" />
<PackageReference Include="PeterO.Cbor" Version="4.5.2" />
<PackageReference Include="Tomlyn" Version="0.16.2" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Client/VoxelClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public override void OnTick() {
//GameRenderer.WorldRenderer.ChunkRenderer.SetRenderPosition(camera.position);

Retarget();
if (ConditionHelpers.IsNonNull(targetedBlock, out var tgt)) {
if (Conditions.IsNonNull(targetedBlock, out var tgt)) {
if (Keybinds.Attack.justPressed) // Break
SetBlockAndRetarget(tgt.BlockPos, Blocks.Air);
if (Keybinds.Use.justPressed) // Place
Expand Down
1 change: 1 addition & 0 deletions Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageReference Include="FastNoiseOO" Version="1.0.0"/>
<PackageReference Include="GlmSharp" Version="0.9.8"/>
<PackageReference Include="NLog" Version="5.2.7" />
<PackageReference Include="PeterO.Cbor" Version="4.5.2" />
<PackageReference Include="Tomlyn" Version="0.16.2"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Diagnostics.CodeAnalysis;

namespace Voxel.Common.Util;

public static class ConditionHelpers {
public static class Conditions {
public static bool IsNonNull<T>(T? value, out T newValue) where T : struct {
if (value == null) {
newValue = default;
Expand All @@ -9,4 +11,8 @@ public static bool IsNonNull<T>(T? value, out T newValue) where T : struct {
newValue = value.Value;
return true;
}
public static bool IsNonNull<T>(T? value, [NotNullWhen(true)] out T? newValue) where T : class {
newValue = value;
return value != null;
}
}
5 changes: 5 additions & 0 deletions Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

<ItemGroup>
<PackageReference Include="NLog" Version="5.2.7" />
<PackageReference Include="PeterO.Cbor" Version="4.5.2" />
</ItemGroup>

<ItemGroup>
<Compile Remove="TestRegistry.cs" />
</ItemGroup>

</Project>

0 comments on commit 461de28

Please sign in to comment.