you can use null
Capability#getDefaultInstance do the same as the ItemStackHandler#new
and if you use an ItemStackHandler as I explained above, your error would simply be fixed
this is the simplest solution for your problem:
https://pastebin.com/ntZssi9b
Edit: another issue in your code, you call the write inside the getUpdatePacket method of your TE
why do you use IItemHandler as inventory?
Edit: use ItemStackHandler instead, reason:
you use Capability#getDefaultInstance to get an IItemHandler,
why don't you use a new ItemStackHandler that contains the methods serializeNBT and deserializeNBT
which you can execute in read and write the TE, wich is very simple
i don't know all 1.15 events, but i think that there is no 1.15 event for that
the best way would be to update your mod from 1.15 to 1.16.5,
because you can then use the event and as soon as forge 1.17 released, your version will no longer be supported
I don't think, you could also take a look at the fill command
but basically you need an for-each-loop, for x, y, z. then get the block at the position, and add them to a list
since your mod list contains Redstone Flux (only for 1.12):
1.12 is no longer supported on this forum.
Please update to a modern version of Minecraft to receive support.