forked from mirrors/NBTExplorer
Fixed index calculation bug in Anvil composite arrays.
This commit is contained in:
parent
aed388dd80
commit
81920ef73d
2 changed files with 4 additions and 2 deletions
|
@ -63,7 +63,7 @@ namespace Substrate.Core
|
|||
{
|
||||
int ydiv = y / _sections[0].YDim;
|
||||
int yrem = y - (ydiv * _sections[0].YDim);
|
||||
return ydiv * _sections[ydiv].GetIndex(x, yrem, z);
|
||||
return (ydiv * _sections[0].Length) + _sections[ydiv].GetIndex(x, yrem, z);
|
||||
}
|
||||
|
||||
public void GetMultiIndex (int index, out int x, out int y, out int z)
|
||||
|
@ -71,6 +71,7 @@ namespace Substrate.Core
|
|||
int idiv = index / _sections[0].Length;
|
||||
int irem = index - (idiv * _sections[0].Length);
|
||||
_sections[idiv].GetMultiIndex(irem, out x, out y, out z);
|
||||
y += idiv * _sections[0].YDim;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Substrate.Core
|
|||
{
|
||||
int ydiv = y / _sections[0].YDim;
|
||||
int yrem = y - (ydiv * _sections[0].YDim);
|
||||
return ydiv * _sections[ydiv].GetIndex(x, yrem, z);
|
||||
return (ydiv * _sections[0].Length) + _sections[ydiv].GetIndex(x, yrem, z);
|
||||
}
|
||||
|
||||
public void GetMultiIndex (int index, out int x, out int y, out int z)
|
||||
|
@ -71,6 +71,7 @@ namespace Substrate.Core
|
|||
int idiv = index / _sections[0].Length;
|
||||
int irem = index - (idiv * _sections[0].Length);
|
||||
_sections[idiv].GetMultiIndex(irem, out x, out y, out z);
|
||||
y += idiv * _sections[0].YDim;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue