use of logisticspipes.interfaces.IFuzzySlot in project LogisticsPipes by RS485.
the class DummyContainer method detectAndSendChanges.
@Override
public void detectAndSendChanges() {
for (int i = 0; i < inventorySlots.size(); ++i) {
if (inventorySlots.get(i) instanceof IFuzzySlot) {
IFuzzySlot fuzzySlot = (IFuzzySlot) inventorySlots.get(i);
BitSet slotFlags = fuzzySlot.getFuzzyFlags().copyValue();
BitSet savedFlags = slotsFuzzyFlags.get(i);
if (savedFlags == null || !savedFlags.equals(slotFlags)) {
MainProxy.sendToPlayerList(PacketHandler.getPacket(FuzzySlotSettingsPacket.class).setSlotNumber(fuzzySlot.getSlotId()).setFlags(slotFlags), listeners.stream().filter(o -> o instanceof EntityPlayer).map(o -> (EntityPlayer) o));
slotsFuzzyFlags.set(i, slotFlags);
}
}
ItemStack itemstack = inventorySlots.get(i).getStack();
ItemStack itemstack1 = inventoryItemStacks.get(i);
if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) {
itemstack1 = itemstack.isEmpty() ? ItemStack.EMPTY : itemstack.copy();
inventoryItemStacks.set(i, itemstack1);
for (IContainerListener crafter : listeners) {
boolean revert = false;
if (overrideMCAntiSend && crafter instanceof EntityPlayerMP && ((EntityPlayerMP) crafter).isChangingQuantityOnly) {
((EntityPlayerMP) crafter).isChangingQuantityOnly = false;
revert = true;
}
crafter.sendSlotContents(this, i, itemstack1);
if (revert) {
((EntityPlayerMP) crafter).isChangingQuantityOnly = true;
}
}
}
}
overrideMCAntiSend = false;
}
use of logisticspipes.interfaces.IFuzzySlot in project LogisticsPipes by RS485.
the class LogisticsBaseGuiScreen method onRenderSlot.
private void onRenderSlot(Slot slot) {
if (slot instanceof IFuzzySlot) {
final IBitSet set = ((IFuzzySlot) slot).getFuzzyFlags();
int x1 = slot.xPos;
int y1 = slot.yPos;
GL11.glDisable(GL11.GL_LIGHTING);
final boolean useOreDict = FuzzyUtil.INSTANCE.get(set, FuzzyFlag.USE_ORE_DICT);
if (useOreDict) {
Gui.drawRect(x1 + 8, y1 - 1, x1 + 17, y1, 0xFFFF4040);
Gui.drawRect(x1 + 16, y1, x1 + 17, y1 + 8, 0xFFFF4040);
}
final boolean ignoreDamage = FuzzyUtil.INSTANCE.get(set, FuzzyFlag.IGNORE_DAMAGE);
if (ignoreDamage) {
Gui.drawRect(x1 - 1, y1 - 1, x1 + 8, y1, 0xFF40FF40);
Gui.drawRect(x1 - 1, y1, x1, y1 + 8, 0xFF40FF40);
}
final boolean ignoreNBT = FuzzyUtil.INSTANCE.get(set, FuzzyFlag.IGNORE_NBT);
if (ignoreNBT) {
Gui.drawRect(x1 - 1, y1 + 16, x1 + 8, y1 + 17, 0xFF4040FF);
Gui.drawRect(x1 - 1, y1 + 8, x1, y1 + 17, 0xFF4040FF);
}
final boolean useOreCategory = FuzzyUtil.INSTANCE.get(set, FuzzyFlag.USE_ORE_CATEGORY);
if (useOreCategory) {
Gui.drawRect(x1 + 8, y1 + 16, x1 + 17, y1 + 17, 0xFF7F7F40);
Gui.drawRect(x1 + 16, y1 + 8, x1 + 17, y1 + 17, 0xFF7F7F40);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_LIGHTING);
final boolean mouseOver = this.isMouseOverSlot(slot, currentDrawScreenMouseX, currentDrawScreenMouseY);
if (mouseOver) {
if (fuzzySlot == slot) {
fuzzySlotGuiHoverTime++;
if (fuzzySlotGuiHoverTime >= 10) {
fuzzySlotActiveGui = true;
}
} else {
fuzzySlot = (IFuzzySlot) slot;
fuzzySlotGuiHoverTime = 0;
fuzzySlotActiveGui = false;
}
}
if (fuzzySlotActiveGui && fuzzySlot == slot) {
if (!mouseOver) {
// Check within FuzzyGui
if (!isPointInRegion(slot.xPos, slot.yPos + 16, 60, 52, currentDrawScreenMouseX, currentDrawScreenMouseY)) {
fuzzySlotActiveGui = false;
fuzzySlot = null;
}
}
final int posX = slot.xPos + guiLeft;
final int posY = slot.yPos + 17 + guiTop;
renderAtTheEnd.add(() -> {
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GuiGraphics.drawGuiBackGround(mc, posX, posY, posX + 61, posY + 47, zLevel, true, true, true, true, true);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
final String PREFIX = "gui.crafting.";
mc.fontRenderer.drawString(TextUtil.translate(PREFIX + "OreDict"), posX + 5, posY + 5, (useOreDict ? 0xFF4040 : 0x404040));
mc.fontRenderer.drawString(TextUtil.translate(PREFIX + "IgnDamage"), posX + 5, posY + 15, (ignoreDamage ? 0x40FF40 : 0x404040));
mc.fontRenderer.drawString(TextUtil.translate(PREFIX + "IgnNBT"), posX + 5, posY + 25, (ignoreNBT ? 0x4040FF : 0x404040));
mc.fontRenderer.drawString(TextUtil.translate(PREFIX + "OrePrefix"), posX + 5, posY + 35, (useOreCategory ? 0x7F7F40 : 0x404040));
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
});
}
}
}
Aggregations