Hello there! I am having weird problem with custom entities spawns in custom biomes. I've been trying for few days with different functions, ways of registration, etc...
At the moment the problem is: I cannot get all my mobs spawns working. For e.g. Monsters spawns normally, but day mobs - no. Only one of them is being spawned actually - bird. Another ways of registration gave me only minecraft crash or inability entering my dimension. Here's my git repository: https://github.com/Krevik/Kathairis
And here are the most important parts of the code:
ModEntities (list of all entities, spawns, etc)
public static final EntityType<EntityBasicButterfly> BASIC_BUTTERFLY1 = _null();
public static final EntityType<EntityBasicButterfly> BASIC_BUTTERFLY2 = _null();
public static final EntityType<EntityCloudShimmer> CLOUD_SHIMMER = _null();
public static final EntityType<EntityIllukini> ILLUKINI = _null();
public static final EntityType<EntityRubySile> RUBY_SILE = _null();
public static final EntityType<EntitySkylight> SKYLIGHT = _null();
public static final EntityType<EntityBigTurtle> BIG_TURTLE = _null();
public static final EntityType<EntityBison> BISON = _null();
public static final EntityType<EntityCactiSpore> CACTI_SPORE = _null();
public static final EntityType<EntityCamel> CAMEL = _null();
public static final EntityType<EntityCloudOister> CLOUD_OISTER = _null();
public static final EntityType<EntityCloudySlime> CLOUDY_SLIME = _null();
public static final EntityType<EntityFlyingSquid> FLYING_SQUID = _null();
public static final EntityType<EntityFungite> FUNGITE = _null();
public static final EntityType<EntityGaznowel> GAZNOWEL = _null();
public static final EntityType<EntityGecko> GECKO = _null();
public static final EntityType<EntityHowler> HOWLER = _null();
public static final EntityType<EntityJellyFish> JELLY_FISH = _null();
public static final EntityType<EntityLivingFlower> LIVING_FLOWER = _null();
public static final EntityType<EntityMysticBird> MYSTIC_BIRD = _null();
public static final EntityType<EntityPhasm> PHASM = _null();
public static final EntityType<EntityPoisonousScorpion> POISONOUS_SCORPION = _null();
public static final EntityType<EntitySkyray> SKYRAY = _null();
public static final EntityType<EntityStrangeWanderer> STRANGE_WANDERER = _null();
public static void registerPlacementType(EntityType<?> type,EntitySpawnPlacementRegistry.SpawnPlacementType spawnType){
EntitySpawnPlacementRegistry.register(type, spawnType, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,null);
}
public static void registerPlacementTypes(){
registerPlacementType(ModEntities.BASIC_BUTTERFLY1, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.BASIC_BUTTERFLY2, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.CLOUD_SHIMMER, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.ILLUKINI, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.RUBY_SILE, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.SKYLIGHT, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.BIG_TURTLE, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.BISON, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.CACTI_SPORE, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.CAMEL, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.CLOUD_OISTER, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.CLOUDY_SLIME, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.FLYING_SQUID, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.FUNGITE, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.GAZNOWEL, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.GECKO, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.HOWLER, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.JELLY_FISH, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.LIVING_FLOWER, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.MYSTIC_BIRD, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.PHASM, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.POISONOUS_SCORPION, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.SKYRAY, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
registerPlacementType(ModEntities.STRANGE_WANDERER, EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND);
}
private static void registerEntitySpawn(EntityType<? extends EntityLiving> type,EnumCreatureType creatureType, EntitySpawnPlacementRegistry.SpawnPlacementType spawnType,Biome[] biomes, int weight, int min, int max) {
for (Biome b : biomes) {
Biome biome=b;
if (biome != null) {
biome.getSpawns(creatureType).add(new Biome.SpawnListEntry(type, weight, min, max));
}
}
}
public static void registerEntitySpawns(){
EntitySpawnPlacementRegistry.SpawnPlacementType ON_GROUND = EntitySpawnPlacementRegistry.SpawnPlacementType.ON_GROUND;
registerEntitySpawn(ModEntities.MYSTIC_BIRD,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_FOREST,ModBiomes.KATHARIAN_SWAMP,ModBiomes.PLAIN_FIELDS},12,1,2);
registerEntitySpawn(ModEntities.BIG_TURTLE,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_DESERT,ModBiomes.KATHARIAN_DESERT_EDGE,ModBiomes.SOFT_SAND_LAKES},12,1,1);
registerEntitySpawn(ModEntities.POISONOUS_SCORPION,EnumCreatureType.MONSTER,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_DESERT,ModBiomes.KATHARIAN_DESERT_EDGE,ModBiomes.SOFT_SAND_LAKES},3,1,1);
registerEntitySpawn(ModEntities.CAMEL,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_DESERT,ModBiomes.KATHARIAN_DESERT_EDGE,ModBiomes.SOFT_SAND_LAKES},6,1,1);
registerEntitySpawn(ModEntities.GECKO,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_FOREST},4,1,1);
registerEntitySpawn(ModEntities.LIVING_FLOWER,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_FOREST},8,1,1);
registerEntitySpawn(ModEntities.HOWLER,EnumCreatureType.MONSTER,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_FOREST},5,1,1);
registerEntitySpawn(ModEntities.FUNGITE,EnumCreatureType.MONSTER,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_FOREST},2,1,1);
//registerEntitySpawn(ModEntities.CACTI_SPORE,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_FOREST},4,1,1);
//registerEntitySpawn(ModEntities.JELLY_FISH,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.PLAIN_FIELDS},10,1,2);
//registerEntitySpawn(ModEntities.BISON,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.PLAIN_FIELDS},8,2,4);
//registerEntitySpawn(ModEntities.BASIC_BUTTERFLY1,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.PLAIN_FIELDS},10,1,1);
//registerEntitySpawn(ModEntities.BASIC_BUTTERFLY2,EnumCreatureType.CREATURE,ON_GROUND,new Biome[]{ModBiomes.PLAIN_FIELDS},10,1,1);
//registerEntitySpawn(ModEntities.PHASM,EnumCreatureType.MONSTER,ON_GROUND,new Biome[]{ModBiomes.KATHARIAN_SWAMP},2,1,1);
}
}
Actually I've been trying methods registerEntitySpawns() and registerPlacementTypes() almost everywhere but at the moment I call them here (main mod file):
private void setup(final FMLCommonSetupEvent event) {
ModEntities.registerPlacementTypes();
ModEntities.registerEntitySpawns();
}
Also registration methods of entities:
@SubscribeEvent
public static void onRegisterEntityTypes(final RegistryEvent.Register<EntityType<?>> event){
event.getRegistry().registerAll(
setup(EntityType.Builder.create(EntityBigTurtle.class, EntityBigTurtle::new).build("big_turtle"),"big_turtle"),
setup(EntityType.Builder.create(EntityButterfly.class, EntityButterfly::new).build("basic_butterfly1"), "basic_butterfly1"),
setup(EntityType.Builder.create(EntityButterfly1.class, EntityButterfly1::new).build("basic_butterfly2"), "basic_butterfly2"),
setup(EntityType.Builder.create(EntityCloudShimmer.class, EntityCloudShimmer::new).build("cloud_shimmer"), "cloud_shimmer"),
setup(EntityType.Builder.create(EntityIllukini.class, EntityIllukini::new).build("illukini"), "illukini"),
setup(EntityType.Builder.create(EntityRubySile.class, EntityRubySile::new).build("ruby_sile"), "ruby_sile"),
setup(EntityType.Builder.create(EntitySkylight.class, EntitySkylight::new).build("skylight"), "skylight"),
setup(EntityType.Builder.create(EntityBison.class, EntityBison::new).build("bison"), "bison"),
setup(EntityType.Builder.create(EntityCactiSpore.class, EntityCactiSpore::new).build("cacti_spore"), "cacti_spore"),
setup(EntityType.Builder.create(EntityCamel.class, EntityCamel::new).build("camel"), "camel"),
setup(EntityType.Builder.create(EntityCloudOister.class, EntityCloudOister::new).build("cloud_oister"), "cloud_oister"),
setup(EntityType.Builder.create(EntityCloudySlime.class, EntityCloudySlime::new).build("cloudy_slime"), "cloudy_slime"),
setup(EntityType.Builder.create(EntityFlyingSquid.class, EntityFlyingSquid::new).build("flying_squid"), "flying_squid"),
setup(EntityType.Builder.create(EntityFungite.class, EntityFungite::new).build("fungite"), "fungite"),
setup(EntityType.Builder.create(EntityGaznowel.class, EntityGaznowel::new).build("gaznowel"), "gaznowel"),
setup(EntityType.Builder.create(EntityGecko.class, EntityGecko::new).build("gecko"), "gecko"),
setup(EntityType.Builder.create(EntityHowler.class, EntityHowler::new).build("howler"), "howler"),
setup(EntityType.Builder.create(EntityJellyFish.class, EntityJellyFish::new).build("jelly_fish"), "jelly_fish"),
setup(EntityType.Builder.create(EntityLivingFlower.class, EntityLivingFlower::new).build("living_flower"), "living_flower"),
setup(EntityType.Builder.create(EntityMysticBird.class, EntityMysticBird::new).build("mystic_bird"), "mystic_bird"),
setup(EntityType.Builder.create(EntityPhasm.class, EntityPhasm::new).build("phasm"), "phasm"),
setup(EntityType.Builder.create(EntityPoisonousScorpion.class, EntityPoisonousScorpion::new).build("poisonous_scorpion"), "poisonous_scorpion"),
setup(EntityType.Builder.create(EntitySkyray.class, EntitySkyray::new).build("skyray"), "skyray"),
setup(EntityType.Builder.create(EntityStrangeWanderer.class, EntityStrangeWanderer::new).build("strange_wanderer"), "strange_wanderer")
);
}
So assuming once again - at the moment I can enter my dimension, but only birds and monsters are really being spawned.