tModLoader Biome Library - A ModBiome implementation with evil and hallow alt implementation!

can you also provide how should the mod folder be please? I didn't understand what is "ModName".Dimensions and i don't know why it does say that DimLibs and BiomeLibrary need a using directory
 
can you also provide how should the mod folder be please? I didn't understand what is "ModName".Dimensions and i don't know why it does say that DimLibs and BiomeLibrary need a using directory
Oh, dimlibs is another thing completly xD Basically did you had modReference = BiomeLibrary in your build.txt? After if you are using VS, add this dll in your reference.

https://www.dropbox.com/s/l58h0vk4oi1fcwf/BiomeLibrary.dll?dl=0 (Note this 0.4 dll, but in this build it just add some vanilla biome in registery)

Also I would like to announce that TUA team discord is now in thread.
 
ModWorld:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using BiomeLibrary;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.GameContent.Generation;
using Terraria.World;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
using Terraria.World.Generation;
using Terraria.ID;

namespace DestinyMod
{
public class World : ModWorld
{
public override void Load(TagCompound tag)
{
var downed = tag.GetList<string>("downed");
}

public override void LoadLegacy(BinaryReader reader)
{
int loadVersion = reader.ReadInt32();
if(loadVersion == 0)
{
BitsByte flags = reader.ReadByte();
}
}

public override void NetSend(BinaryWriter writer)
{
BitsByte flags = new BitsByte();
writer.Write(flags);
}

public override void NetReceive(BinaryReader reader)
{
BitsByte flags = reader.ReadByte();
}

public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
{
int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies"));
if(ShiniesIndex != -1)
{
tasks.Insert(ShiniesIndex + 1, new PassLegacy("Tutorial Mod Ores", delegate (GenerationProgress progress)
{
progress.Message = "Generating Destiny Mod Ore Veins";
for(int i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); i++)
{
WorldGen.TileRunner(
WorldGen.genRand.Next(0, Main.maxTilesX), // X Coord of the tile
WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), // Y Coord of the tile
(double)WorldGen.genRand.Next(6, 12), // Strength (High = more)
WorldGen.genRand.Next(2, 6), // Steps
mod.TileType("StormiliteOreTile"), // The tile type that will be spawned
false, // Add Tile ???
0f, // Speed X ???
0f, // Speed Y ???
false, // noYChange ???
true); // Overrides existing tiles
WorldGen.TileRunner(
WorldGen.genRand.Next(0, Main.maxTilesX), // X Coord of the tile
WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), // Y Coord of the tile
(double)WorldGen.genRand.Next(6, 12), // Strength (High = more)
WorldGen.genRand.Next(2, 6), // Steps
mod.TileType("LithiumOreTile"), // The tile type that will be spawned
false, // Add Tile ???
0f, // Speed X ???
0f, // Speed Y ???
false, // noYChange ???
true); // Overrides existing tiles
WorldGen.TileRunner(
WorldGen.genRand.Next(0, Main.maxTilesX), // X Coord of the tile
WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), // Y Coord of the tile
(double)WorldGen.genRand.Next(6, 12), // Strength (High = more)
WorldGen.genRand.Next(2, 6), // Steps
mod.TileType("CyaniteTile"), // The tile type that will be spawned
false, // Add Tile ???
0f, // Speed X ???
0f, // Speed Y ???
false, // noYChange ???
true); // Overrides existing tiles
}
}));
}
}
public override void Initialize()
{
BiomeLibs.RegisterNewBiome("Wasteland", 50, mod);
}
private void RegisterWasteland()
{
Func<bool> c = () => downedPlantboss;
BiomeLibs.RegisterNewBiome("Wasteland", 50, mod);
BiomeLibs.AddBlockInBiome("Wasteland", new String[] { "WasteStone", "WasteSand", "GreenIce" });
BiomeLibs.addHallowAltBiome("Wasteland", "A Nuclear Bomb stroke the ground.");
BiomeLibs.SetCondition("Wasteland", c);
}
}
}

build.txt:
author = alexb2810

version = 0.1.1.9
displayName = Destiny Mod
modReferences = BiomeLibrary
 
ModWorld:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using BiomeLibrary;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.GameContent.Generation;
using Terraria.World;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
using Terraria.World.Generation;
using Terraria.ID;

namespace DestinyMod
{
public class World : ModWorld
{
public override void Load(TagCompound tag)
{
var downed = tag.GetList<string>("downed");
}

public override void LoadLegacy(BinaryReader reader)
{
int loadVersion = reader.ReadInt32();
if(loadVersion == 0)
{
BitsByte flags = reader.ReadByte();
}
}

public override void NetSend(BinaryWriter writer)
{
BitsByte flags = new BitsByte();
writer.Write(flags);
}

public override void NetReceive(BinaryReader reader)
{
BitsByte flags = reader.ReadByte();
}

public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
{
int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies"));
if(ShiniesIndex != -1)
{
tasks.Insert(ShiniesIndex + 1, new PassLegacy("Tutorial Mod Ores", delegate (GenerationProgress progress)
{
progress.Message = "Generating Destiny Mod Ore Veins";
for(int i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); i++)
{
WorldGen.TileRunner(
WorldGen.genRand.Next(0, Main.maxTilesX), // X Coord of the tile
WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), // Y Coord of the tile
(double)WorldGen.genRand.Next(6, 12), // Strength (High = more)
WorldGen.genRand.Next(2, 6), // Steps
mod.TileType("StormiliteOreTile"), // The tile type that will be spawned
false, // Add Tile ???
0f, // Speed X ???
0f, // Speed Y ???
false, // noYChange ???
true); // Overrides existing tiles
WorldGen.TileRunner(
WorldGen.genRand.Next(0, Main.maxTilesX), // X Coord of the tile
WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), // Y Coord of the tile
(double)WorldGen.genRand.Next(6, 12), // Strength (High = more)
WorldGen.genRand.Next(2, 6), // Steps
mod.TileType("LithiumOreTile"), // The tile type that will be spawned
false, // Add Tile ???
0f, // Speed X ???
0f, // Speed Y ???
false, // noYChange ???
true); // Overrides existing tiles
WorldGen.TileRunner(
WorldGen.genRand.Next(0, Main.maxTilesX), // X Coord of the tile
WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), // Y Coord of the tile
(double)WorldGen.genRand.Next(6, 12), // Strength (High = more)
WorldGen.genRand.Next(2, 6), // Steps
mod.TileType("CyaniteTile"), // The tile type that will be spawned
false, // Add Tile ???
0f, // Speed X ???
0f, // Speed Y ???
false, // noYChange ???
true); // Overrides existing tiles
}
}));
}
}
public override void Initialize()
{
BiomeLibs.RegisterNewBiome("Wasteland", 50, mod);
}
private void RegisterWasteland()
{
Func<bool> c = () => downedPlantboss;
BiomeLibs.RegisterNewBiome("Wasteland", 50, mod);
BiomeLibs.AddBlockInBiome("Wasteland", new String[] { "WasteStone", "WasteSand", "GreenIce" });
BiomeLibs.addHallowAltBiome("Wasteland", "A Nuclear Bomb stroke the ground.");
BiomeLibs.SetCondition("Wasteland", c);
}
}
}

build.txt:
author = alexb2810

version = 0.1.1.9
displayName = Destiny Mod
modReferences = BiomeLibrary

Ok, so at first look I see you try to use hallow alt generator. If it's what is not working, no worry there, I actually forgot to remove debug there in 0.3 (wich is why I'm releasing 0.3.1 as we speak). Btw, your Initialize() should look like this

Code:
public override void Initialize()
{        
     RegisterWasteland();
}
 
how do i get my biome to spawn when i kill plantera?
well, you'll have to write the code for that, biomelibs doesn't generate biome apart from hallow. What I could potentially add in future is a Func<void> where you put your biome generation code there and it will spawn when condition are met
 
I keep getting an "Index was outside the bounds of array" error whenever I try to create a new world

public override void Initialize()
{
RegisterHaven();
}

private void RegisterHaven()
{
Func<bool> c = () => Main.hardMode;
BiomeLibs.RegisterNewBiome("Haven", 50, mod);
BiomeLibs.AddBlockInBiome("Haven", new String[] { "havenstone", "havengrass" });
BiomeLibs.addHallowAltBiome("Haven", "The endless cycle of death and rebirth has begun anew...");
}

And I do have "modReferences = BiomeLibrary" in build.txt
 
I keep getting an "Index was outside the bounds of array" error whenever I try to create a new world

public override void Initialize()
{
RegisterHaven();
}

private void RegisterHaven()
{
Func<bool> c = () => Main.hardMode;
BiomeLibs.RegisterNewBiome("Haven", 50, mod);
BiomeLibs.AddBlockInBiome("Haven", new String[] { "havenstone", "havengrass" });
BiomeLibs.addHallowAltBiome("Haven", "The endless cycle of death and rebirth has begun anew...");
}

And I do have "modReferences = BiomeLibrary" in build.txt

Show the entire error pls
Edit: Also I'm rewriting a big part of the mod, which then might make into tML and also the next version will have a lot more powerful API than it have right now (since I learned a lot)
 
So as 0.4 is coming here is the changelog so far:
- All the current method are removed
- Now you can extends from ModBiome, I might look into making it ModCall only like I did with AchievementLibs but I doubt it will happen
- ModBiome are autoloaded, you only need to extends from ModBiome and the mod do the rest!
- Rewrote partially the hallow/biome alt generator to allow more option
-- Currently only hallow alt are supported, but this new system will allow more alt support like : Snow Alt/Jungle Alt/Hell Alt/Big desert Alt and more if any of you have suggestion (evil alt might not come anytime soon)
-- You can now bound alt to specific evil
-- You can now use a generator you made by yourself or use the default one

Do note that I rewrote pretty much everything, so I might have forgot something
 
So as 0.4 is coming here is the changelog so far:
- All the current method are removed
- Now you can extends from ModBiome, I might look into making it ModCall only like I did with AchievementLibs but I doubt it will happen
- ModBiome are autoloaded, you only need to extends from ModBiome and the mod do the rest!
- Rewrote partially the hallow/biome alt generator to allow more option
-- Currently only hallow alt are supported, but this new system will allow more alt support like : Snow Alt/Jungle Alt/Hell Alt/Big desert Alt and more if any of you have suggestion (evil alt might not come anytime soon)
-- You can now bound alt to specific evil
-- You can now use a generator you made by yourself or use the default one

Do note that I rewrote pretty much everything, so I might have forgot something
That sounds great and really worth the effort! Does this auto update in tmodloader? Also if I make a biome does it update the code?
 
Show the entire error pls
Edit: Also I'm rewriting a big part of the mod, which then might make into tML and also the next version will have a lot more powerful API than it have right now (since I learned a lot)

sorry for the super late reply, had some personal stuff to deal with.

Here is the entire error
Index was outside the bounds of the array.
at HavenMod.MWorld.PostWorldGen()
at Terraria.ModLoader.WorldHooks.PostWorldGen()
at Terraria.WorldGen.generateWorld(Int32 seed, GenerationProgress customProgressObject)
at Terraria.WorldGen.do_worldGenCallBack(Object threadContext)
at Terraria.WorldGen.worldGenCallBack(Object threadContext)

At PostWorldGen() we are adding modded items to surface chests (if that helps at all)
 
sorry for the super late reply, had some personal stuff to deal with.

Here is the entire error
Index was outside the bounds of the array.
at HavenMod.MWorld.PostWorldGen()
at Terraria.ModLoader.WorldHooks.PostWorldGen()
at Terraria.WorldGen.generateWorld(Int32 seed, GenerationProgress customProgressObject)
at Terraria.WorldGen.do_worldGenCallBack(Object threadContext)
at Terraria.WorldGen.worldGenCallBack(Object threadContext)

At PostWorldGen() we are adding modded items to surface chests (if that helps at all)
Sound like a problem on your end there since I don't touch this hook at all.
 
Preview of one the biggest feature of 0.4/1.0, evil alt!
wtotspi.png

shdsIyH.png
 
Back
Top Bottom