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

[BedTweaks] Update to 1.6 #123

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

FlyingTNT
Copy link

Makes BedTweaks compatible with 1.6.
The old method with Harmony was giving me an error, so I changed it to use the content manager and pre-generate the tectures, rather than doing it when rendering.

Basically redoes everything. The previous method - patching the beds when they were rendered - does not work anymore. Instead, this changes the data of the beds at the outset using content manager. It generates new bed textures when the game is loaded and modifies Data/Furniture to point to the new textures. Also, removes the ability to change sheet opacity; this will be re-added in the future.
No major changes; just what was necessary for compatibility. Also fixed an issue where the reload data button in the wizard would crash the game. I added some try statements to some of the Harmony patches when debugging, and I left them there because I think they are beneficial.
@Martmists-GH
Copy link

Getting the following error:

[Bed Tweaks] This mod failed in the Content.AssetRequested event. Technical details: 
SContentLoadException: Bed Tweaks failed loading content asset 'TileSheets/Furniture' from the game content.
 ---> Microsoft.Xna.Framework.Content.ContentLoadException: The content file was not found.
 ---> FileNotFoundException: Could not find file '/home/mart/.local/share/Steam/steamapps/common/Stardew Valley/Content/TileSheets/Furniture.xnb'.
File name: '/home/mart/.local/share/Steam/steamapps/common/Stardew Valley/Content/TileSheets/Furniture.xnb'
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at Microsoft.Xna.Framework.TitleContainer.PlatformOpenStream(String safeName)
   at Microsoft.Xna.Framework.TitleContainer.OpenStream(String name)
   at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(String assetName)
   --- End of inner exception stack trace ---
   at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(String assetName)
   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
   at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
   at StardewModdingAPI.Framework.ContentManagers.BaseContentManager.RawLoad[T](IAssetName assetName, Boolean useCache) in SMAPI\Framework\ContentManagers\BaseContentManager.cs:line 333
   at StardewModdingAPI.Framework.ContentManagers.GameContentManager.<>c__DisplayClass6_0`1.<LoadExact>b__0() in SMAPI\Framework\ContentManagers\GameContentManager.cs:line 127
   at StardewModdingAPI.Framework.Utilities.ContextHash`1.Track[TResult](T key, Func`1 action) in SMAPI\Framework\Utilities\ContextHash.cs:line 53
   at StardewModdingAPI.Framework.ContentManagers.GameContentManager.LoadExact[T](IAssetName assetName, Boolean useCache)
   at StardewModdingAPI.Framework.ContentManagers.BaseContentManager.LoadLocalized[T](IAssetName assetName, LanguageCode language, Boolean useCache) in SMAPI\Framework\ContentManagers\BaseContentManager.cs:line 147
   at StardewModdingAPI.Framework.ModHelpers.GameContentHelper.Load[T](IAssetName assetName) in SMAPI\Framework\ModHelpers\GameContentHelper.cs:line 84
   --- End of inner exception stack trace ---
   at StardewModdingAPI.Framework.ModHelpers.GameContentHelper.Load[T](IAssetName assetName) in SMAPI\Framework\ModHelpers\GameContentHelper.cs:line 88
   at BedTweaks.ModEntry.OnAssetRequested(Object sender, AssetRequestedEventArgs e) in C:\StardewModding\StardewValleyMods\BedTweaks\ModEntry.cs:line 84
   at StardewModdingAPI.Framework.Events.ManagedEvent`1.Raise(Action`2 invoke) in SMAPI\Framework\Events\ManagedEvent.cs:line 139

Cause seems to be that the mod uses Furniture.xnb instead of furniture.xnb

Changes "TileSheets\\Furniture" => "TileSheets\\furniture" because that was giving some people issues. It is lower case in the game files.
@FlyingTNT
Copy link
Author

Should (hopefully) be fixed.

@FlyingTNT
Copy link
Author

I honestly don't know how I overcomplicated that that much the first time around.

For ease of maintenance, combines the common parts of the furniture and object patches into one method.
Dynamically loads bed textures based on the item id to accommodate beds whose textures are not on the base furniture sheet.
Adds a new BedData class to manage data like each bed's pillow position and whether to redraw the pillows.
Implements a new pillow drawing algorithm to ensure pillows are evenly spaced (the middle pillows used to be closer to each other than to the outer pillows).
The above algorithm also handles the Deluxe Double Bed's unique pillows.
When using sheet transparency, uses BedData to extend the transparency to a height logical for each bed. (previously, the sheets of some beds like the modern bed would have some parts transparent and some not).
@thestreamingadvisor
Copy link

Where is the actual file we need to download so we can use the mod in the game?

@FlyingTNT
Copy link
Author

See the attachments on this post.

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

Successfully merging this pull request may close these issues.

None yet

3 participants