You can edit your original post and add “[SOLVED] “ to the title.
Here is an example of how I drop my items https://github.com/Cadiboo/WIPTechAlpha/blob/fb5883e9d76ef0361ec1ebbcb9c508611dd2ef6b/src/main/java/cadiboo/wiptech/capability/inventory/ModItemStackHandler.java#L23-L35
You still need to
- Not use ITileEntityProvider: It is legacy vanilla code, simply override hasTileEntity and createTileEntity.
- Not use IHasModel: It is a stupid way of registering things that makes you write the exact same lines of code for ever class, it is unneeded and a better result can be achieved with 1 single line of code.
- Check for null before using the tile entity you get from world#getTileEntity
- Check that the tile entity you get from world#getTileEntity actually is an instance of your tile entity before you cast it (when the block is replaced, a structure is loaded on top of it, commands like /fill, /clone or /setblock are used, or even if the server is just overloaded, it might not be an instance of your tile entity)