1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-03-22 14:23:25 +08:00

Remove spaces

This commit is contained in:
SSSSSSSan
2025-11-23 21:53:59 +08:00
committed by Soar Qin
parent 2487a099c1
commit 524e2b62f0
2 changed files with 10 additions and 11 deletions

View File

@@ -156,15 +156,15 @@ public static class StoragePatch
{
var codes = new List<CodeInstruction>(instructions);
var matcher = new CodeMatcher(codes, generator);
// 找到方法开始处
// Find the beginning of the method
matcher.Start();
// 定义标签用于跳转
// Define label for jump
var skipDustbinLogic = generator.DefineLabel();
// 在方法开始处插入安全检查
// Insert safety checks at the beginning of the method
matcher.InsertAndAdvance(
@@ -172,41 +172,41 @@ public static class StoragePatch
// Safety check: Ensure StorageComponent instance is not null
new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Brfalse, skipDustbinLogic),
// 检查是否是垃圾桶
// Check if it's a dustbin
new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(StorageComponent), nameof(StorageComponent.IsDustbin))),
new CodeInstruction(OpCodes.Brfalse, skipDustbinLogic),
// 检查count是否大于0
// Check if count is greater than 0
new CodeInstruction(OpCodes.Ldarg_2),
new CodeInstruction(OpCodes.Ldc_I4_0),
new CodeInstruction(OpCodes.Ble, skipDustbinLogic),
// 调用CalcGetSands处理物品销毁和沙子生成
// Call CalcGetSands to handle item destruction and sand generation
new CodeInstruction(OpCodes.Ldarg_1),
new CodeInstruction(OpCodes.Ldarg_2),
new CodeInstruction(OpCodes.Ldarg_3),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Dustbin), nameof(Dustbin.CalcGetSands))),
// 设置remainInc为0第5个参数索引4
// Set remainInc to 0 (5th parameter, index 4)
new CodeInstruction(OpCodes.Ldarg, 4),
new CodeInstruction(OpCodes.Ldc_I4_0),
new CodeInstruction(OpCodes.Stind_I4),
// 返回count表示成功销毁
// Return count to indicate successful destruction
new CodeInstruction(OpCodes.Ret),
// 跳过垃圾桶逻辑的标签
// Label to skip dustbin logic
new CodeInstruction(OpCodes.Nop).WithLabels(skipDustbinLogic)
);
return matcher.InstructionEnumeration();
}