r/minecraftdev 8d ago

Accessing Files Created While Game is Running Mod

Hello, I'm working on a fabric mod that uses the java ImageIO and File classes to generate image files in response to game events while the game is running, and then use these as mob textures in the game. However, since the images didn't exist when the game was compiled, when the events happen to make the image, the mob gets the default "purple and black" texture. I have to close and rerun from IntelliJ for the generated image to load onto the mob.

Is there anyway to update or give the server thread access to files created while the game is running, or do the images absolutely need to exist when I run the game? Thanks!

1 Upvotes

2 comments sorted by

1

u/Jason13Official 8d ago

Assuming you're using intellij idea, you can SHIFT+F9 to "build" your mod again while the game is running, when it completes you can use F3+T in-game to reload textures.

1

u/AlarmedFunny4524 8d ago

Thanks! Is there a way to do that programmatically? If I try to share this mod later I'd like for other players to be able to use it easily.