use of logisticspipes.request.resources.DictResource in project LogisticsPipes by RS485.
the class PipeItemsRequestLogistics method performRequest.
@Override
public List<ItemStack> performRequest(ItemStack wanted) {
final List<IResource> missing = new ArrayList<>();
RequestTree.request(ItemIdentifier.get(wanted).makeStack(wanted.stackSize), this, new RequestLog() {
@Override
public void handleMissingItems(List<IResource> items) {
missing.addAll(items);
}
@Override
public void handleSucessfullRequestOf(IResource item, LinkedLogisticsOrderList parts) {
}
@Override
public void handleSucessfullRequestOfList(List<IResource> items, LinkedLogisticsOrderList parts) {
}
}, null);
List<ItemStack> missingList = new ArrayList<>(missing.size());
for (IResource e : missing) {
if (e instanceof ItemResource) {
missingList.add(((ItemResource) e).getItem().unsafeMakeNormalStack(e.getRequestedAmount()));
} else if (e instanceof DictResource) {
missingList.add(((DictResource) e).getItem().unsafeMakeNormalStack(e.getRequestedAmount()));
}
}
return missingList;
}
use of logisticspipes.request.resources.DictResource in project LogisticsPipes by RS485.
the class LogisticsItemOrderManager method addOrder.
public LogisticsItemOrder addOrder(ItemIdentifierStack stack, IRequestItems requester, ResourceType type, IAdditionalTargetInformation info) {
LogisticsItemOrder order = new LogisticsItemOrder(new DictResource(stack, null), requester, type, info);
_orders.addLast(order);
listen();
return order;
}
use of logisticspipes.request.resources.DictResource in project LogisticsPipes by RS485.
the class LogisticsBaseGuiScreen method mouseClicked.
@Override
protected void mouseClicked(int par1, int par2, int par3) {
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 + 4 && par1 <= posX + 60 - 4) {
if (par2 >= posY + 4 && par2 <= posY + 52 - 4) {
sel = (par2 - posY - 4) / 11;
}
}
DictResource resource = fuzzySlot.getFuzzyFlags();
BitSet set = resource.getBitSet();
if (sel == 0) {
resource.use_od = !resource.use_od;
}
if (sel == 1) {
resource.ignore_dmg = !resource.ignore_dmg;
}
if (sel == 2) {
resource.ignore_nbt = !resource.ignore_nbt;
}
if (sel == 3) {
resource.use_category = !resource.use_category;
}
MainProxy.sendPacketToServer(PacketHandler.getPacket(FuzzySlotSettingsPacket.class).setSlotNumber(fuzzySlot.getSlotId()).setFlags(resource.getBitSet()));
// Reset to wait for server
resource.loadFromBitSet(set);
return;
}
boolean handledButton = false;
if (par3 == 0) {
for (Object aButtonList : buttonList) {
GuiButton guibutton = (GuiButton) aButtonList;
if (guibutton.mousePressed(mc, par1, par2)) {
selectedButton = guibutton;
guibutton.func_146113_a(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);
}
}
use of logisticspipes.request.resources.DictResource in project LogisticsPipes by RS485.
the class LogisticsBaseGuiScreen method onRenderSlot.
private void onRenderSlot(Slot slot) {
if (slot instanceof IFuzzySlot) {
final DictResource resource = ((IFuzzySlot) slot).getFuzzyFlags();
int x1 = slot.xDisplayPosition;
int y1 = slot.yDisplayPosition;
GL11.glDisable(GL11.GL_LIGHTING);
if (resource.use_od) {
Gui.drawRect(x1 + 8, y1 - 1, x1 + 17, y1, 0xFFFF4040);
Gui.drawRect(x1 + 16, y1, x1 + 17, y1 + 8, 0xFFFF4040);
}
if (resource.ignore_dmg) {
Gui.drawRect(x1 - 1, y1 - 1, x1 + 8, y1, 0xFF40FF40);
Gui.drawRect(x1 - 1, y1, x1, y1 + 8, 0xFF40FF40);
}
if (resource.ignore_nbt) {
Gui.drawRect(x1 - 1, y1 + 16, x1 + 8, y1 + 17, 0xFF4040FF);
Gui.drawRect(x1 - 1, y1 + 8, x1, y1 + 17, 0xFF4040FF);
}
if (resource.use_category) {
Gui.drawRect(x1 + 8, y1 + 16, x1 + 17, y1 + 17, 0xFF7F7F40);
Gui.drawRect(x1 + 16, y1 + 8, x1 + 17, y1 + 17, 0xFF7F7F40);
}
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 (!func_146978_c(slot.xDisplayPosition, slot.yDisplayPosition + 16, 60, 52, currentDrawScreenMouseX, currentDrawScreenMouseY)) {
fuzzySlotActiveGui = false;
fuzzySlot = null;
}
}
//int posX = -60;
//int posY = 0;
final int posX = slot.xDisplayPosition + guiLeft;
final int posY = slot.yDisplayPosition + 17 + guiTop;
renderAtTheEnd.add(() -> {
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GuiGraphics.drawGuiBackGround(mc, posX, posY, posX + 60, posY + 52, zLevel, true, true, true, true, true);
final String PREFIX = "gui.crafting.";
mc.fontRenderer.drawString(StringUtils.translate(PREFIX + "OreDict"), posX + 4, posY + 4, (!resource.use_od ? 0x404040 : 0xFF4040));
mc.fontRenderer.drawString(StringUtils.translate(PREFIX + "IgnDamage"), posX + 4, posY + 14, (!resource.ignore_dmg ? 0x404040 : 0x40FF40));
mc.fontRenderer.drawString(StringUtils.translate(PREFIX + "IgnNBT"), posX + 4, posY + 26, (!resource.ignore_nbt ? 0x404040 : 0x4040FF));
mc.fontRenderer.drawString(StringUtils.translate(PREFIX + "OrePrefix"), posX + 4, posY + 38, (!resource.use_category ? 0x404040 : 0x7F7F40));
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
});
}
}
}
Aggregations