if (par1GuiButton.id == 0) {
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterStartWorking(enchanter));
} else if (par1GuiButton.id <= 16) {
GuiButtonEnchantment button = enchantButtons[par1GuiButton.id - 1];
if (button != null && button.enchant != null)
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, button.enchant.effectId, 0));
} else {
int type = (par1GuiButton.id - 17) % 3;
int index = (par1GuiButton.id - 17) / 3;
if (index >= enchanter.enchantments.size() || index >= enchanter.levels.size())
return;
int level = enchanter.levels.get(index);
Enchantment enchant = Enchantment.enchantmentsList[enchanter.enchantments.get(index)];
switch (type) {
case 0: {
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, -1));
break;
}
case 1: {
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level == 1 ? -1 : level - 1));
break;
}
case 2: {
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level + 1));
break;
}
}
}