Jump to content

Recommended Posts

Posted

Whenever I run my mod it crashes and points to the line of code:

 

  Reveal hidden contents

 

I have added a mob to the game and this is it's spawn method

I don't know how to fix it :(

Posted

Crash Report

 

  Reveal hidden contents

 

Posted

Changing 

EntityRegistry.addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, BiomeGenBase.biomelist);

to

EntityRegistry.addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, BiomeGenBase.desert);

fixes the problem, but i want it to be able to spawn in all biomes, except the nether or end

 

 

Posted

Fixed it by using

                    EntityRegistry

                .addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, BiomeGenBase.BIOMENAME);

for each biome, tedious but works

Posted

You can also use this code to make sure you really catch every biome (even modded ones)

	ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>();
	for( BiomeGenBase biome : BiomeGenBase.biomeList ) {
		if( biome != null ) {
			biomes.add(biome);
		}
	}
	EntityRegistry.addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, biomes.toArray(BiomeGenBase.biomeList));

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

  Quote

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.

Posted
  On 3/17/2014 at 11:39 AM, diesieben07 said:

Or, for the really fancy people:

 

BiomeGenBase allBiomes = Iterators.toArray(Iterators.filter(Iterators.forArray(BiomeGenBase.biomeslist), Predicates.notNull()), BiomeGenBase.class);

 

Guava & Functional Programming ftw!

 

oh, you can use Predicates with Guava? Good to know :D

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

  Quote

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.

Posted

If you are on 1.7.2 then here is what I do:

BiomeGenBase[] allBiomes = Iterators.toArray(Iterators.filter(Iterators.forArray(BiomeGenBase.getBiomeGenArray()),
			Predicates.notNull()), BiomeGenBase.class);

Posted

public static BiomeGenBase[] biomes = new BiomeGenBase[]{BiomeGenBase.plains, BiomeGenBase.extremeHills, BiomeGenBase.beach, BiomeGenBase.desert,

BiomeGenBase.desertHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.river,

BiomeGenBase.birchForest, BiomeGenBase.birchForestHills, BiomeGenBase.coldBeach, BiomeGenBase.coldTaiga, BiomeGenBase.coldTaigaHills, BiomeGenBase.deepOcean,

BiomeGenBase.extremeHillsPlus, BiomeGenBase.jungleEdge, BiomeGenBase.megaTaiga, BiomeGenBase.megaTaigaHills, BiomeGenBase.mesa, BiomeGenBase.mesaPlateau, BiomeGenBase.mesaPlateau_F, BiomeGenBase.roofedForest, BiomeGenBase.savanna, BiomeGenBase.savannaPlateau, BiomeGenBase.stoneBeach};

 

EntityRegistry.addSpawn(mob.class, group, min, max, type, biomes);

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Posted
  On 3/25/2014 at 6:27 AM, The_SlayerMC said:

public static BiomeGenBase[] biomes = new BiomeGenBase[]{BiomeGenBase.plains, BiomeGenBase.extremeHills, BiomeGenBase.beach, BiomeGenBase.desert,

BiomeGenBase.desertHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.river,

BiomeGenBase.birchForest, BiomeGenBase.birchForestHills, BiomeGenBase.coldBeach, BiomeGenBase.coldTaiga, BiomeGenBase.coldTaigaHills, BiomeGenBase.deepOcean,

BiomeGenBase.extremeHillsPlus, BiomeGenBase.jungleEdge, BiomeGenBase.megaTaiga, BiomeGenBase.megaTaigaHills, BiomeGenBase.mesa, BiomeGenBase.mesaPlateau, BiomeGenBase.mesaPlateau_F, BiomeGenBase.roofedForest, BiomeGenBase.savanna, BiomeGenBase.savannaPlateau, BiomeGenBase.stoneBeach};

 

EntityRegistry.addSpawn(mob.class, group, min, max, type, biomes);

 

Why?

The solution was already provided previously, what's different in your code?

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

  Quote

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.

  • 10 months later...
Posted

Let me dig it up, since it shows in search, so someone might want to use it.

 

I'm coding for 1.7.10 and BiomeGenBase.biomesList is not availble directly, there is a method .getBiomeGenArray() that returns it.

 

Also EntityRegistry.addSpawn() wants BiomeGenBase[] as param, not ArrayList<BiomeGenBase>

 

I did it like that :

ArrayList<BiomeGenBase> all_biomesList = new ArrayList<BiomeGenBase>();
	for( BiomeGenBase biome : BiomeGenBase.getBiomeGenArray() ) {
		if( biome != null ) {
			all_biomesList.add(biome);
		}
	}
	BiomeGenBase[] all_biomes_array = new BiomeGenBase[all_biomesList.size()]; // type casting from List to array and stuff
	this.all_biomes = all_biomesList.toArray(all_biomes_array);

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.