SharpMC.SharpMixin 1.0.4.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package SharpMC.SharpMixin --version 1.0.4.2
                    
NuGet\Install-Package SharpMC.SharpMixin -Version 1.0.4.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpMC.SharpMixin" Version="1.0.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpMC.SharpMixin" Version="1.0.4.2" />
                    
Directory.Packages.props
<PackageReference Include="SharpMC.SharpMixin" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SharpMC.SharpMixin --version 1.0.4.2
                    
#r "nuget: SharpMC.SharpMixin, 1.0.4.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SharpMC.SharpMixin@1.0.4.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpMC.SharpMixin&version=1.0.4.2
                    
Install as a Cake Addin
#tool nuget:?package=SharpMC.SharpMixin&version=1.0.4.2
                    
Install as a Cake Tool

Sharp Mixin

基于 SharpASM 项目的 Mixin(仍在开发中)...


项目构成 (SharpLoader)

  • SharpLoader: 代替 Java.exe 启动虚拟机并载入模组;
  • SharpAgent: SharpLoader 的 Java Agent 代理部分;
  • SharpASM: 使用 C# 开发的 Java 字节码编辑工具;
  • SharpMixin: (当前项目) 让字节码修改更加简单;
  • SharpAPI: 模块开发 API 及工具;
  • SharpPackage: 模块打包构建 (MSBuild);

示例

当前 Mixin 实际执行由 SharpAPI 模块完成。

public class TestMixin
{
    [MethodMixin("net/minecraft/class_1657", 
        "method_5749", 
        "(Lnet/minecraft/class_11368;)V", 
        NameType.Default)]
    public static List<Code> TestMixinMethod(Class clazz, List<Code> codes)
    {
        var helper = clazz.GetConstantPoolHelper();
        var fieldName = "field_7520";
        var newIndex = helper.NewInteger(114514);
        var fieldRefIndex = helper.NewFieldref(clazz.ThisClass, fieldName, "I");
        
        codes.RemoveAt(codes.Count - 1);
        codes.Add(new Code(OperationCode.ALOAD_0));
        codes.Add(new Code(OperationCode.LDC_W, new[] { Operand.WideIndex(newIndex) }));
        codes.Add(new Code(OperationCode.PUTFIELD, new[] { Operand.FieldRef(fieldRefIndex) }));
        codes.Add(new Code(OperationCode.RETURN));

        clazz.ConstantPool = helper.ToList();        
        return codes;
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SharpMC.SharpMixin:

Package Downloads
SharpMC.SharpAPI

Sharp Loader's Modding API

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4.4 317 9/16/2025
1.0.4.3 321 9/15/2025
1.0.4.2 331 9/15/2025
1.0.4.1 194 9/13/2025
1.0.4 178 9/13/2025
1.0.3.4 182 9/13/2025
1.0.3.3 204 9/13/2025
1.0.3.2 172 9/13/2025
1.0.3.1 170 9/13/2025
1.0.3 123 9/12/2025