Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.2] Can't find Modded Biome


Dalibe
 Share

Recommended Posts

I've made a new biome trying to make a mod about exploration. But i don't know if i'm just unlucky and never found my biome, or it,s just not appearing.

 

Here's my code for the Biome:

package com.dalibe.study.biome;

import net.minecraft.world.biome.BiomeGenBase;

public class DarkyBiomeClass extends BiomeGenBase {

public DarkyBiomeClass(int id) {
	super(id);

	this.heightVariation = 2F;
	this.rootHeight = 2F;
	this.waterColorMultiplier = 0xffffff;
	this.temperature = 0.5F;
	this.enableRain = true;
	System.out.println("Darky Biome found");
}
}

 

Here's my declaration of the Biome :

public static BiomeGenBase DarkyBiome = new DarkyBiomeClass(150).setBiomeName("DarkyBiome").setColor(0x223263);

 

And here's the code to add it to the game:

BiomeManager.addSpawnBiome(DarkyBiome);

 

I've put in the biome class a System.out.printIn(); to be sure that the class is detected and it is, the message appears in the console.

 

So, have i miss a step some where and is there a way to isolate the biome, a way to create a world with a chosen list of biome so i can test them individualy?

Link to comment
Share on other sites

You need to do

GameRegistry.addBiome(biome);

(which is a wrapper method for this line, you might as well also use this one)

WorldType.NORMAL.addNewBiome(biome);

 

above your BiomeManager.addSpawnBiome (<- this only adds the biome to a list for the initial player spawn algorithm to choose from, upon world creation)

 

Please note that this only adds them to the normal world type, to have your biome in the large biomes worldtype, too, add this line:

WorldType.LARGE_BIOMES.addNewBiome(biome);

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

I don't get why, but when i try GameRegistry.addBiome(DarkyBiome);  addBiome is highlighed «The method addBiome(BiomeGenBase) is undefined for the type GameRegistry»

 

Even the two other lines you gave me. They worked in 1.6.4 though.

 

(I'm working with Forge 1.7.2 10.12.0.1024)

Link to comment
Share on other sites

Go into the BiomeGenBase Class, and on one of the first lines, it has an list of all the biomes, so cut that, type in your modname.biomename. Like: Awesome.CoolBiome

 

This forces it to load in you spawn area. also, if you are using a custom block, make sure the id is under 256. That helped me a lot.

Link to comment
Share on other sites

  • 3 weeks later...

I did a bit more investigating and it seems the spawnable biomes in the default world type are all hardcoded in GenLayerBiome.  :'(

 

Wait, so this doesn't work in 1.7.2 anymore?

WorldType.NORMAL.addNewBiome(biome);

 

AFAIK, the spawnable biomes list is just an indicator for the player spawn algorithm to determine the spawning biome.

 

EDIT: I must apologize, the right field isn't NORMAL but DEFAULT:

WorldType.DEFAULT.addNewBiome(biome);

 

For large biomes, you must also add

WorldType.LARGE_BIOMES.addNewBiome(biome);

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

I did a bit more investigating and it seems the spawnable biomes in the default world type are all hardcoded in GenLayerBiome.  :'(

 

Wait, so this doesn't work in 1.7.2 anymore?

WorldType.NORMAL.addNewBiome(biome);

 

AFAIK, the spawnable biomes list is just an indicator for the player spawn algorithm to determine the spawning biome.

 

EDIT: I must apologize, the right field isn't NORMAL but DEFAULT:

WorldType.DEFAULT.addNewBiome(biome);

 

For large biomes, you must also add

WorldType.LARGE_BIOMES.addNewBiome(biome);

 

except this DOESN'T work either! Same error. I looked at the code and the .addnewbiome is turned into comments. is it because I'm running 1024?

Does anyone know the actual code here?

Link to comment
Share on other sites

  • 2 weeks later...

This doesn't going to work because the method is commented in the Code ...

 


/*    public BiomeGenBase[] getBiomesForWorldType() {
        return biomesForWorldType;
    }

    public void addNewBiome(BiomeGenBase biome)
    {
        Set<BiomeGenBase> newBiomesForWorld = Sets.newLinkedHashSet(Arrays.asList(biomesForWorldType));
        newBiomesForWorld.add(biome);
       biomesForWorldType = newBiomesForWorld.toArray(new BiomeGenBase[0]);
    }

    public void removeBiome(BiomeGenBase biome)
    {
        Set<BiomeGenBase> newBiomesForWorld = Sets.newLinkedHashSet(Arrays.asList(biomesForWorldType));
        newBiomesForWorld.remove(biome);
        biomesForWorldType = newBiomesForWorld.toArray(new BiomeGenBase[0]);
    }
*/

Link to comment
Share on other sites

Way I got mine working (this is all in my @Mod file):

public static final BiomeGenBase example = new BiomeGenExample().setBiomeName("Example Biome");

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
     BiomeDictionary.registerBiomeType(example, Type.FOREST);
     BiomeManager.addSpawnBiome(example);
}

My ID is coded into the super call in the BiomeGenExample file.

Link to comment
Share on other sites

Way I got mine working (this is all in my @Mod file):

public static final BiomeGenBase example = new BiomeGenExample().setBiomeName("Example Biome");

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
     BiomeDictionary.registerBiomeType(example, Type.FOREST);
     BiomeManager.addSpawnBiome(example);
}

My ID is coded into the super call in the BiomeGenExample file.

 

 

I will test it, if it works too. Hold on :P

 

edit:

Didn't find it yet ._.

Link to comment
Share on other sites

  • 2 months later...

Hello, all!

 

I am brand new and this is my first post. I am also new to modding Minecraft(But certainly not new to programming). I hope this isn't considered resurrecting an old thread, seems recent enough.

 

I am using Forge Source 1.7.2-10.12.2.1121.jar(Not sure if that's the best way to get the version, just looked in my reference libraries in eclipse to get this filename).

 

Anyways - I have been trying to add a custom biome, following the advice on this thread(And some others I have found), I think I am doing every step required, but I could never find my biome, so I tried to short circuit the system and force my biome to be the spawn biome - in which case I get a cannot find spawn biome error and it drops me in some other random biome. This leads me to believe the biome is still not registered correctly, especially since I have successfully forced other biomes to be the spawn biome.

 

@Mod file

import static net.minecraft.world.biome.BiomeGenBase.forestHills;

...

@Mod(modid = Utilities.MODID, version = Utilities.VERSION)
public class MyModName
{
    public static final BiomeGenBase _myBiome = new MyBiomeGen(150).setBiomeName("MyBiome");
    @EventHandler
    public void preInit(FMLInitializationEvent event)
    {
        BiomeDictionary.registerBiomeType(_myBiome, Type.DESERT, Type.WASTELAND);
        BiomeManager.addSpawnBiome(_myBiome);

        // This is how I force spawn biome, again this works with forestHills, but if it rolls my biome it cannot find it
        WorldChunkManager.allowedBiomes.clear();
        WorldChunkManager.allowedBiomes = new ArrayList<BiomeGenBase>(Arrays.asList(forestHills, _myBiome));
    }

    ...

}

 

The biome code itself is very simple, but if it works, it should be quite obvious with a top layer of glass:

public class MyBiomeGen extends BiomeGenBase
{
    public MyBiomeGen(int id)
    {
        super(id);
        this.topBlock = Blocks.glass;
        this.fillerBlock = Blocks.sand;
    }
}

 

Thank you in advance for any assistance - let me know if you need me to post additional information.

Link to comment
Share on other sites

Thanks, but unfortunately this did not seem to have an effect.

 

I did some more digging and found the error is being logged in WorldServer, function createSpawnPosition(). The variable chunkposition must be coming back null from the call to worldchunkmanager.findBiomePosition(). It seems odd to me that the game actually looks to be creating the world first, then it locates a nearby biome of the selected spawn biome type to drop you in, rather than just force the first biome it generates to be the selected spawn biome then building the world out from there - but that's beside the point. However this does mean the biome I created must not be working because it's not being created anywhere nearby and thus not found.

 

It seems the function findBiomePosition is all obfuscated in my source, so I can't tell entirely what it is doing. While I am able to edit the java WorldServer, it's not a class file, so it ends up not recompiling. So I can't even logger.debug or logger.warn to get some answers. Tracing back it looks like findBiomePosition is drawing data from a class variable called genBiomes which is a GenLayer, generated from sub 0 of "agenlayer" which is an array of GenLayers pulled from two steps, firstly a declaration from GenLayer.initializeAllBiomGenerators, and then assigned a second time from a call to getModdedBiomeGenerators, which also accepts the array as a parameter, only to pass it to WorldTypeEvent.InitBiomeGens(). From there it just gets worse. So... Anyways, I'm getting pretty confused by all the code - if it had comments maybe it wouldn't be so bad, or if I wasn't new to modding minecraft and had a better idea of why certain things were happening I don't know - either way, this is getting frustrating and I can't help but think there must be an easier way to do this.

 

Could it be @GotoLink was right? Do I need to create/register a new world type? Is this a simpler process?

 

Additionally, I don't want to do anything that couldn't end up being easily dropped into existing mod packs like Tekkit or FTB, so I don't want super shortcut answers that ruin the potential of the mod to play well with others.

Link to comment
Share on other sites

Hold up - after setting weight from 10 to 100(Set to 10 originally because that seemed to be the norm when looking at the others added in BiomeManager) - now I've got my spawn biome.

 

What exactly does weight define? I'm used to percentages being expressed in floating point between 0 and 1 - but it does seem a lot of the chances for things in minecraft are actually int-based - how did changing weight from integer 10 to integer 100 fix the not found problem????

 

Thanks in advance

Link to comment
Share on other sites

I can't swear to it, but this looks like the same kind of table-based weighting system I'm familiar with from other games; it's designed for extensibility.

 

Basically, you have a stack/list/whatever of your possible options, each assigned a numeric weight (default 1). When the game needs something from the list, it generates a random number between 1 and $sum_of_weights, and counts up the list until it finds the item with that number.

 

Simplest case: you have one item the table. Game generates a random number between 1 and 1, gets 1 (naturally), picks the only item off the table. Tada.

 

Slightly more sophisticated case: you have three items on the table:

Item

Weight

Grasslands

3

Forest

5

Ocean

8

 

The total for this table is 16, so the game generates a random number between 1 and 16 (inclusive). If it gets a 1, 2, or 3, it picks Grasslands. If it gets a 4, 5, 6, 7, or 8, it picks Forest. If it gets 9 or above, it picks Ocean.

 

So you come along and add a new biome ("Jungle") and weight it at 1 (default). Now the table looks like this:

 

Item

Weight

Grasslands

3

Forest

5

Ocean

8

Jungle

1

 

Now the sum is 17, and your biome only has a 1/17 chance of coming up. But if you change the jungle weight to 100, now your biome has a 100/116 chance of coming up, and is going to be showing up all over the freeking place.

 

EDIT: The benefit of this system is that you don't need to know how many items are going to be on the list when you assign weights to different things; working with percentages directly means you always need to keep recalculating each item in the table to squeeze a new one into your table. Also, floating point numbers, ick.

Instead, this table type lets you just keep pushing new items onto the table end, without editing any of the previous items. If you want to increase the weight of a previous item (say, you want more Jungles), you don't even have to edit it - just keep adding more copies of it to the table end.

Link to comment
Share on other sites

Thanks, Syndaryl, that does make sense.

 

I have confirmed that if I reduced the weight to 10 I get a not found, putting it to 100 works. Even understanding the weight system it seems broken that I have to raise the weight to force the spawn biome, but I guess that goes back to how Minecraft finds the spawn biome rather than generates it intentionally.

 

Knowing that in practice you don't(And shouldn't) force a biome spawn on the final mod release, then I'll just move on. At least I got it working so I can test more easily.

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.