Could someone help me figure out renaming Jelly?

Discussion in 'Mods' started by Neferia, Oct 18, 2018.

Tags:
  1. Neferia

    Neferia Void-Bound Voyager

    I'm making a mod for ContentPatcher to rename jelly to jam, and running into an issue with it. The generic Jelly (such as the items you can buy from the travelling merchant) gets renamed just fine to Jam, and the new description I gave it changes fine for both the generic and self-crafted Jelly, but for some reason any self-crafted Jelly doesn't get renamed (and the preserves jar still says 'Strawberry Jelly' rather than 'Strawberry Jam' when mousing over it as well.)

    The mod I made changes both the item name in the ObjectInformation file and the string in StringsfromCSFiles. I haven't been able to find any other file location that has to do with how Jelly gets named, and I was wondering if anyone could figure out what I missed or did wrong to get this mod to work. I've attached the mod below.

    Thank you in advance!
     

      Attached Files:

    • MouseyPounds

      MouseyPounds Cosmic Narwhal

      Just to make sure, are you testing with newly-created items? (that is items placed in the preserves jar after your mod was activated) Most object information is saved with the item so if you have jelly sitting in a chest or even in progress of processing it won't be renamed by your changes.
       
      • Neferia

        Neferia Void-Bound Voyager

        Yes, I've tested with new jars and with a completely new game. Didn't make a difference unfortunately.
         
        • MouseyPounds

          MouseyPounds Cosmic Narwhal

          It appears that StardewValley.Object.performObjectDropInAction() hardcodes "Jelly" into the name (see code snippet in spoiler below.) My guess is that the string you altered is only used for the Display Name, but the Display Name isn't used when the game language is set to English. So most likely you'd need to do a Harmony patch in a SMAPI mod to actually change the name properly.

          Code:
          else if (this.name.Equals("Preserves Jar"))
          {
              int num = dropIn.Category;
              if (num == -79)
              {
                  this.heldObject.Value = new Object(Vector2.Zero, 344, dropIn.Name + " Jelly", false, true, false, false);
                  this.heldObject.Value.Price = 50 + dropIn.Price * 2;
                  if (!probe)
                  {
                      this.minutesUntilReady.Value = 4000;
                      this.heldObject.Value.name = dropIn.Name + " Jelly";
                      this.heldObject.Value.preserve.Value = new Object.PreserveType?(Object.PreserveType.Jelly);
                      this.heldObject.Value.preservedParentSheetIndex.Value = dropIn.parentSheetIndex;
                      who.currentLocation.playSound("Ship");
                      Game1.multiplayer.broadcastSprites(who.currentLocation, new TemporaryAnimatedSprite[]
                      {
                          new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(256, 1856, 64, 128), 80f, 6, 999999, this.tileLocation.Value * 64f + new Vector2(0f, -128f), false, false, (this.tileLocation.Y + 1f) * 64f / 10000f + 0.0001f, 0f, Color.LightBlue * 0.75f, 1f, 0f, 0f, 0f, false)
                          {
                              alphaFade = 0.005f
                          }
                      });
                  }
                  return true;
              }
          
          
           
          • Neferia

            Neferia Void-Bound Voyager

            Thank you so much for this information! I have very (veeerrry) limited knowledge of anything resembling programming/modding, so I'd never have been able to figure that out on my own. Seriously, thank you.

            I have no idea how to do a Harmony patch or a SMAPI mod, but at least now I have something to start figuring stuff out from. If you have the time and inclination to offer any further assistance with going about this, I'd be very grateful, but I completely understand if you'd rather not go to the trouble.
             

            Share This Page