-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Packets refactor & 2 other changes (.net9 and 1.21.3) (#453)
.NET9, Packets Refactor and 1.21.3
- Loading branch information
Showing
315 changed files
with
47,619 additions
and
42,715 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,14 @@ jobs: | |
- name: Setup .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 8.0.x | ||
dotnet-version: 9.0.x | ||
include-prerelease: true | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --no-restore --configuration Release /p:DebugType=None | ||
- name: Rename executables | ||
working-directory: /home/runner/work/Obsidian/Obsidian/Obsidian.ConsoleApp/bin/Release/net8.0/ | ||
working-directory: /home/runner/work/Obsidian/Obsidian/Obsidian.ConsoleApp/bin/Release/net9.0/ | ||
run: | | ||
mv Obsidian.ConsoleApp.dll ObsidianApp.dll | ||
mv Obsidian.ConsoleApp.deps.json ObsidianApp.deps.json | ||
|
@@ -33,7 +33,7 @@ jobs: | |
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Obsidian-Nightly-Build | ||
path: /home/runner/work/Obsidian/Obsidian/Obsidian.ConsoleApp/bin/Release/net8.0/ | ||
path: /home/runner/work/Obsidian/Obsidian/Obsidian.ConsoleApp/bin/Release/net9.0/ | ||
if: ${{ github.event_name == 'push' }} # Only upload artifacts on push, don't upload them for PRs | ||
- name: Discord Webhook Action | ||
uses: tsickert/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ jobs: | |
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: | | ||
9 | ||
8 | ||
7 | ||
- name: Pack n Push | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,26 @@ | ||
using Obsidian.API.Builders.Interfaces; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Obsidian.API.Builders; | ||
public sealed class SoundEffectBuilder : BaseSoundEffectBuilder | ||
{ | ||
internal SoundEffectBuilder() { } | ||
|
||
public static ISoundEffectBuilder Create(SoundId soundId, SoundCategory soundCategory = SoundCategory.Master) => new SoundEffectBuilder | ||
public static ISoundEffectBuilder Create(string soundLocation, SoundCategory soundCategory = SoundCategory.Master) => new SoundEffectBuilder | ||
{ | ||
SoundId = soundId, | ||
SoundLocation = soundLocation, | ||
SoundCategory = soundCategory | ||
}; | ||
|
||
public static ISoundEffectBuilder Create([NotNull] string soundName, SoundCategory soundCategory = SoundCategory.Master) | ||
{ | ||
ArgumentException.ThrowIfNullOrEmpty(soundName); | ||
|
||
return new SoundEffectBuilder | ||
{ | ||
SoundName = soundName, | ||
SoundId = SoundId.None, | ||
SoundCategory = soundCategory | ||
}; | ||
} | ||
|
||
public override ISoundEffect Build() => new SoundEffect | ||
{ | ||
SoundId = this.SoundId, | ||
SoundId = this.SoundLocation, | ||
SoundCategory = this.SoundCategory, | ||
SoundPosition = this.SoundPosition, | ||
Volume = this.Volume, | ||
Pitch = this.Pitch, | ||
Seed = this.Seed, | ||
SoundName = this.SoundName, | ||
HasFixedRange = this.HasFixedRange, | ||
Range = this.Range, | ||
FixedRange = this.FixedRange, | ||
EntityId = this.EntityId | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,7 @@ public enum CraftingType | |
Stonecutting, | ||
|
||
SmithingTransform, | ||
SmithingTrim | ||
SmithingTrim, | ||
|
||
CraftingTransmute | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,63 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using SharpNoise; | ||
using SharpNoise; | ||
using SharpNoise.Builders; | ||
using SharpNoise.Models; | ||
using System.Threading; | ||
|
||
namespace Obsidian.API.Noise; | ||
|
||
namespace Obsidian.WorldData.Generators.Overworld | ||
/// <summary> | ||
/// Builds a density noise map. | ||
/// </summary> | ||
/// <remarks> | ||
/// This class builds a noise map by filling it with coherent-noise values | ||
/// generated from the Y density of a noise cube. | ||
/// </remarks> | ||
public class DensityNoiseMapBuilder : NoiseMapBuilder | ||
{ | ||
/// <summary> | ||
/// Builds a density noise map. | ||
/// </summary> | ||
/// <remarks> | ||
/// This class builds a noise map by filling it with coherent-noise values | ||
/// generated from the Y density of a noise cube. | ||
/// </remarks> | ||
public class DensityNoiseMapBuilder : NoiseMapBuilder | ||
public NoiseCube SourceNoiseCube { get; set; } | ||
|
||
protected override void PrepareBuild() | ||
{ | ||
public NoiseCube SourceNoiseCube { get; set; } | ||
if (destWidth <= 0 || | ||
destHeight <= 0 || | ||
SourceNoiseCube == null || | ||
DestNoiseMap == null) | ||
throw new InvalidOperationException("Builder isn't properly set up."); | ||
|
||
protected override void PrepareBuild() | ||
{ | ||
if (destWidth <= 0 || | ||
destHeight <= 0 || | ||
SourceNoiseCube == null || | ||
DestNoiseMap == null) | ||
throw new InvalidOperationException("Builder isn't properly set up."); | ||
DestNoiseMap.SetSize(destHeight, destWidth); | ||
} | ||
|
||
DestNoiseMap.SetSize(destHeight, destWidth); | ||
} | ||
protected override void BuildImpl(CancellationToken cancellationToken) | ||
{ | ||
NoiseCube nc = SourceNoiseCube; | ||
|
||
var xExtent = nc.Width; | ||
var yExtent = nc.Height; | ||
var zExtent = nc.Depth; | ||
var xDelta = xExtent / destWidth; | ||
var zDelta = zExtent / destHeight; | ||
|
||
protected override void BuildImpl(CancellationToken cancellationToken) | ||
var po = new ParallelOptions() | ||
{ | ||
NoiseCube nc = SourceNoiseCube; | ||
CancellationToken = cancellationToken, | ||
}; | ||
|
||
var xExtent = nc.Width; | ||
var yExtent = nc.Height; | ||
var zExtent = nc.Depth; | ||
var xDelta = xExtent / destWidth; | ||
var zDelta = zExtent / destHeight; | ||
Parallel.For(0, destHeight, po, z => | ||
{ | ||
double zCur = z * zDelta; | ||
|
||
var po = new ParallelOptions() | ||
{ | ||
CancellationToken = cancellationToken, | ||
}; | ||
int x; | ||
double xCur; | ||
|
||
Parallel.For(0, destHeight, po, z => | ||
for (x = 0, xCur = 0; x < destWidth; x++, xCur += xDelta) | ||
{ | ||
double zCur = z * zDelta; | ||
|
||
int x; | ||
double xCur; | ||
|
||
for (x = 0, xCur = 0; x < destWidth; x++, xCur += xDelta) | ||
float finalValue = 0; | ||
for (int y = 0; y < yExtent; y++) | ||
{ | ||
float finalValue = 0; | ||
for (int y=0; y < yExtent; y++) | ||
{ | ||
finalValue += (float)nc.GetValue((int)xCur, y, (int)zCur); | ||
} | ||
finalValue /= yExtent; | ||
DestNoiseMap[x, z] = finalValue; | ||
finalValue += (float)nc.GetValue((int)xCur, y, (int)zCur); | ||
} | ||
}); | ||
} | ||
finalValue /= yExtent; | ||
DestNoiseMap[x, z] = finalValue; | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.