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

Commit

Permalink
fix: Fix building
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuisyuu committed Feb 23, 2024
1 parent b1656d7 commit 0d7616f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
5 changes: 2 additions & 3 deletions src/EntryPoint.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Hosihikari.Minecraft.Extension.GlobalService;
using System.Runtime.CompilerServices;
using System.Runtime.CompilerServices;

namespace Hosihikari.Minecraft.Extension;

Expand All @@ -11,7 +10,7 @@ internal static class EntryPoint
internal static void Main() // must be loaded
{
LevelTick.InitHook();
Global.Init();
GlobalService.Global.Init();
if (!OperatingSystem.IsWindows())
{
PackHelper.PackHelper.Init();
Expand Down
4 changes: 2 additions & 2 deletions src/Event/HookEventBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ public abstract class HookEventBase<TEventArgs, THookDelegate> : HookBase<THookD
protected HookEventBase(string symbol, [CallerFilePath] string sourceFile = "")
: base(symbol)
{
_className = Path.GetFileNameWithoutExtension(
_className = System.IO.Path.GetFileNameWithoutExtension(
sourceFile.Replace("\\", "/") /*fix if compile in windows*/
);
}

protected HookEventBase(Delegate func, [CallerFilePath] string sourceFile = "")
: base(func)
{
_className = Path.GetFileNameWithoutExtension(
_className = System.IO.Path.GetFileNameWithoutExtension(
sourceFile.Replace("\\", "/") /*fix if compile in windows*/
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Event/Implements/Player/DestroyBlockEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ namespace Hosihikari.Minecraft.Extension.Event.Implements.Player;

public sealed class DestroyBlockEventArgs : CancelableEventArgsBase
{
internal DestroyBlockEventArgs(Minecraft.Player player, nint position, int dimensionId = -1)
internal DestroyBlockEventArgs(Hosihikari.Minecraft.Player player, nint position, int dimensionId = -1)
{
Player = player;
Position = position;
DimensionId = dimensionId;
}

public Minecraft.Player Player { get; }
public Hosihikari.Minecraft.Player Player { get; }
public nint Position { get; }
public int DimensionId { get; }
}
Expand All @@ -21,15 +21,15 @@ public sealed class DestroyBlockEvent()
: HookEventBase<DestroyBlockEventArgs, DestroyBlockEvent.HookDelegateType>(Block.Original.PlayerWillDestroy)
{
[return: MarshalAs(UnmanagedType.U1)]
public unsafe delegate bool HookDelegateType(Pointer<Block> @this, Pointer<Minecraft.Player> player,
public unsafe delegate bool HookDelegateType(Pointer<Block> @this, Pointer<Hosihikari.Minecraft.Player> player,
nint* pos);

private const int DimensionIdOffset = 352;

protected override unsafe HookDelegateType HookDelegate =>
(@this, _player, pos) =>
{
Minecraft.Player player = _player.Target;
Hosihikari.Minecraft.Player player = _player.Target;
using Actor actor = player.As<Actor>();
using Dimension dim = actor.Dimension.Target;
int dimensionId = Memory.DAccess<int>(dim.Pointer, DimensionIdOffset);
Expand Down
2 changes: 1 addition & 1 deletion src/FormUI/FormHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static unsafe class FormHandler

private static readonly Dictionary<uint, FormBase> s_forms = new();

private static readonly Random s_random = new();
private static readonly System.Random s_random = new();

// static FormHandler()
// {
Expand Down
7 changes: 4 additions & 3 deletions src/GlobalService/Hook/RakPeerHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@

namespace Hosihikari.Minecraft.Extension.GlobalService.Hook;

internal sealed class RakPeerHook() : HookBase<RakPeerHook.HookDelegateType>(RakPeer.Original.Constructor_RakPeer)
internal sealed class RakPeerHook()
: HookBase<RakPeerHook.HookDelegateType>(RakNet.RakPeer.Original.Constructor_RakPeer)
{
protected override HookDelegateType HookDelegate =>
@this =>
{
Pointer<RakPeer> result = Original(@this);
Pointer<RakNet.RakPeer> result = Original(@this);
Global.RakPeer.Instance = @this.Target;
TryUninstall();
return result;
};

internal delegate Pointer<RakPeer> HookDelegateType(Pointer<RakPeer> @this);
internal delegate Pointer<RakNet.RakPeer> HookDelegateType(Pointer<RakNet.RakPeer> @this);
}
12 changes: 6 additions & 6 deletions src/PackHelper/LinkCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void AddPack(PackType packType, string packDirectory, PackInfo inf
throw new DirectoryNotFoundException($"packDirectory {packDirectory} not found");
}

string target = Path.Combine(
string target = System.IO.Path.Combine(
Environment.CurrentDirectory,
packType switch
{
Expand All @@ -36,7 +36,7 @@ public static void AddPack(PackType packType, string packDirectory, PackInfo inf
Directory.CreateDirectory(target);
}

string link = Path.Combine(target, info.PackId.ToString());
string link = System.IO.Path.Combine(target, info.PackId.ToString());
if (Directory.Exists(link))
{
if (LinkUtils.IsLink(link))
Expand Down Expand Up @@ -77,16 +77,16 @@ void CopyFolder(string sourceFolder, string destFolder)
string[] files = Directory.GetFiles(sourceFolder);
foreach (string file in files)
{
string name = Path.GetFileName(file);
string dest = Path.Combine(destFolder, name);
string name = System.IO.Path.GetFileName(file);
string dest = System.IO.Path.Combine(destFolder, name);
File.Copy(file, dest);
}

string[] folders = Directory.GetDirectories(sourceFolder);
foreach (string folder in folders)
{
string name = Path.GetFileName(folder);
string dest = Path.Combine(destFolder, name);
string name = System.IO.Path.GetFileName(folder);
string dest = System.IO.Path.Combine(destFolder, name);
CopyFolder(folder, dest);
}
}
Expand Down

0 comments on commit 0d7616f

Please sign in to comment.