Posted February 23, 20223 yr I currently have the following spawn predicate set up for my mob: public static boolean checkMyMobSpawnRules(EntityType<? extends MyMob> entityType, ServerLevelAccessor serverLevelAccessor, MobSpawnType mobSpawnType, BlockPos blockPos, Random random) { boolean notUndergroundOrIndoors = true; for (int y = blockPos.getY() + 1; y < 320; ++y) { BlockState blockState = serverLevelAccessor.getBlockState(new BlockPos(blockPos.getX(), y, blockPos.getZ())); Block block = blockState.getBlock(); if (!(block instanceof AirBlock || block instanceof LeavesBlock)) { notUndergroundOrIndoors = false; break; } } return Monster.checkAnyLightMonsterSpawnRules(entityType, serverLevelAccessor, mobSpawnType, blockPos, random) && notUndergroundOrIndoors && Utils.nearbyChunkHasCrop(serverLevelAccessor, blockPos); } I have the following subscriber for a BiomeLoadingEvent: @SubscribeEvent(priority = EventPriority.HIGHEST) public static void biomeLoading(BiomeLoadingEvent event) { Biome.BiomeCategory category = event.getCategory(); if (category != Biome.BiomeCategory.NETHER && category != Biome.BiomeCategory.THEEND) { event.getSpawns().addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(ModEntities.MY_MOB.get(), 100, 1, 1)); } } I also subscribe to FMLCommonSetupEvent: @SubscribeEvent public static void commonSetup(FMLCommonSetupEvent event) { event.enqueueWork(() -> SpawnPlacements.register(ModEntities.STALIN.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.WORLD_SURFACE, Stalin::checkStalinSpawnRules)); } My logic seems to be working with 1 exception: my mob only spawns at night. I thought using Monster.checkAnyLightMonsterSpawnRules would allow my mob to spawn day or night. Is there a way to get my mob to spawn at any time of day? My subclasses Monster if that's relevant.
February 23, 20223 yr Author I figured it out. Having my mob entity inherit from PathfinderMob instead of Monster did the trick.
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.