use of network.rs485.logisticspipes.util.FuzzyFlag in project LogisticsPipes by RS485.
the class LogisticsBaseGuiScreen method mouseClicked.
@Override
protected void mouseClicked(int par1, int par2, int par3) throws IOException {
for (IRenderSlot slot : slots) {
int mouseX = par1 - guiLeft;
int mouseY = par2 - guiTop;
int mouseXMax = mouseX - slot.getSize();
int mouseYMax = mouseY - slot.getSize();
if (slot.getXPos() < mouseX && slot.getXPos() > mouseXMax && slot.getYPos() < mouseY && slot.getYPos() > mouseYMax) {
slot.mouseClicked(par3);
return;
}
}
if (isMouseInFuzzyPanel(par1, par2)) {
final int posX = fuzzySlot.getX() + guiLeft;
final int posY = fuzzySlot.getY() + 17 + guiTop;
int sel = -1;
if (par1 >= posX + 5 && par1 <= posX + 56) {
if (par2 >= posY + 5 && par2 <= posY + 45) {
sel = (par2 - posY - 4) / 10;
}
}
IBitSet set = fuzzySlot.getFuzzyFlags();
FuzzyFlag flag = null;
switch(sel) {
case 0:
flag = FuzzyFlag.USE_ORE_DICT;
break;
case 1:
flag = FuzzyFlag.IGNORE_DAMAGE;
break;
case 2:
flag = FuzzyFlag.IGNORE_NBT;
break;
case 3:
flag = FuzzyFlag.USE_ORE_CATEGORY;
break;
}
if (flag == null)
return;
set.flip(flag.getBit());
MainProxy.sendPacketToServer(PacketHandler.getPacket(FuzzySlotSettingsPacket.class).setSlotNumber(fuzzySlot.getSlotId()).setFlags(set.copyValue()));
return;
}
boolean handledButton = false;
if (par3 == 0) {
for (Object aButtonList : buttonList) {
GuiButton guibutton = (GuiButton) aButtonList;
if (guibutton.mousePressed(mc, par1, par2)) {
selectedButton = guibutton;
guibutton.playPressSound(mc.getSoundHandler());
actionPerformed(guibutton);
handledButton = true;
break;
}
}
}
if (!handledButton) {
super.mouseClicked(par1, par2, par3);
}
if (par3 == 0 && par1 < guiLeft && !mouseCanPressButton(par1, par2) && !isOverSlot(par1, par2)) {
extentionControllerLeft.mouseClicked(par1, par2, par3);
}
if (par3 == 0 && par1 > guiLeft + xSize && !mouseCanPressButton(par1, par2) && !isOverSlot(par1, par2)) {
extentionControllerRight.mouseClicked(par1, par2, par3);
}
}
Aggregations