skyboy / MineFactoryReloaded

104 stars 75 forks source link

Odd thing when calling getMaxU,getMaxV,getMinU,getMinV #466

Closed Vectron closed 9 years ago

Vectron commented 9 years ago

i'm maintaining mapwriter and for some reason with big modpacks the game crashes.

i was able to narrow it down to the problem and it happens when getting the min/max uv values from blocks. for some reason i get a value back that is bigger then 1.0

MFR is one of the mods that does this, and in my understanding of uv cordinates this shouldnt happen. here is a example of the values i get:

[20:32:47] [Client thread/INFO] [MapWriter/]: MwTexture.getRGB: IllegalArgumentException (icon name: minefactoryreloaded:machines/tile.mfr.tank.top; height: 16; width: 16; MaxU: 0.230465; MinU: 0.226569; MaxV: 1.039016; MinV: 1.031224) [20:32:47] [Client thread/INFO] [MapWriter/]: MwTexture.getRGB: IllegalArgumentException (pos: 8651680) [20:32:47] [Client thread/INFO] [MapWriter/]: MwTexture.getRGB: IllegalArgumentException (buffersize: 8388608)

in this case the V values are to big. and the cordinates end up outside the texture atlas. (pos is the index i'm going to try and acces) for now i fixed this by checking if i'm going over the texture size. but this has a side effect that i wont get the colors i need for the minimap.

skyboy commented 9 years ago

How are you getting this icon from my block?

Vectron commented 9 years ago

itterate all blocks in the registry, then icon = block.getIcon(1, dv);

(dv gets itterated from 0-16)

skyboy commented 9 years ago

That's why, then. There's a narrow set of metadata values that will return a valid icon (several that will be "valid" but not my block in some circumstances), everything else is garbage data. Just ignoring the error is fine for MFR.