-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.21.x' into client-handlers
- Loading branch information
Showing
313 changed files
with
47,456 additions
and
42,674 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,28 @@ | ||
name: .NET Docs | ||
name: Update Docs | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 1.* | ||
branches: [1.*] | ||
paths: | ||
- 'Obsidian.Docs/**' | ||
env: | ||
DOTNET_NOLOGO: true | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
permissions: | ||
contents: write | ||
- "**/*.cs" | ||
- "**/*.csproj" | ||
- ".github/workflows/docfx.yml" | ||
jobs: | ||
build: | ||
update-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 8.0.0 | ||
- name: Install DocFX | ||
run: dotnet tool update -g docfx | ||
continue-on-error: true | ||
- name: Build Obsidian | ||
run: dotnet build | ||
- name: Build documentation | ||
run: docfx Obsidian.Docs/docfx.json | ||
- name: Upload GitHub Pages artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
# Path of the directory containing the static assets. | ||
path: ./Obsidian.Docs/_site/ # default is _site/ | ||
deploy: | ||
# Add a dependency to the build job | ||
needs: build | ||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
# Deploy to the github-pages environment | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
# Specify runner + deployment step | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 | ||
- name: Trigger Workflow in Another Repository | ||
run: | | ||
# Set the required variables | ||
repo_owner="ObsidianMC" | ||
repo_name="Documentation" | ||
event_type="trigger-workflow" | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \ | ||
-d "{\"event_type\": \"$event_type\",\"client_payload\":{\"unit\":false,\"integration\":true}}" |
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 |
---|---|---|
|
@@ -3,8 +3,16 @@ name: .NET Build | |
on: | ||
push: | ||
branches: [ 1.* ] | ||
paths: | ||
- "**/*.cs" | ||
- "**/*.csproj" | ||
- ".github/workflows/dotnet.yml" | ||
pull_request: | ||
branches: [ 1.* ] | ||
paths: | ||
- "**/*.cs" | ||
- "**/*.csproj" | ||
- ".github/workflows/dotnet.yml" | ||
|
||
jobs: | ||
build: | ||
|
@@ -17,14 +25,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 +41,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
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.