Ok so I am getting this error in the code Severity Code Description Project File Line…
- User
Ok so I am getting this error in the code
Severity Code Description Project File Line Suppression State Error CS1061 'Player' does not contain a definition for 'Jump' and no accessible extension method 'Jump' accepting a first argument of type 'Player' could be found (are you missing a using directive or an assembly reference?) ClassLibrary1 C:\Users\Ninja\source\repos\ClassLibrary1\ClassLibrary1\Class1.cs 24 Active
Heres the full code
using HarmonyLib; using SFD; using System.Reflection;
namespace SuperFightersDeluxeCustomJump { public class EntryPoint { public static void Init() { var harmony = new Harmony("com.yourname.superfightersdeluxe.customjump"); harmony.PatchAll(Assembly.GetExecutingAssembly()); } }
[HarmonyPatch(typeof(Player))] public class PlayerJumpPatch { [HarmonyPrefix] [HarmonyPatch("Jump")] public static bool PrefixJump(Player __instance) { // Modify the jump power here __instance.Jump(16.55f, false); // Return false to prevent the original method from executing return false; } }}
And I noticed that for some reason I only have certain methods as you can see in this screenshot
heres the raw code for the player.cs file
https://raw.githubusercontent.com/howque/fsaf/main/Player.cs
Could you verify why is this happening?
It's probably because it's a public bool?
Heres the CanJump code
// Token: 0x06003A4F RID: 14927 RVA: 0x001169D8 File Offset: 0x00114BD8 public bool CanJump() { return !(!this.StandingOnGround & !this.Dazed) && !this.MustStandStill && !this.ForceKneel && !this.Dazed && !this.DisableJumpWhileHoldingUpKey && this.CurrentAction != PlayerAction.Disabled && ((this.CurrentAction != PlayerAction.DrawWeapon && !this.Reloading) || !this.VirtualKeyboard.PressingKey(26, false)) && !this.TryingToAim && !(this.RecoveryRolling | this.IsHoldingPlayerInGrab | this.IsHoldingPlayerInDive) && (!this.Rolling || this.CurrentActionTime >= this.MinimumRollTimeBeforeJump) && this.m_haveTouchedGroundSinceLastInAir; }
And heres the Jump() code
// SFD.Player // Token: 0x06003BEF RID: 15343 RVA: 0x0003CE6A File Offset: 0x0003B06A internal void Jump() { this.Jump(7.55f, false); }
- Assistant
- User
What about I go to dnSpy and change the internal void of jump to public void and then compile it again as an executable?
Would that work?
- Assistant
Yes, using dnSpy to modify the accessibility of the
Jumpmethod frominternaltopubliccould potentially work, but it does come with some risks and considerations:-
Legal and Ethical: Modifying the assembly's code may violate the software's licensing agreement, and distributing the modified version could have legal implications. Always ensure you have the right to modify the software and are respecting the rights of its authors.
-
Compatibility: Once you modify an assembly, it may no longer be compatible with updates from the original developers, or with mods created by others based on the original, unmodified assembly.
-