Graphics card: RX 5700
CPU: Ryzen 5 3600
Are you playing on version 1.15 with Optifine?
1.12 with Optifine
Okay, then unfortunately I don't know what to do next. You can set Minecraft to need more ram. 1.15 Optifine has problems with such things, but I think 1.12 should normally work well