Biome Id Fixer (Forge)

Biome Id Fixer (Forge)

2M Downloads

Index out of bounds on first run with existing world

xannor opened this issue ยท 8 comments

commented

Describe the bug
I saw your mod and added it to my custom pack. On loading my single player world I crashed out with an index out of bounds exception. https://gist.github.com/xannor/8222dc7237f44e69d2afffc895b202e6

To Reproduce
Steps to reproduce the behavior:

  1. Go to Single Player
  2. Click on 'Existing World'
  3. See error

Expected behavior
No error

Screenshots AND BiomeIdFixer jsonFiles
N/A

Versions (please complete the following information):

  • Forge Version: 1.16.5.36.0.1
  • Biome mods and Versions: BYG
  • Version of Biome Fixer: 1.16.4-1.0.0.s0

Additional context
My guess, from looking at your code, is that I am running through CurseForge and that the path passed into writeTemp either ends with saves/ or does not contain saves/. The only reason I can think for the latter is that when run through CurseForge the Minecraft install folder is not the same as the instance folder.

Edit: I just tried creating a new world and got a similar crash but from a different approach. https://gist.github.com/xannor/72e9cbff76823ef0601980aaf49255cd

Edit2: I added Chocolate Fix to see if it possibly helps, but no dice... however looking at the last attempt I saw this in the log:
[08:45:12] [Render thread/INFO]: Desagas filePath:null
So it looks like your method for getting the selected worldfile is not working in 1.16.5.

Edit3: I repeated new world creation to see if it logs different and it did:
[09:18:43] [Server thread/INFO]: Desagas: from server starting:D:\Users\xxx\Documents\curseforge\minecraft\Instances\XanCraft (1)\saves\New World\icon.png
[09:18:43] [Server thread/INFO]: Desagas filePath:D:\Users\xxx\Documents\curseforge\minecraft\Instances\XanCraft (1)\saves\New World\icon.png
So in this case you got the filename but it still errors with index out of bounds. I'm going to try to rename my instance to see if that changes anything. Nope, but I see why it is failing on this method, your code assumes / as the path separator, but on windows \ is the path separator.

commented

Can you tell me ...
Did you click play selected world below, or did you click on the little play button above the icon?
Also, what folder in your main directory are your worlds located in?

I am pretty sure I know why this is happening. I think you are right! I am working to resolve it now, good thing I have both a PC and a Mac.

commented

I wasn't sure which method I used so I tested both.

Clicking "Play Selected World" did provide the full path to the icon image in the log file, also this time clicking the play icon provided the fill path as well. It could be that since it crashed on new world generation in the first test, the icon didn't "exists" thus the entry was null, but because I had disabled you mod and then successfully opened that new world, it now has an icon.

Once the world has been loaded it doen not seem to be an issue, well other than the path separator issue.

commented

Thank you for the updates, it is not 1.16.5 related, it is me handling the absolute paths ... I have it working in dev, right now, I am just testing it on my different machines. Thank you for the feedback, it helps me a lot.

commented

I think the null pointer issue would only be a thing if something broke before the world loaded the first time, so it could just be a "known" issue and the person would just have to disable the mod load the world and then re-enable, if you cannot find a way to work around the need of the icon that early.

commented

Exactly, but, just incase, to fix all basis, I had to fix it.

I got it to work. There is another field that returns the folder no matter what. Just running my final tests.

commented

Fixed, in 1.0.0.s1. Please let me know if this works for you!

commented

So, I have that crash fixed now ... but, I was using the icon file the game creates for each world to extrapolate the world directory, but if the game is not loaded long enough to create said file, then there is another null pointer ... I doubt it will be long now.

commented

It loads for me so it looks good. No errors.