Posted April 28, 20178 yr I'm looking for the proper way to get my custom mobs to spawn in Minecraft 1.11.2 using the Biome Dictionary (so as to be compatible with mods like Biomes'o'Plenty). How is this done?
April 28, 20178 yr Author I have over 10 mobs I'd like to spawn in various places. I see tags like "Wasteland," "Hot," "Sandy," and "Snowy" among other types I would like to use. And if possible, be able to set up checks to make sure mobs don't spawn in unintended places such as a "Snowy" and "Forest" mob not to spawn in Ice Plains or Roofed Forests for example. Setting spawn frequency would be great too.
April 28, 20178 yr Author I tried this but it doesn't seem to work: Set<Biome> biomes; Iterator<Biome> biomeIterator; biomes = BiomeDictionary.getBiomes(Type.SANDY); biomeIterator = biomes.iterator(); while(biomeIterator.hasNext()) { Biome currentBiome = biomeIterator.next(); currentBiome.getSpawnableList(EnumCreatureType.MONSTER).add(new SpawnListEntry(EntityZerglingNincada.class, 590, 3, 6)); currentBiome.getSpawnableList(EnumCreatureType.MONSTER).add(new SpawnListEntry(EntityRaptorZerglingNincada.class, 555, 3, 5)); currentBiome.getSpawnableList(EnumCreatureType.MONSTER).add(new SpawnListEntry(EntityCracklingNincada.class, 30, 3, 5)); } I then tested biomes.isEmpty() and it returned True. Is this the wrong way to approach the Biome set like this?
April 28, 20178 yr It seems that there is a bug in the BiomeDictionary class somehow? Spoiler I tested it and I also get empty set for any biome type. Through the magic of breakpoints I was able to figure that it happens because of the BiomeDictionary::listSupertypes method, specifically the if condition in the while loop (line 392). The first statement of the condition is never true as by default the subTypes list is empty for any type but the WATER type. Thus the supertypes set is always empty, thus the iteration in the addTypes will never happen. Later down the line it acutally adds the types to the biomeInfo object but that is internal. and is a biome->type mapping, not the reverse. And is private anyway. In short the BiomeDictionary.Type instance never gets any objects added to it unless there are supertypes registered for it which is never true at <clinit>(the static block which initializes the biome assignment for the first time) for everything but the WATER type. At least it seems to be this way for me, I might be mistaken as my forge version is not the most recent(I'm 2 versions behind). If I am, I am sorry. For the FuzzyAcornIndustries: You can iterate through the biome registry and use the BiomeDictionary::getTypes(Biome) method to obtain the types for that specific biome, that should work (works for me). Then you would check if the obtained set contains your desired biome type and add it that way. Edited April 28, 20178 yr by V0idWa1k3r
April 29, 20178 yr Author 27 minutes ago, V0idWa1k3r said: You can iterate through the biome registry and use the BiomeDictionary::getTypes(Biome) method to obtain the types for that specific biome, that should work (works for me). Then you would check if the obtained set contains your desired biome type and add it that way. I'm not quite sure how you would do that. Do you perhaps have a text example you could share? It does sound like an attractive way to try over the above one when they have to meet multiple criteria. "::" is not a something I'm familiar with either. What is that?
April 29, 20178 yr :: is simply a way to write method names ClassName::MethodName As for the code example I suppose it would look something like this: Multimap<BiomeDictionary.Type, Biome> biomesAndTypes = HashMultimap.create(); for (Biome b : Biome.REGISTRY) { Set<BiomeDictionary.Type> types = BiomeDictionary.getTypes(b); for (BiomeDictionary.Type t : types) { biomesAndTypes.put(t, b); } } EntityRegistry.addSpawn(YourMonsterEntityClass.class, weight, min, max, EnumCreatureType.MONSTER, biomesAndTypes.get(BiomeDictionary.Type.SANDY).toArray(new Biome[biomesAndTypes.get(BiomeDictionary.Type.SANDY).size()])); Or for something more specific(in this case the entity is only allowed to spawn at sandy biomes which are not cold) List<Biome> criteriaMet = Lists.newArrayList(); for (Biome b : Biome.REGISTRY) { Set<BiomeDictionary.Type> types = BiomeDictionary.getTypes(b); if (types.contains(BiomeDictionary.Type.SANDY) && !types.contains(BiomeDictionary.Type.COLD)) { criteriaMet.add(b); } } EntityRegistry.addSpawn(YourMonsterEntityClass.class, weight, min, max, EnumCreatureType.MONSTER, criteriaMet.toArray(new Biome[criteriaMet.size()])); Edited April 29, 20178 yr by V0idWa1k3r
April 29, 20178 yr Author Thanks Voidwalker! I really like that way of doing it. My code turned out a lot cleaner than I was thinking it would. And thanks for sharing that way of using Java for that loop. My Java knowledge is very archaic/simplistic so that isn't something I knew about.
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.