Hi John
I have exactly the same machine, exactly the same problem and I solved it by not listening to the advice which Apple support gave me.
I'm very cynical about Apple because they're in the business of making money for their shareholders, so it's in their interests if their computers suddenly stop working after a few years forcing people to buy new ones.
I was pulling my hair out by the roots and spent ages working out what was wrong, but my Macbook now works well, with no random shutdowns and with the only expense being a tube of Arctic Silver thermal compound and a Penta Screw driver set ~ $40 all up.
The problem is a cooling issue and is very widespread in Macbooks, both pro and air. What happens is that Apple use a Thermal compound on the heatsink which connects to the CPU and GPU.
Good work trying to diagnose the problem, I did the same stuff as you and the key here is looking in the Diagnostic logs for a "Cause -128" shutdown command. If you do a search in the diagnostic logs after the machine randomly shut s down, I'm guessing you'll find a -128 shutdown. This indicates a Hardware shutdown not a software shutdown which is a "Cause 5". If you see a "Cause 3", that's a power button shutdown.
On mine I found a Cause-128 and knew the problem was harware related. I had two different random shutdown modes. The first and most common, was that the computer wouldn't completely shut down, but the screen would go dark grey and the computer would stay on but be totally unresponsive to mouse or keyboard commands. I usually then held the power button down to turn it off and rebooted.
One thing I noticed is that this problem got worse over time and the random shutdowns became more and more frequent during each session, to the point where I would just get to the login screen and it would shut down.
The second shutdown mode was that the computer just turned off.
The other thing I found was that when you boot up into SAFE mode, the random shutdowns disappear. Apple told me this was probably because of a bad 3rd party driver. This was not the case as I'm very careful about what I put on the computer and I did reinstall OSX from scratch after finding my hard drive had corrupted files on it as well.
What I eventually worked out after extensively testing the RAM and SSD was that the hardware was fine. The reason for the file corruption was the sudden shutdown at the moment something was being written to disk. Again supporting the hardware shutdown cause.
So once I worked out it was a hardware error then I tried to figure out what it was, by running every diagnostic test I could lay my hands on, including the ones you tried. All to no avail, everything checked out fine.
The lightbulb turned on one day as I went out and had left the Mac on. I came home and the part of the aluminium case near the back of the Macbook nearest the screen was really hot, and the fans were going flat out and making a **** of a noise. The computer of course had gone into shut down mode 1, where the screen went dark grey but it was still on. The fans were the key to diagnosing the fault because even though you mentioned running minecraft, which I did too 😉 to test performance, for some reason it did not necessarily break the computer.
What I did then was to pull the Macbook apart and pull off the heatsink and like a good detective story I founf that all of the Thermal compound which Apple used on the heatsink had turned to dust !!! So
So I cleaned it all off carefully with alcohol ( use isopropyl) and I got a small tube of Arctic Silver heatsink thermal compound. I put a drop on the GPU and one on the CPU and bolted down the heatsink again.
Prior to putting the heatsink compound on I cleaned out the fans and heatsink fins under the fans with compressed air, being careful not to let the fans rotate when I forced air through the blades so as not to blow up the motherboard with reverse voltage generated by spinning the fans.
Once back together, I tested the Mac with every manner of computer game I could find and no problems. Not one more random shutdown. Until a few weeks later.
It seems that some permanent damage had occured to the CPU / GPU because of the constant overheating. Apparently the internal components electrical resistance increases slightly with time, resulting in ilder CPUs generating more heat than new ones. The cooling system on Macbooks is very minimalist to put it mildly and I think what happens is over time, it has insufficient capacity to effectively cool the Mac down.
What I eventually did is anstall a fan controller called Mac Fan Control and set it to start on boot up. I set the trigger temperature at about 33 degrees celsius, so that the fans turn on above that temperature. I found that on boot up, the fans speed up really fast. They then slow down but always make a tiny bit of noise.
since I put the fan controller app on, I have had no more shutdowns and I have run the machine for 2 months, every day with no issues. So it's fixed !!
To get into your macbook, you'll need a Penta screw driver set, with a penta head ( 5 star instead of the older 6 star Torque screws used on pre 2012 Macbooks) Computer shops will have both the penta set and arctic silver paste.
There are videos on youtube which show how to do all this in great detail. I hope this helps you solve your problems with your Mac.
Apple's solution by the way was idiotic and involved deleting cache files, which I do every week as part of normal maintenance. They offered no other solution other than spending an obscene amount of money to replace the Motherboard and Battery, which were not to blame.
Cheers
Theo