FireDude123
Newcomer
I'm trying to make a custom map with C# and SMAPI, but I've hit a snag. I can't seem to load the necessary files into the game. Right now my code looks like:
using StardewModdingAPI;
using StardewValley;
using StardewValley.Locations;
using xTile;
using System;
using StardewModdingAPI.Events;
using Microsoft.Xna.Framework.Graphics;
namespace YourModNamespace
{
public class ModEntry : Mod
{
public override void Entry(IModHelper helper)
{
helper.Events.Content.AssetRequested += this.OnAssetRequested;
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
}
private void OnAssetRequested(object sender, AssetRequestedEventArgs e)
{
if (e.NameWithoutLocale.Equals("Maps/ZuzuCity"))
{
e.LoadFrom(() => this.Helper.ModContent.Load<Map>("assets/maps/zuzuCity.tmx"), AssetLoadPriority.Medium);
}
if (e.NameWithoutLocale.Equals("TileSheets/ZuzuCity"))
{
e.LoadFrom(() => this.Helper.ModContent.Load<Texture2D>("assets/tilesheets/zuzuCity.png"), AssetLoadPriority.Medium);
}
}
private void OnSaveLoaded(object sender, EventArgs e)
{
GameLocation location = new GameLocation("Maps/ZuzuCity", "ZuzuCity");
Game1.locations.Add(location);
Game1.getLocationFromName("BusStop").warps.Add(new Warp(20, 10, "ZuzuCity", 5, 5, false, false));
}
}
}
Does anyone know this stuff?
using StardewModdingAPI;
using StardewValley;
using StardewValley.Locations;
using xTile;
using System;
using StardewModdingAPI.Events;
using Microsoft.Xna.Framework.Graphics;
namespace YourModNamespace
{
public class ModEntry : Mod
{
public override void Entry(IModHelper helper)
{
helper.Events.Content.AssetRequested += this.OnAssetRequested;
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
}
private void OnAssetRequested(object sender, AssetRequestedEventArgs e)
{
if (e.NameWithoutLocale.Equals("Maps/ZuzuCity"))
{
e.LoadFrom(() => this.Helper.ModContent.Load<Map>("assets/maps/zuzuCity.tmx"), AssetLoadPriority.Medium);
}
if (e.NameWithoutLocale.Equals("TileSheets/ZuzuCity"))
{
e.LoadFrom(() => this.Helper.ModContent.Load<Texture2D>("assets/tilesheets/zuzuCity.png"), AssetLoadPriority.Medium);
}
}
private void OnSaveLoaded(object sender, EventArgs e)
{
GameLocation location = new GameLocation("Maps/ZuzuCity", "ZuzuCity");
Game1.locations.Add(location);
Game1.getLocationFromName("BusStop").warps.Add(new Warp(20, 10, "ZuzuCity", 5, 5, false, false));
}
}
}
Does anyone know this stuff?