Jump to content

[1.7.2]Best way to add an entity spawn


burnner

Recommended Posts

Hello,

what's the proper way to add a spawn?

Is that the right way:

 

EntityRegistry.addSpawn(EntityPig2.class, 1, 1, 1, EnumCreatureType.creature, BiomeGenBase.desert,

                    BiomeGenBase.desertHills,

                    BiomeGenBase.extremeHills,

                    BiomeGenBase.extremeHillsEdge,

                    BiomeGenBase.forest,

                    BiomeGenBase.forestHills,

                    BiomeGenBase.frozenOcean,

                    BiomeGenBase.frozenRiver,

                    BiomeGenBase.hell,

                    BiomeGenBase.iceMountains,

                    BiomeGenBase.icePlains,

                    BiomeGenBase.jungle,

                    BiomeGenBase.jungleHills,

                    BiomeGenBase.mushroomIsland,

                    BiomeGenBase.ocean,

                    BiomeGenBase.plains,

                    BiomeGenBase.river,

                    BiomeGenBase.swampland,

                    BiomeGenBase.taiga);

 

 

 

burnner

Link to comment
Share on other sites

EntityRegistry.addSpawn(EntityPig2.class, 1, 1, 1, EnumCreatureType.creature, BiomeGenBase.biomeList);

 

No, this will crash, since biomeList contains null values!

Look here for a solution:

http://www.minecraftforge.net/forum/index.php/topic,17455.msg88353.html#msg88353

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

there's no "biomList"

Also since when is biomeList not visible?

You checked the BiomeGenBase class for it and made sure it's really not visible? If it isn't, is there a getter method?

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

there's no "biomList"

Also since when is biomeList not visible?

You checked the BiomeGenBase class for it and made sure it's really not visible? If it isn't, is there a getter method?

Eclipse says it's not visibile

 

Well, then it's changed in 1.7. Use sequituri's suggestion then.

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

Use this:

public static BiomeGenBase[] biomesWithout(BiomeGenBase... biomesWithout){
        ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>();
        for(BiomeGenBase biome : BiomeGenBase.biomeList){
            for(int i = 0; i < biomesWithout.length; i++){
                if(biome != null && biome != biomesWithout[i]){
                    biomes.add(biome);
                }
            }
        }
        return biomes.toArray(new BiomeGenBase[biomes.size()]);
    }

And:

EntityRegistry.addSpawn(EntityPig2.class, 1, 1, 1, EnumCreatureType.creature, biomesWithout(/** here write biomes in which the mob will not spawn */));

Link to comment
Share on other sites

  • 1 month 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
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.



×
×
  • Create New...

Important Information

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