Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CraftingFilter: Breaks F5 console (multiple mods actually do this) #110

Open
Jester2020 opened this issue Apr 24, 2024 · 8 comments
Open

Comments

@Jester2020
Copy link

When the mod is active any command in the console errors. All mods you have that touch the console will break it. For example i also had to remove craft from containers and Container Lists. Most people have been blaming Server DevCommands but it works fine.

@Jester2020 Jester2020 changed the title CraftingFilter: Breaks F5 console CraftingFilter: Breaks F5 console (multiple mods actually do this) Apr 24, 2024
@walterst
Copy link

This is the console error that I get when typing devcommands (looks like the same issue, but I'm using Movable Inventory Windows, Custom Toolbars Hotkeys, and Extended Player Inventory):

[Error : Unity Log] TypeLoadException: Failure has occurred while loading a type.
Stack trace:
(wrapper dynamic-method) Terminal.DMDTerminal::InputText(Terminal)
Terminal.SendInput () (at :0)
UnityEngine.Events.InvokableCall.Invoke () (at :0)
UnityEngine.Events.UnityEvent1[T0].Invoke (T0 arg0) (at <ab14d35a27c043688812ae199c64b5aa>:0) GUIFramework.GuiInputField.onInputSubmit (System.String text) (at <1c0bbb94c86e42bb92d9376327e3b555>:0) UnityEngine.Events.InvokableCall1[T1].Invoke (T1 args0) (at :0)
UnityEngine.Events.UnityEvent1[T0].Invoke (T0 arg0) (at <ab14d35a27c043688812ae199c64b5aa>:0) TMPro.TMP_InputField.SendOnSubmit () (at <99900a1f9e2a471c8b46c2c560e4eba9>:0) TMPro.TMP_InputField.OnUpdateSelected (UnityEngine.EventSystems.BaseEventData eventData) (at <99900a1f9e2a471c8b46c2c560e4eba9>:0) UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IUpdateSelectedHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at <a01fe238487248d39ba352ec152ec890>:0) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1] functor) (at :0)
UnityEngine.EventSystems.EventSystem:Update()

[Info : Unity Log] TMP_Input can't handle null eventData in curren package. Can be ignored atm though. Exception: Failure has occurred while loading a type.

@langaan27
Copy link

i am getting same issue with custom audio and custom load screens. both mods seems to work, but they both break the command/console.

has anyone figured out a work around?

@jairovsky
Copy link

Guys, I was having the same problem while using DiscardInventoryItems. I managed to fix it by recompiling the mod with up to date dependencies. Didn't change a single line of code: https://github.com/jairovsky/mods-valheim/tree/master/valheim-discard-inventory-item

This solution most likely fixes #109 and #105 too.

@x0rsw1tch
Copy link

Guys, I was having the same problem while using DiscardInventoryItems. I managed to fix it by recompiling the mod with up to date dependencies. Didn't change a single line of code: https://github.com/jairovsky/mods-valheim/tree/master/valheim-discard-inventory-item

This solution most likely fixes #109 and #105 too.

Interesting. I cloned this repo, tried compiling RecipeCustomization using the instructions on your repo using dotnet build --configuration Release RecipeCustomization, and getting this error:

MSBuild version 17.7.6+77d58ec69 for .NET
  Determining projects to restore...
C:\Program Files\dotnet\sdk\7.0.410\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(92,5): error NE
TSDK1013: The TargetFramework value '' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/o
r TargetFrameworkVersion properties must be specified explicitly. [D:\Projects\ValheimMods\RecipeCustomization\RecipeCustomizatio
n.csproj]

Build FAILED.

C:\Program Files\dotnet\sdk\7.0.410\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(92,5): error NE
TSDK1013: The TargetFramework value '' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/o
r TargetFrameworkVersion properties must be specified explicitly. [D:\Projects\ValheimMods\RecipeCustomization\RecipeCustomizatio
n.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.29

Would it make sense to clone your repo, copy RecipeCustomization dir into that repo, then run the build. Would that work?

@jairovsky
Copy link

jairovsky commented Sep 5, 2024 via email

@x0rsw1tch
Copy link

Nice, I'll give that a go this weekend, see what happens, thanks!

@jairovsky
Copy link

Hello again!

I managed to compile DiscardInventoryItem from this repo.

Below is the git diff of what I needed to change. You can save it to a file and do git apply on your machine if you wanna tinker with it.

git diff
diff --git a/DiscardInventoryItem/DiscardInventoryItem.csproj b/DiscardInventoryItem/DiscardInventoryItem.csproj
index 250eb8c..b194bf0 100644
--- a/DiscardInventoryItem/DiscardInventoryItem.csproj
+++ b/DiscardInventoryItem/DiscardInventoryItem.csproj
@@ -2,5 +2,5 @@
   <PropertyGroup>
     <Version>1.0.0</Version>
   </PropertyGroup>
-  <Import Project="$(SolutionDir)\valheim.targets" />
+  <Import Project="..\valheim.targets" />
 </Project>
\ No newline at end of file
diff --git a/valheim.targets b/valheim.targets
index be591b3..3e61245 100644
--- a/valheim.targets
+++ b/valheim.targets
@@ -6,7 +6,7 @@
     <TargetFramework>net480</TargetFramework>
     <Platforms>AnyCPU</Platforms>
     <PlatformTarget>AnyCPU</PlatformTarget>
-    <GamePath><!-- Set GamePath manually --></GamePath>
+    <GamePath>D:\Games\SteamLibrary\steamapps\common\Valheim</GamePath>
     <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
   </PropertyGroup>
 
@@ -52,7 +52,7 @@
   <PropertyGroup>
     <BepInExPath>$(GamePath)\BepInEx</BepInExPath>
     <ManagedDataPath>$(GamePath)\valheim_Data\Managed</ManagedDataPath>
-    <UnityPath>$(GamePath)\unstripped_corlib</UnityPath>
+    <UnityPath>$(ManagedDataPath)</UnityPath>
   </PropertyGroup>
   
   <!-- Set start action -->
@@ -77,6 +77,14 @@
     </Reference>
   </ItemGroup>
 
+  <ItemGroup Label="extra_deps">
+    <Reference Include="gui_framework">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>$(ManagedDataPath)\gui_framework.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+
   <!-- Add valheim_data references -->
   <ItemGroup Label="Valheim_Data">
     <Reference Include="assembly_valheim">

So what do these changes mean:

  • $SolutionDir does not work for me because I'm using dotnet CLI (not msbuild).
  • In the past (when this repo was created) we needed some modified DLLs (known as unstripped_corlib) in order to compile the mods. This is not needed anymore because Valheim is already shipping with the unstripped DLLs nowadays.
  • In the case of DiscardInventoryItems, I needed to include an extra dependency called gui_framework.dll that was not present in valheim.targets before. You may run into this problem while trying to compile other mods. Look at the build log, it will have a line saying "something_something.dll is not present". That's the dll you need to declare in valheim.targets.

@mrtumnus
Copy link

Also seeing this with MoveableInventoryWindows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants