tModLoader Custom Biome (Game Crash Error) Help!!

Bluezinho

Steampunker
O índice estava fora dos limites da matriz.
em TerraZ.TerraZWorld.<ModifyWorldGenTasks>b__1(GenerationProgress progress)
em Terraria.GameContent.Generation.PassLegacy.Apply(GenerationProgress progress)
em Terraria.World.Generation.WorldGenerator.GenerateWorld(GenerationProgress progress)
em Terraria.WorldGen.generateWorld(Int32 seed, GenerationProgress customProgressObject)
em Terraria.WorldGen.do_worldGenCallBack(Object threadContext)
em Terraria.WorldGen.worldGenCallBack(Object threadContext)


Code:
using System.IO;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.World.Generation;
using Microsoft.Xna.Framework;
using Terraria.GameContent.Generation;
using System.Linq;


namespace TerraZ
{
    public class TerraZWorld : ModWorld
    {

public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
        {
            int genIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies"));
            if (genIndex == -1)
            {
                return;
            }
            tasks.Insert(genIndex + 1, new PassLegacy("Blood Biome", delegate (GenerationProgress progress)
            {
                progress.Message = "Custom Biome Progress";
                for (int i = 0; i < Main.maxTilesX / 2600; i++)       //900 is how many biomes. the bigger is the number = less biomes
                {
                    int X = WorldGen.genRand.Next(Main.maxTilesX);
                    int Y = WorldGen.genRand.Next((int)WorldGen.worldSurfaceHigh + 125);//this make the biome spawn on surface.
                    int TileType = mod.TileType("BloodDirt");     //this is the tile u want to use for the biome , if u want to use a vanilla tile then its int TileType = 56; 56 is obsidian block

                    WorldGen.TileRunner(X, Y, 550, WorldGen.genRand.Next(100, 300), TileType, false, 0f, 0f, true, true);  //350 is how big is the biome     100, 200 this changes how random it looks.pawn rate. the bigger is the number = more ore spawns
                    {
                        int Xo = X + Main.rand.Next(-240, 240);
                        int Yo = Y + Main.rand.Next(-240, 240);
                        if (Main.tile[Xo, Yo].type == mod.TileType("BloodDirt"))   //this is the tile where the ore will spawn
                        {

                            {
                                WorldGen.TileRunner(Xo, Yo, (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(5, 10), mod.TileType("CustomOreTile"), false, 0f, 0f, false, true);  //   5, 10 is how big is the ore veins.    mod.TileType("CustomOreTile") is the custom ore tile,  if u want a vanila ore just do this: TileID.Cobalt, for cobalt spawn
                            }
                        }
                    }
                }

            }));
        }
    }
}
 
Back
Top Bottom