What to use instead of add_triangle_fan()

I’m using Godot 4.2.1

So I’ve been following this slightly outdated tutorial. I’d use a more up to date version but there doesn’t seem to be any. And admittedly I’m not smart enough to just figure something like this out by myself.

I didn’t have any major issue up until it used add_triangle_fan(), which upon looking it up seems to have been removed outright. I tried figuring out how to come up with a workaround, but the farthest I got by myself was generating a square with ArrayMesh.

Update: I’ve since managed to at the very least get a cube rendering. However I’m still clueless as to how I can generate multiple to fill a chunk. And I’m especially stumped on how to not render faces that would otherwise be hidden.

My code so far, if this is any help.

	var mesh_data = []
	var face = []
	mesh_data.resize(ArrayMesh.ARRAY_MAX)
	mesh_data[ArrayMesh.ARRAY_VERTEX] = PackedVector3Array([
		Vector3(0, 0, 0), #0
		Vector3(1, 0, 0), #1
		Vector3(0, 1, 0), #2
		Vector3(1, 1, 0), #3
		Vector3(0, 0, 1), #4
		Vector3(1, 0, 1), #5
		Vector3(0, 1, 1), #6
		Vector3(1, 1, 1)  #7
	])
	
	mesh_data[ArrayMesh.ARRAY_INDEX] = PackedInt32Array([
		#Top
		2, 3, 7,
		2, 7, 6,
		#Bottom
		0, 4, 5,
		0, 5, 1,
		#Left
		6, 4, 0,
		6, 0, 2,
		#Right
		3, 1, 5,
		3, 5, 7,
		#Front
		7, 5, 4,
		7, 4, 6,
		#Back
		2, 0, 1,
		2, 1, 3
	])
	
	mesh = ArrayMesh.new()
	mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, mesh_data)