Pathoschild / SMAPI

The modding API for Stardew Valley.
https://smapi.io/
GNU Lesser General Public License v3.0
1.71k stars 258 forks source link

Let ReplaceReferencesRewriter rewrite methods on open generic types, & improve op_Implicit rewrites for Stardew Valley 1.6 #919

Closed SinZ163 closed 6 months ago

SinZ163 commented 8 months ago

This improves ReplaceReferencesRewriter to handle Generic Classes without needing to specify every known permutation that gets used.

This unfortunately doesn't handle the edge case of Generic arguments that are nested classes (The RewriteHelper methods cant format them in the way that Reflection would want)

In addition to the readbility improvements, it also handles the additional two cases of: reference to Netcode.NetFieldBase2<StardewValley.Objects.Ring,Netcode.NetRef1>.op_Implicit (no such method) reference to Netcode.NetFieldBase2<StardewValley.BuildingPaintColor,Netcode.NetRef1>.op_Implicit (no such method)

I have also included a manual handling of NetLong's op_Implicit as well, which couldn't Facade off NetLong directly due to being a sealed class, haven't explicitly tested code paths actually invoking this post rewrite however.

Pathoschild commented 6 months ago

Merged into alpha for the upcoming SMAPI 4.0.0. Thanks for the help!