Jump to content

[1.7.10] New Type to BiomeDictionary


gottsch

Recommended Posts

I was looking to differentiate between Ocean and Deep Ocean by assigning a new biome Type to BiomeGenBase.deepOcean by using the following code snippet:

 

Type deepOcean = BiomeDictionary.Type.getType("DEEP OCEAN");
BiomeDictionary.registerBiomeType(BiomeGenBase.deepOcean, deepOcean);

 

However, I get this error:

 

java.lang.ArrayIndexOutOfBoundsException: 31
at net.minecraftforge.common.BiomeDictionary.registerBiomeType(BiomeDictionary.java:152)
...

 

It's like array to store the biome types isn't being resized. Anyone know the way to do this?

Link to comment
Share on other sites

So apparently, if I'm reading the code correctly, you can not add new BiomeDictionary.Type's as there is a private list whose length is set.

 private static ArrayList[] typeInfoList = new ArrayList[Type.values().length];

That length is not updated when calling registerBiomeType.

 public static boolean registerBiomeType(BiomeGenBase biome, Type ... types)
{
types = listSubTags(types);

if(BiomeGenBase.getBiomeGenArray()[biome.biomeID] != null)
{
for(Type type : types)
{
if(typeInfoList[type.ordinal()] == null)
{
typeInfoList[type.ordinal()] = new ArrayList();
}

typeInfoList[type.ordinal()].add(biome);
}

if(biomeList[biome.biomeID] == null)
{
biomeList[biome.biomeID] = new BiomeInfo(types);
}
else
{
for(Type type : types)
{
biomeList[biome.biomeID].typeList.add(type);
}
}

return true;
}

return false;
}

My code in the first post fails at: typeInfoList[type.ordinal()].add(biome);

 

So, my thought was to extend the BiomeDictionary and override this method to work properly, but I didn't know if it then would still work with other mods that register new biomes?

Link to comment
Share on other sites

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.