Your getCapability method is wrong. Please read my instructions carefully, I've told you exactly what you need to do:
I didn't tell you to change the if statement, I told you to change the cast of this.item_handler.
Ya, there isn't much we can do to help you. Optifine is a thing that just hacks into A LOT of internal stuff. And we've tried to expose as much as we can to help him. But he's closed source, and doesn't talk or submit issues. So ya, can't do anything.
Plus the fact that MOST users don't get any performance out of Optifine. Oh well.
Make your choice, Optifine or Forge. We've done our best.
I'll start debugging it now.
I also recommend using a proper Git client (either the CLI or a GUI client like GitKraken or your IDE) rather than using GitHub's upload system.
Edit: You should also include the Gradle wrapper (gradlew, gradlew.bat and the gradle directory) in your repository, though this isn't as essential as the buildscript.
Edit 2: You should also include a .gitignore file to ensure only the required files are included in the repository. I linked an example in this post.
As I said:
This is in the OWNER_DEFINED_ID field initialiser.
The name of the field doesn't matter, you could call it FOO_BAR_BAZ and the issue would still be present.
Please include your buildscript (build.gradle and gradle.properties) in the repository.