Skip to content

Instantly share code, notes, and snippets.

@ddevault
Created September 5, 2012 20:19
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ddevault/459a1691c3dd751db160 to your computer and use it in GitHub Desktop.
/// <summary>
/// Thanks to some idiot at Mojang
/// </summary>
private static int DataSlotToNetworkSlot(int index)
{
if (index <= 8)
index += 36;
else if (index == 100)
index = 8;
else if (index == 101)
index = 7;
else if (index == 102)
index = 6;
else if (index == 103)
index = 5;
else if (index >= 80 && index <= 83)
index -= 79;
return index;
}
@Lianecx
Copy link

Lianecx commented Aug 23, 2022

Slot -106 has to be converted to 45 too

private static int DataSlotToNetworkSlot(int index) {
    if(index == 100)
        index = 8;
    else if(index == 101)
        index = 7;
    else if(index == 102)
        index = 6;
    else if(index == 103)
        index = 5;
    else if(index == -106)
        index = 45;
    else if(index <= 8)
        index += 36;
    else if(index >= 80 && index <= 83)
        index -= 79;
    return index;
}

@yejunho10
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment