use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class ItemResource method copyForDisplayWith.
@Override
public IResource copyForDisplayWith(int amount) {
ItemIdentifierStack stack = this.stack.clone();
stack.setStackSize(amount);
return new ItemResource(stack, requester);
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class ItemDisplay method renderItemArea.
public void renderItemArea(double zLevel) {
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
screen.drawRect(left, top, left + width, top + height, Color.GREY);
tooltip = null;
int ppi = 0;
int panelxSize = 20;
int panelySize = 20;
int x = 2;
int y = 2;
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
int scaleX = scaledresolution.getScaledWidth();
int scaleY = scaledresolution.getScaledHeight();
int mouseX = Mouse.getX() * scaleX / mc.displayWidth - left;
int mouseY = scaleY - Mouse.getY() * scaleY / mc.displayHeight - top;
GL11.glTranslatef(left, top, 0.0F);
if (!listbyserver) {
int graphic = ((int) (System.currentTimeMillis() / 250) % 5);
// GL11.glBindTexture(GL11.GL_TEXTURE_2D,
// this.mc.renderEngine.getTexture());
screen.getMC().renderEngine.bindTexture(ItemDisplay.TEXTURE);
Tessellator tesselator = Tessellator.instance;
tesselator.startDrawingQuads();
int xPosition = (width / 2) - 50;
int yPosition = 40;
tesselator.addVertexWithUV(xPosition, yPosition + 100, zLevel, 0.04, 0.72 + (graphic * 0.03125));
tesselator.addVertexWithUV(xPosition + 100, yPosition + 100, zLevel, 0.08, 0.72 + (graphic * 0.03125));
tesselator.addVertexWithUV(xPosition + 100, yPosition, zLevel, 0.08, 0.69 + (graphic * 0.03125));
tesselator.addVertexWithUV(xPosition, yPosition, zLevel, 0.04, 0.69 + (graphic * 0.03125));
tesselator.draw();
} else {
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
for (ItemIdentifierStack itemIdentifierStack : _allItems) {
ItemIdentifier item = itemIdentifierStack.getItem();
if (search != null && !search.itemSearched(item)) {
continue;
}
ppi++;
if (ppi <= itemsPerPage * page) {
continue;
}
if (ppi > itemsPerPage * (page + 1)) {
break;
}
ItemStack itemstack = itemIdentifierStack.unsafeMakeNormalStack();
// -2 on both, because field starts there (see black rect below)
int realX = x - 2;
int realY = y - 2;
Pair<Integer, Integer> pair = new Pair<>(realX, realY);
if (map.get(pair) != itemIdentifierStack) {
map.put(pair, itemIdentifierStack);
}
if (mouseX >= realX && mouseX < realX + panelxSize && mouseY >= realY && mouseY < realY + panelySize) {
screen.drawRect(x - 2, y - 2, x + panelxSize - 2, y + panelySize - 2, Color.BLACK);
screen.drawRect(x - 1, y - 1, x + panelxSize - 3, y + panelySize - 3, Color.DARKER_GREY);
tooltip = new Object[] { mouseX + left, mouseY + top, itemstack };
}
/*if (lastClickedx >= realX && lastClickedx < realX + panelxSize && lastClickedy >= realY && lastClickedy < realY + panelySize) {
selectedItem = itemIdentifierStack;
screen.drawRect(x - 2, y - 2, x + panelxSize - 2, y + panelySize - 2, Color.BLACK);
screen.drawRect(x - 1, y - 1, x + panelxSize - 3, y + panelySize - 3, Color.LIGHTER_GREY);
screen.drawRect(x, y, x + panelxSize - 4, y + panelySize - 4, Color.DARKER_GREY);
}
*/
if (selectedItem == itemIdentifierStack) {
screen.drawRect(x - 2, y - 2, x + panelxSize - 2, y + panelySize - 2, Color.BLACK);
screen.drawRect(x - 1, y - 1, x + panelxSize - 3, y + panelySize - 3, Color.LIGHTER_GREY);
screen.drawRect(x, y, x + panelxSize - 4, y + panelySize - 4, Color.DARKER_GREY);
if (renderer != null) {
renderer.specialItemRendering(itemIdentifierStack.getItem(), x, y);
}
}
// use GuiGraphics to render the ItemStacks
ItemStackRenderer itemstackRenderer = new ItemStackRenderer(x, y, 100.0F, true, false, true);
itemstackRenderer.setItemstack(itemstack).setDisplayAmount(DisplayAmount.HIDE_ONE);
itemstackRenderer.renderInGui();
x += panelxSize;
if (x > width) {
x = 2;
y += panelySize;
}
}
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
GL11.glPopMatrix();
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class PipeTransportLogistics method dropBuffer.
public void dropBuffer() {
Iterator<Triplet<ItemIdentifierStack, Pair<Integer, Integer>, LPTravelingItemServer>> iterator = _itemBuffer.iterator();
while (iterator.hasNext()) {
ItemIdentifierStack next = iterator.next().getValue1();
MainProxy.dropItems(getWorld(), next.makeNormalStack(), getPipe().getX(), getPipe().getY(), getPipe().getZ());
iterator.remove();
}
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class PipeTransportLogistics method resolveRoutedDestination.
public ForgeDirection resolveRoutedDestination(LPTravelingItemServer data) {
ForgeDirection blocked = null;
if (data.getDestinationUUID() == null) {
ItemIdentifierStack stack = data.getItemIdentifierStack();
ItemRoutingInformation result = getRoutedPipe().getQueuedForItemStack(stack);
if (result != null) {
data.setInformation(result);
data.getInfo().setItem(stack);
blocked = data.input.getOpposite();
}
}
if (data.getItemIdentifierStack() != null) {
getRoutedPipe().relayedItem(data.getItemIdentifierStack().getStackSize());
}
if (data.getDestination() >= 0 && !getRoutedPipe().getRouter().hasRoute(data.getDestination(), data.getTransportMode() == TransportMode.Active, data.getItemIdentifierStack().getItem()) && data.getBufferCounter() < MAX_DESTINATION_UNREACHABLE_BUFFER) {
_itemBuffer.add(new Triplet<>(data.getItemIdentifierStack(), new Pair<>(_bufferTimeOut, data.getBufferCounter()), data));
return null;
}
ForgeDirection value;
if (getRoutedPipe().stillNeedReplace() || getRoutedPipe().initialInit()) {
data.setDoNotBuffer(false);
value = ForgeDirection.UNKNOWN;
} else {
value = getRoutedPipe().getRouteLayer().getOrientationForItem(data, blocked);
}
if (value == null && MainProxy.isClient(getWorld())) {
return null;
} else if (value == null) {
LogisticsPipes.log.fatal("THIS IS NOT SUPPOSED TO HAPPEN!");
return ForgeDirection.UNKNOWN;
}
if (value == ForgeDirection.UNKNOWN && !data.getDoNotBuffer() && data.getBufferCounter() < 5) {
_itemBuffer.add(new Triplet<>(data.getItemIdentifierStack(), new Pair<>(_bufferTimeOut, data.getBufferCounter()), null));
return null;
}
if (value != ForgeDirection.UNKNOWN && !getRoutedPipe().getRouter().isRoutedExit(value)) {
if (!isItemExitable(data.getItemIdentifierStack())) {
return null;
}
}
data.resetDelay();
return value;
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class GuiInvSysConnector method drawGuiContainerForegroundLayer.
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
ItemStackRenderer.renderItemIdentifierStackListIntoGui(_allItems, null, page, 9, 59, 9, 27, 18, 18, 100.0F, DisplayAmount.ALWAYS);
int ppi = 0;
int column = 0;
int row = 0;
for (ItemIdentifierStack itemStack : _allItems) {
ppi++;
if (ppi <= 27 * page) {
continue;
}
if (ppi > 27 * (page + 1)) {
continue;
}
ItemStack st = itemStack.unsafeMakeNormalStack();
int x = 9 + 18 * column + guiLeft;
int y = 59 + 18 * row + guiTop;
GL11.glDisable(2896);
int mouseX = Mouse.getX() * width / mc.displayWidth;
int mouseY = height - Mouse.getY() * height / mc.displayHeight - 1;
if (x < mouseX && mouseX < x + 18 && y < mouseY && mouseY < y + 18) {
GuiGraphics.displayItemToolTip(new Object[] { mouseX, mouseY, st, true }, zLevel, guiLeft, guiTop, false);
}
column++;
if (column >= 9) {
row++;
column = 0;
}
}
}
Aggregations