Skip to content

Commit 56ac116

Browse files
author
Neutron3529
committedJun 5, 2021
忘记把正确写法写上去了
1 parent 28b01ec commit 56ac116

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎voidItem.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,16 @@ public class VoidItem : BaseUnityPlugin {
7676
#endif
7777
void Start() {
7878
var harmony=new Harmony("Neutron3529.VoidItem");
79-
//harmony.PatchAll(typeof(StorageComponentTakeTailItemsPatch));
80-
var m=typeof(StorageComponent).GetMethods();
79+
harmony.PatchAll(typeof(StorageComponentTakeTailItemsPatch));
80+
/*var m=typeof(StorageComponent).GetMethods();
8181
MethodInfo method_to_patch=m[0];
8282
foreach(var i in m)if(i.Name=="TakeTailItems" && i.ReturnType==typeof(void)){
8383
method_to_patch=i;
8484
break;
8585
}
8686
if(method_to_patch.Name!="TakeTailItems" || method_to_patch.ReturnType!=typeof(void)){return;}
8787
var prefix = typeof(StorageComponentTakeTailItemsPatch).GetMethod("Prefix");
88-
harmony.Patch(method_to_patch, new HarmonyMethod(prefix));
88+
harmony.Patch(method_to_patch, new HarmonyMethod(prefix));*/
8989
#if DEBUG
9090
logger=Logger.LogInfo;
9191
logger("VoidItem加载完成");
@@ -101,11 +101,11 @@ void Start() {
101101
}
102102

103103
//[HarmonyPatch(typeof(StorageComponent), "TakeTailItems",new Type[]{typeof(int) ,ref typeof(int),typeof(bool)})]
104+
[HarmonyPatch(typeof(StorageComponent), "TakeTailItems",new Type[]{typeof(int) ,typeof(int),typeof(bool)},new ArgumentType[]{ArgumentType.Ref,ArgumentType.Ref,ArgumentType.Normal})]
104105
class StorageComponentTakeTailItemsPatch{
105106
public static bool Prefix(int count, int itemId) {
106107
return count==0 || itemId==0;
107108
}
108109
}
109-
110110
}
111111
}

0 commit comments

Comments
 (0)
Please sign in to comment.