def METHOD_NAME(
    entities_json: dict, textures_json: dict, entity_name: str, chunk_size: int
) -> chunk_map_type:
    if entity_name in entities_json:
        entity_data = entities_json[entity_name]
        texture_id = str(entity_data["texture"])
        if texture_id in textures_json:
            texture_data = textures_json[texture_id]
            num_chunks_width = texture_data["num_tiles"]["width"]
            (offset_width, offset_height) = (
                texture_data["offset"]["width"] / chunk_size,
                texture_data["offset"]["height"] / chunk_size,
            )
            chunk_height_scaling = texture_data["tile_height"] / chunk_size
            chunk_width_scaling = texture_data["tile_width"] / chunk_size
            chunks = {}
            animations = sorted(
                entity_data["animations"].items(), key=lambda x: int(x[0])
            )
            if not animations:
                tile_x = entity_data["tile_x"]
                tile_y = entity_data["tile_y"]
                animations.append(
                    (
                        "0",
                        {
                            "count": 1,
                            "texture": tile_y * num_chunks_width + tile_x,
                        },
                    )
                )
            for animation_id, animation_data in animations:
                first_chunk = animation_data["texture"]
                for i in range(0, animation_data["count"]):
                    chunk_x = (first_chunk + i) % num_chunks_width
                    chunk_y = (first_chunk + i) // num_chunks_width
                    chunks[f"{entity_name}_{animation_id}_{i}"] = (
                        offset_width + chunk_x * chunk_width_scaling,
                        offset_height + chunk_y * chunk_height_scaling,
                        offset_width + (chunk_x + 1) * chunk_width_scaling,
                        offset_height + (chunk_y + 1) * chunk_height_scaling,
                    )
            return chunks
        logger.error(
            "Failed generating chunks for entity '%s': Could not find texture %s in textures.json",
            entity_name,
            texture_id,
        )
        return {}
    logger.error(
        "Failed generating chunks for entity '%s': Could not find entity in entities.json"
    )
    return {}