Dradonhunter11
Official Terrarian
Hello everyone, have you ever found that creating a biome in tmod was hard? That it involve a lot of time to implement and you feel kinda lazy. Well say no more! Dradon created for you a new mod to simplify the process!
The BiomeLibs mod v0.4
So before I start talking in deep of this mod, I'm gonna say why I created it.
While working on Terraria Ultra Apocalypse, I saw that you had no real way to make biome in a simple way, you have to sync it and everything (wich involve messing with mainly 2 file, ModPlayer and ModWorld). What this do is rather simple, it basically allow you to make biome without messing with those! Currently there is 3 function you can use, but I planned to add more! It also use Strong reference, so you gotta extract it or use the dll provided in the download.
so now let's go on the method you'll need to use to make a new biome:
(OUTDATED, MAKING A GITHUB WIKI)
so lemme explain what is happening here:
So now that the registery part is done, let's go on the detection method (currently only, maybe gonna add more?)
Well, I don't think i need to explain what does biomeName here as it same as int the other method
public override void UpdateMusic(ref int music)
{
if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active)
{
if (BiomeLibs.InBiome("Meteoridon"))
{
music = MusicID.TheHallow;
}
}
}
[/code]
Here an example of how you mod world would look :
This is probably the best exemple I can give right here as for now. It's really simple as it go by biome name.
So now that the explanation are done, here something you need to know as it's really important: you must use strong reference or it won't work, so add the following line.
To do list:
- Clean code (yeah, really need to clean this mess I made, but it work )
- Add Sandstone, Snow and wall support for hallow alt
- Add Wall support for biome
- Add GlobalNPC edit spawn pool (v0.4, drawing board phase)
- Add background support (v0.5)
---------------------------------------------------
Credit:
- Me, for making this mod
- My friend @jsx542 , for making a better block detection code, this saved me a lot of time
- Re-Logic for making this awesome game
- My friend @blushiemagic , for making tmod, this wouldn't be possible without you!
--------------------------------------------------
You may use this "mod" as long you provide the proper credit
--------------------------------------------------
Download link v0.4: To be updated
Source : TUA-Team/BiomeLibrary
Discord (TUA team discord) : Join the Realm of Infinity (TUA) Discord Server!
PS: Sorry that you had to read trough this terrible grammar, I'm trying to improve everyday
The BiomeLibs mod v0.4
So before I start talking in deep of this mod, I'm gonna say why I created it.
While working on Terraria Ultra Apocalypse, I saw that you had no real way to make biome in a simple way, you have to sync it and everything (wich involve messing with mainly 2 file, ModPlayer and ModWorld). What this do is rather simple, it basically allow you to make biome without messing with those! Currently there is 3 function you can use, but I planned to add more! It also use Strong reference, so you gotta extract it or use the dll provided in the download.
so now let's go on the method you'll need to use to make a new biome:
(OUTDATED, MAKING A GITHUB WIKI)
Code:
public override void Initialize()
{
BiomeLibs.RegisterNewBiome("Meteoridon", 50, mod);
BiomeLibs.AddBlockInBiome("Meteoridon", new String[] { "MeteoridonStone", "MeteoridonGrass", "BrownIce" });
BiomeLibs.addHallowAltBiome("Meteoridon");
//Totally not taken from TUA
}
so lemme explain what is happening here:
This method is probably the most important in this mod, as it allow to register your biome. When a new biome is created, it register a new BiomeSkeleton object and will contain all the information for your biome.
biomeName is basically the name of your biome, the name you'll use when you want to verify condition. This could in theory allow cross biome content (still need test)
minTileRequirement is the minimum of tile required to make a biome
Mod is basically your mod, normally since it's in ModWorld you just send mod and it work
Code:
RegisterNewBiome(String biomeName, int minTileRequirement, Mod mod)
minTileRequirement is the minimum of tile required to make a biome
Mod is basically your mod, normally since it's in ModWorld you just send mod and it work
This method is also really important as it allow you to add tile to your biome.
biomeName is used here to get in the biome dictionnary the biome with that specific name.
blockList[] is where you send the list of block for your biome, in the exemple I used there was 3 tile.
Code:
AddBlockInBiome(biomeName, String[] blockList);
blockList[] is where you send the list of block for your biome, in the exemple I used there was 3 tile.
Sicne version 0.3, you can make your biome exist if certain condition are met other than tile requirement.
For exemple, you make a biome that will only register if moon lord is dead, well you can! I'll show an exemple of code here:
Code:
BiomeLibs.setCondition(String biomeName, Func<bool> condition);
For exemple, you make a biome that will only register if moon lord is dead, well you can! I'll show an exemple of code here:
Code:
public override void Initialize()
{
Func<bool> condition = () => NPC.downedMoonlord;
BiomeLibs.RegisterNewBiome("Meteoridon", 50, mod);
BiomeLibs.AddBlockInBiome("Meteoridon", new String[] { "MeteoridonStone", "MeteoridonGrass", "BrownIce" });
BiomeLibs.addHallowAltBiome("Meteoridon");
BiomeLibs.setCondition("Meteoridon", condition);
//Totally not taken from TUA
}
This method is rather simple as it add your biome name to the hallow alt list, but there is actually more than that involved. When you trigger hardmode, the mod itself will an alt that been added and then will search in the block list of the biome. There is a function called block finder that will search for block name in the list containing these string: Grass, Stone, Ice, Dirt and Sand (Gonna add more later, but nor now)
Currently do note that it doesn't support wall as I'm not there yet in TUA (wich is my testing mod for this).
biomeName is the name of the biome you wanna add to the list.
Currently do note that it doesn't support wall as I'm not there yet in TUA (wich is my testing mod for this).
Code:
addHallowAltBiome(String biomeName);
So now that the registery part is done, let's go on the detection method (currently only, maybe gonna add more?)
Code:
[code]InBiome(String biomeName)
public override void UpdateMusic(ref int music)
{
if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active)
{
if (BiomeLibs.InBiome("Meteoridon"))
{
music = MusicID.TheHallow;
}
}
}
[/code]
Here an example of how you mod world would look :
The following code is taken directly from TUA
Code:
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 TerrariaUltraApocalypse
{
class TUAWorld : ModWorld
{
public override void Initialize()
{
//Those register method are only there to make the code clean, you can honestly include everything in here (but it won't be as clean)
RegisterPlagues();
RegisterMeteoridon();
}
private void RegisterPlagues()
{
BiomeLibs.RegisterNewBiome("Plagues", 50, mod);
BiomeLibs.AddBlockInBiome("Plagues", new String[] { "ApocalypseDirt" });
}
private void RegisterMeteoridon()
{
Func<bool> c = () => Main.hardMode;
BiomeLibs.RegisterNewBiome("Meteoridon", 50, mod);
BiomeLibs.AddBlockInBiome("Meteoridon", new String[] { "MeteoridonStone", "MeteoridonGrass", "BrownIce" });
BiomeLibs.addHallowAltBiome("Meteoridon", "The world is getting fiery...");
BiomeLibs.SetCondition("Meteoridon", c);
}
}
}
This is probably the best exemple I can give right here as for now. It's really simple as it go by biome name.
So now that the explanation are done, here something you need to know as it's really important: you must use strong reference or it won't work, so add the following line.
Code:
modReferences = BiomeLibrary
As of v0.3.1, the mod now give you access to easily detect vanilla biome.
Code:
Biomelibs.InBiome("hell");
Biomelibs.InBiome("granite");
Biomelibs.InBiome("marble");
To do:
- Adding AddMobToSpawnPool(string biomeName, int[] mobID, int[] mobSpawnChance)
- Adding EditSpawnRate(string biomeName, int maxEnemySpawn, int spawnrate)
- Adding AddMobToSpawnPool(string biomeName, int[] mobID, int[] mobSpawnChance)
- Adding EditSpawnRate(string biomeName, int maxEnemySpawn, int spawnrate)
To do list:
- Clean code (yeah, really need to clean this mess I made, but it work )
- Add Sandstone, Snow and wall support for hallow alt
- Add Wall support for biome
- Add GlobalNPC edit spawn pool (v0.4, drawing board phase)
- Add background support (v0.5)
---------------------------------------------------
Credit:
- Me, for making this mod
- My friend @jsx542 , for making a better block detection code, this saved me a lot of time
- Re-Logic for making this awesome game
- My friend @blushiemagic , for making tmod, this wouldn't be possible without you!
--------------------------------------------------
You may use this "mod" as long you provide the proper credit
--------------------------------------------------
Download link v0.4: To be updated
Source : TUA-Team/BiomeLibrary
Discord (TUA team discord) : Join the Realm of Infinity (TUA) Discord Server!
PS: Sorry that you had to read trough this terrible grammar, I'm trying to improve everyday
Last edited: