Example #1
0
 public void prepareCorrectIDs()
 {
     foreach (String wrapperName in IBigCraftableWrapper.getAllWrappers().Keys)
     {
         int bigCraftableId = jsonAssetsAPI.GetBigCraftableId(wrapperName);
         IBigCraftableWrapper.getWrapper(wrapperName).itemID = bigCraftableId;
     }
 }
Example #2
0
 public void checkAndPachDataAssets()
 {
     if (this.craftablesTilesheetWasPatched && !this.dataAssetsWasPatched && bigCraftableInformationsAsset != null && craftingRecipesAsset != null)
     {
         IBigCraftableWrapper.addBigCraftablesInformations(bigCraftableInformationsAsset.AsDictionary <int, string>().Data);
         IBigCraftableWrapper.addCraftingRecipes(craftingRecipesAsset.AsDictionary <string, string>().Data);
         this.dataAssetsWasPatched = true;
     }
 }
Example #3
0
 public void prepareJsonAssetsJSONs(String themeName)
 {
     foreach (String wrapperName in IBigCraftableWrapper.getAllWrappers().Keys)
     {
         ModEntry.modHelper.Data.WriteJsonFile(
             "assets/SeedMachines" + themeName + "JA/BigCraftables/" + wrapperName + "/big-craftable.json",
             IBigCraftableWrapper.getWrapper(wrapperName).getJsonAssetsModel()
             );
     }
 }
Example #4
0
        public void patchCraftablesTilesheetAsset(IAssetData craftableTilesheetAsset)
        {
            //Modifying default Craftables tilesheet of the game
            Texture2D CraftablesSheet = craftableTilesheetAsset.AsImage().Data;
            int       originalWidth   = CraftablesSheet.Width;
            int       originalHeight  = CraftablesSheet.Height;

            int startingId = (originalWidth / 16) * (originalHeight / 32);

            IBigCraftableWrapper.getWrapper("Seed Machine").itemID = startingId; //First free id for the mod injecting
            IBigCraftableWrapper.getWrapper("Seed Bandit").itemID  = startingId + 6;

            //Getting original color array
            Color[] originalData = new Color[originalWidth * originalHeight];
            CraftablesSheet.GetData <Color>(originalData);

            //Getting mod's color array
            int customWidth  = SeedMachinesSprite.Width;
            int customHeight = SeedMachinesSprite.Height;

            Color[] customData = new Color[customWidth * customHeight];
            SeedMachinesSprite.GetData <Color>(customData);

            //Preparing new clear tilesheet
            Texture2D newTileSheet = new Texture2D(Game1.game1.GraphicsDevice, originalWidth, originalHeight + customHeight, false, SurfaceFormat.Color);

            //Join default and custom color arrays
            var mixedData = new Color[originalData.Length + customData.Length];

            originalData.CopyTo(mixedData, 0);
            customData.CopyTo(mixedData, originalData.Length);

            //Push joined array of colors to prepared new tilesheet
            newTileSheet.SetData(0, new Rectangle(0, 0, originalWidth, originalHeight + customHeight), mixedData, 0, mixedData.Length);

            //Replace default tilesheet with joined one
            craftableTilesheetAsset.ReplaceWith(newTileSheet);

            this.craftablesTilesheetWasPatched = true;
        }
Example #5
0
 public static void OnDayStarted(object sender, DayStartedEventArgs args)
 {
     IBigCraftableWrapper.addAllRecipies();
     BigCraftablesDynamicInjector.injectDynamicsInCurrentLocation();
 }