diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index 6f42ec509..2829d0d40 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -227,16 +227,16 @@ vector *Biome::getMobs(MobCategory *category) if (app.GetGameHostOption(eGameHostOption_NoMobCap)) { // Only input into this if necessary, this should be after all others are set up for this biome as well - if (allFriendlies.empty()) { + if (all_friendlies.empty()) { // If empty, reserve the combined size of all mob spawner data - allFriendlies.reserve(friendlies.size() + friendlies_chicken.size() + friendlies_wolf.size() + friendlies_mushroomcow.size()); - // Combine each vector into allFriendlies - allFriendlies.insert(allFriendlies.end(), friendlies.begin(), friendlies.end()); - allFriendlies.insert(allFriendlies.end(), friendlies_chicken.begin(), friendlies_chicken.end()); - allFriendlies.insert(allFriendlies.end(), friendlies_wolf.begin(), friendlies_wolf.end()); - allFriendlies.insert(allFriendlies.end(), friendlies_mushroomcow.begin(), friendlies_mushroomcow.end()); + all_friendlies.reserve(friendlies.size() + friendlies_chicken.size() + friendlies_wolf.size() + friendlies_mushroomcow.size()); + // Combine each vector into all_friendlies + all_friendlies.insert(all_friendlies.end(), friendlies.begin(), friendlies.end()); + all_friendlies.insert(all_friendlies.end(), friendlies_chicken.begin(), friendlies_chicken.end()); + all_friendlies.insert(all_friendlies.end(), friendlies_wolf.begin(), friendlies_wolf.end()); + all_friendlies.insert(all_friendlies.end(), friendlies_mushroomcow.begin(), friendlies_mushroomcow.end()); } - return &allFriendlies; // Use combined vector when using Java logic + return &all_friendlies; // Use combined vector when using Java logic } return &friendlies; } diff --git a/Minecraft.World/Biome.h b/Minecraft.World/Biome.h index 50446fedc..4cb77f7ff 100644 --- a/Minecraft.World/Biome.h +++ b/Minecraft.World/Biome.h @@ -82,7 +82,7 @@ public: protected: vector enemies; - vector allFriendlies; // Added to not have to recombine with other groups every time spawner data is used + vector all_friendlies; // Added to not have to recombine with other groups every time spawner data is used vector friendlies; vector waterFriendlies; vector friendlies_chicken; diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index 6a65e3f25..d205f5f5e 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/Level.cpp @@ -4707,52 +4707,52 @@ bool Level::canCreateMore(eINSTANCEOF type, ESPAWN_TYPE spawnType) { case eTYPE_VILLAGER: count = countInstanceOf( eTYPE_VILLAGER, true); - max = MobCategory::maxVillagersWithSpawnEgg; + max = MobCategory::max_villagers_with_spawn_egg; break; case eTYPE_CHICKEN: count = countInstanceOf( eTYPE_CHICKEN, true); - max = MobCategory::maxChickensWithSpawnEgg; + max = MobCategory::max_chickens_with_spawn_egg; break; case eTYPE_WOLF: count = countInstanceOf( eTYPE_WOLF, true); - max = MobCategory::maxWolvesWithSpawnEgg; + max = MobCategory::max_wolves_with_spawn_egg; break; case eTYPE_MUSHROOMCOW: count = countInstanceOf( eTYPE_MUSHROOMCOW, true); - max = MobCategory::maxMushroomCowsWithSpawnEgg; + max = MobCategory::max_mushroomcows_with_spawn_egg; break; case eTYPE_SQUID: count = countInstanceOf( eTYPE_SQUID, true); - max = MobCategory::maxSquidsWithSpawnEgg; + max = MobCategory::max_squids_with_spawn_egg; break; case eTYPE_SNOWMAN: count = countInstanceOf( eTYPE_SNOWMAN, true); - max = MobCategory::maxSnowGolems; + max = MobCategory::max_snow_golems; break; case eTYPE_VILLAGERGOLEM: count = countInstanceOf( eTYPE_VILLAGERGOLEM, true); - max = MobCategory::maxIronGolems; + max = MobCategory::max_iron_golems; break; case eTYPE_WITHERBOSS: count = countInstanceOf(eTYPE_WITHERBOSS, true) + countInstanceOf(eTYPE_ENDERDRAGON, true); - max = MobCategory::maxBosses; + max = MobCategory::max_bosses; break; default: if((type & eTYPE_ANIMALS_SPAWN_LIMIT_CHECK) == eTYPE_ANIMALS_SPAWN_LIMIT_CHECK) { count = countInstanceOf( eTYPE_ANIMALS_SPAWN_LIMIT_CHECK, false); - max = MobCategory::maxAnimalsWithSpawnEgg; + max = MobCategory::max_animals_with_spawn_egg; } // 4J: Use eTYPE_ENEMY instead of monster (slimes and ghasts aren't monsters) else if(Entity::instanceof(type, eTYPE_ENEMY)) { count = countInstanceOf(eTYPE_ENEMY, false); - max = MobCategory::maxMonstersWithSpawnEgg; + max = MobCategory::max_monsters_with_spawn_egg; } else if( (type & eTYPE_AMBIENT) == eTYPE_AMBIENT) { count = countInstanceOf( eTYPE_AMBIENT, false); - max = MobCategory::maxAmbientWithSpawnEgg; + max = MobCategory::max_ambient_with_spawn_egg; } // 4J: Added minecart and boats else if (Entity::instanceof(type, eTYPE_MINECART)) @@ -4773,25 +4773,25 @@ bool Level::canCreateMore(eINSTANCEOF type, ESPAWN_TYPE spawnType) { case eTYPE_VILLAGER: count = countInstanceOf( eTYPE_VILLAGER, true); - max = MobCategory::maxVillagersWithBreeding; + max = MobCategory::max_villagers_with_breeding; break; case eTYPE_CHICKEN: count = countInstanceOf( eTYPE_CHICKEN, true); - max = MobCategory::maxChickensWithBreeding; + max = MobCategory::max_chickens_with_breeding; break; case eTYPE_WOLF: count = countInstanceOf( eTYPE_WOLF, true); - max = MobCategory::maxWolvesWithBreeding; + max = MobCategory::max_wolves_with_breeding; break; case eTYPE_MUSHROOMCOW: count = countInstanceOf( eTYPE_MUSHROOMCOW, true); - max = MobCategory::maxMushroomCowsWithBreeding; + max = MobCategory::max_mushroomcows_with_breeding; break; default: if((type & eTYPE_ANIMALS_SPAWN_LIMIT_CHECK) == eTYPE_ANIMALS_SPAWN_LIMIT_CHECK) { count = countInstanceOf( eTYPE_ANIMALS_SPAWN_LIMIT_CHECK, false); - max = MobCategory::maxAnimalsWithBreeding; + max = MobCategory::max_animals_with_breeding; } else if( (type & eTYPE_MONSTER) == eTYPE_MONSTER) { diff --git a/Minecraft.World/MobCategory.cpp b/Minecraft.World/MobCategory.cpp index e08503ab4..3cbe9f2d9 100644 --- a/Minecraft.World/MobCategory.cpp +++ b/Minecraft.World/MobCategory.cpp @@ -5,32 +5,32 @@ #include "Material.h" #include "MobCategory.h" -int MobCategory::maxNaturalMonsters = 0; -int MobCategory::maxNaturalAnimals = 0; -int MobCategory::maxNaturalAmbient = 0; -int MobCategory::maxNaturalSquid = 0; -int MobCategory::maxNaturalChickens = 0; -int MobCategory::maxNaturalWolves = 0; -int MobCategory::maxNaturalMushroomCows = 0; +int MobCategory::max_natural_monsters = 0; +int MobCategory::max_natural_animals = 0; +int MobCategory::max_natural_ambient = 0; +int MobCategory::max_natural_squid = 0; +int MobCategory::max_natural_chickens = 0; +int MobCategory::max_natural_wolves = 0; +int MobCategory::max_natural_mushroomcows = 0; -int MobCategory::maxSnowGolems = 0; -int MobCategory::maxIronGolems = 0; -int MobCategory::maxBosses = 0; +int MobCategory::max_snow_golems = 0; +int MobCategory::max_iron_golems = 0; +int MobCategory::max_bosses = 0; -int MobCategory::maxAnimalsWithBreeding = 0; -int MobCategory::maxChickensWithBreeding = 0; -int MobCategory::maxMushroomCowsWithBreeding = 0; -int MobCategory::maxWolvesWithBreeding = 0; -int MobCategory::maxVillagersWithBreeding = 0; +int MobCategory::max_animals_with_breeding = 0; +int MobCategory::max_chickens_with_breeding = 0; +int MobCategory::max_mushroomcows_with_breeding = 0; +int MobCategory::max_wolves_with_breeding = 0; +int MobCategory::max_villagers_with_breeding = 0; -int MobCategory::maxAnimalsWithSpawnEgg = 0; -int MobCategory::maxChickensWithSpawnEgg = 0; -int MobCategory::maxWolvesWithSpawnEgg = 0; -int MobCategory::maxMonstersWithSpawnEgg = 0; -int MobCategory::maxVillagersWithSpawnEgg = 0; -int MobCategory::maxMushroomCowsWithSpawnEgg = 0; -int MobCategory::maxSquidsWithSpawnEgg = 0; -int MobCategory::maxAmbientWithSpawnEgg = 0; +int MobCategory::max_animals_with_spawn_egg = 0; +int MobCategory::max_chickens_with_spawn_egg = 0; +int MobCategory::max_wolves_with_spawn_egg = 0; +int MobCategory::max_monsters_with_spawn_egg = 0; +int MobCategory::max_villagers_with_spawn_egg = 0; +int MobCategory::max_mushroomcows_with_spawn_egg = 0; +int MobCategory::max_squids_with_spawn_egg = 0; +int MobCategory::max_ambient_with_spawn_egg = 0; MobCategory *MobCategory::monster = nullptr; MobCategory *MobCategory::creature = nullptr; @@ -64,36 +64,36 @@ void MobCategory::staticCtor() values[5] = creature_chicken; values[6] = creature_mushroomcow; - maxNaturalMonsters = 50; - maxNaturalAnimals = 50; - maxNaturalAmbient = 20; - maxNaturalSquid = 5; - maxNaturalChickens = 8; - maxNaturalWolves = 8; - maxNaturalMushroomCows = 2; - maxSnowGolems = 16; - maxIronGolems = 16; - maxBosses = 1; - maxVillagersWithBreeding = 35; - monster->m_maxPerLevel = maxNaturalMonsters; - creature->m_maxPerLevel = maxNaturalAnimals; - ambient->m_maxPerLevel = maxNaturalAmbient; - waterCreature->m_maxPerLevel = maxNaturalSquid; - creature_wolf->m_maxPerLevel = maxNaturalWolves; - creature_chicken->m_maxPerLevel = maxNaturalChickens; - creature_mushroomcow->m_maxPerLevel = maxNaturalMushroomCows; - maxAnimalsWithBreeding = maxNaturalAnimals + 20; - maxChickensWithBreeding = maxNaturalChickens + 8; - maxMushroomCowsWithBreeding = maxNaturalMushroomCows + 20; - maxWolvesWithBreeding = maxNaturalWolves + 8; - maxAnimalsWithSpawnEgg = maxAnimalsWithBreeding + 20; - maxChickensWithSpawnEgg = maxChickensWithBreeding + 10; - maxWolvesWithSpawnEgg = maxWolvesWithBreeding + 10; - maxMonstersWithSpawnEgg = maxNaturalMonsters + 20; - maxVillagersWithSpawnEgg = maxVillagersWithBreeding + 15; - maxMushroomCowsWithSpawnEgg = maxMushroomCowsWithBreeding + 8; - maxSquidsWithSpawnEgg = maxNaturalSquid + 8; - maxAmbientWithSpawnEgg = maxNaturalAmbient + 8; + max_natural_monsters = 50; + max_natural_animals = 50; + max_natural_ambient = 20; + max_natural_squid = 5; + max_natural_chickens = 8; + max_natural_wolves = 8; + max_natural_mushroomcows = 2; + max_snow_golems = 16; + max_iron_golems = 16; + max_bosses = 1; + max_villagers_with_breeding = 35; + monster->m_maxPerLevel = max_natural_monsters; + creature->m_maxPerLevel = max_natural_animals; + ambient->m_maxPerLevel = max_natural_ambient; + waterCreature->m_maxPerLevel = max_natural_squid; + creature_wolf->m_maxPerLevel = max_natural_wolves; + creature_chicken->m_maxPerLevel = max_natural_chickens; + creature_mushroomcow->m_maxPerLevel = max_natural_mushroomcows; + max_animals_with_breeding = max_natural_animals + 20; + max_chickens_with_breeding = max_natural_chickens + 8; + max_mushroomcows_with_breeding = max_natural_mushroomcows + 20; + max_wolves_with_breeding = max_natural_wolves + 8; + max_animals_with_spawn_egg = max_animals_with_breeding + 20; + max_chickens_with_spawn_egg = max_chickens_with_breeding + 10; + max_wolves_with_spawn_egg = max_wolves_with_breeding + 10; + max_monsters_with_spawn_egg = max_natural_monsters + 20; + max_villagers_with_spawn_egg = max_villagers_with_breeding + 15; + max_mushroomcows_with_spawn_egg = max_mushroomcows_with_breeding + 8; + max_squids_with_spawn_egg = max_natural_squid + 8; + max_ambient_with_spawn_egg = max_natural_ambient + 8; } MobCategory::MobCategory(int maxVar, Material *spawnPositionMaterial, bool isFriendly, bool isPersistent, eINSTANCEOF eBase, bool isSingleType) diff --git a/Minecraft.World/MobCategory.h b/Minecraft.World/MobCategory.h index 69b74853a..1e899bf46 100644 --- a/Minecraft.World/MobCategory.h +++ b/Minecraft.World/MobCategory.h @@ -7,32 +7,32 @@ class MobCategory { public: // 4J - putting constants for xbox spawning in one place to tidy things up a bit - all numbers are per level - static int maxNaturalMonsters; // Max number of enemies (skeleton, zombie, creeper etc) that the mob spawner will produce - static int maxNaturalAnimals; // Max number of animals (cows, sheep, pigs) that the mob spawner will produce - static int maxNaturalAmbient; // Ambient mobs - static int maxNaturalSquid; // Max number of squid that the mob spawner will produce - static int maxNaturalChickens; // Max number of chickens that the mob spawner will produce - static int maxNaturalWolves; // Max number of wolves that the mob spawner will produce - static int maxNaturalMushroomCows; // Max number of mushroom cows that the mob spawner will produce + static int max_natural_monsters; // Max number of enemies (skeleton, zombie, creeper etc) that the mob spawner will produce + static int max_natural_animals; // Max number of animals (cows, sheep, pigs) that the mob spawner will produce + static int max_natural_ambient; // Ambient mobs + static int max_natural_squid; // Max number of squid that the mob spawner will produce + static int max_natural_chickens; // Max number of chickens that the mob spawner will produce + static int max_natural_wolves; // Max number of wolves that the mob spawner will produce + static int max_natural_mushroomcows; // Max number of mushroom cows that the mob spawner will produce - static int maxSnowGolems; // Max number of snow golems that can be created by placing blocks - 4J-PB increased limit due to player requests - static int maxIronGolems; // Max number of iron golems that can be created by placing blocks - 4J-PB increased limit due to player requests - static int maxBosses; // Max number of bosses (enderdragon/wither) + static int max_snow_golems; // Max number of snow golems that can be created by placing blocks - 4J-PB increased limit due to player requests + static int max_iron_golems; // Max number of iron golems that can be created by placing blocks - 4J-PB increased limit due to player requests + static int max_bosses; // Max number of bosses (enderdragon/wither) - static int maxAnimalsWithBreeding; // Max number of animals that we can produce (in total), when breeding - static int maxChickensWithBreeding; // Max number of chickens that we can produce (in total), when breeding/hatching - static int maxMushroomCowsWithBreeding; // Max number of mushroom cows that we can produce (in total), when breeding - static int maxWolvesWithBreeding; // Max number of wolves that we can produce (in total), when breeding - static int maxVillagersWithBreeding; // Max number of villagers that we can produce (in total), when breeding + static int max_animals_with_breeding; // Max number of animals that we can produce (in total), when breeding + static int max_chickens_with_breeding; // Max number of chickens that we can produce (in total), when breeding/hatching + static int max_mushroomcows_with_breeding; // Max number of mushroom cows that we can produce (in total), when breeding + static int max_wolves_with_breeding; // Max number of wolves that we can produce (in total), when breeding + static int max_villagers_with_breeding; // Max number of villagers that we can produce (in total), when breeding - static int maxAnimalsWithSpawnEgg; // Max number of animals that we can produce (in total), when using spawn eggs - static int maxChickensWithSpawnEgg; // Max number of chickens that we can produce (in total), when using spawn eggs - static int maxWolvesWithSpawnEgg; // Max number of wolves that we can produce (in total), when using spawn eggs - static int maxMonstersWithSpawnEgg; // Max number of monsters that we can produce (in total), when using spawn eggs - static int maxVillagersWithSpawnEgg; // Max number of villagers that we can produce (in total), when using spawn eggs - 4J-PB increased limit due to player requests - static int maxMushroomCowsWithSpawnEgg; // Max number of mushroom cows that we can produce (in total), when using spawn eggs - static int maxSquidsWithSpawnEgg; // Max number of squids that we can produce (in total), when using spawn eggs - static int maxAmbientWithSpawnEgg; // Max number of ambient mobs that we can produce (in total), when using spawn eggs + static int max_animals_with_spawn_egg; // Max number of animals that we can produce (in total), when using spawn eggs + static int max_chickens_with_spawn_egg; // Max number of chickens that we can produce (in total), when using spawn eggs + static int max_wolves_with_spawn_egg; // Max number of wolves that we can produce (in total), when using spawn eggs + static int max_monsters_with_spawn_egg; // Max number of monsters that we can produce (in total), when using spawn eggs + static int max_villagers_with_spawn_egg; // Max number of villagers that we can produce (in total), when using spawn eggs - 4J-PB increased limit due to player requests + static int max_mushroomcows_with_spawn_egg; // Max number of mushroom cows that we can produce (in total), when using spawn eggs + static int max_squids_with_spawn_egg; // Max number of squids that we can produce (in total), when using spawn eggs + static int max_ambient_with_spawn_egg; // Max number of ambient mobs that we can produce (in total), when using spawn eggs /* Maximum animals = 50 + 20 + 20 = 90