use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class GuiAddMacro method actionPerformed.
@Override
protected void actionPerformed(GuiButton guibutton) {
if (guibutton.id == 0) {
nextPageAll();
} else if (guibutton.id == 1) {
prevPageAll();
} else if (guibutton.id == 2) {
nextPageMacro();
} else if (guibutton.id == 3) {
prevPageMacro();
} else if (guibutton.id == 4) {
if (!(name1 + name2).equals("") && macroItems.size() != 0) {
NBTTagList inventar = new NBTTagList();
for (ItemIdentifierStack stack : macroItems) {
NBTTagCompound itemNBT = new NBTTagCompound();
itemNBT.setInteger("id", Item.getIdFromItem(stack.getItem().item));
itemNBT.setInteger("data", stack.getItem().itemDamage);
if (stack.getItem().tag != null) {
itemNBT.setTag("nbt", stack.getItem().tag);
}
itemNBT.setInteger("amount", stack.getStackSize());
inventar.appendTag(itemNBT);
}
boolean flag = false;
NBTTagList list = diskProvider.getDisk().getTagCompound().getTagList("macroList", 10);
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound tag = list.getCompoundTagAt(i);
String name = tag.getString("name");
if (name.equals(name1 + name2)) {
flag = true;
tag.setTag("inventar", inventar);
break;
}
}
if (!flag) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("name", name1 + name2);
nbt.setTag("inventar", inventar);
list.appendTag(nbt);
}
diskProvider.getDisk().getTagCompound().setTag("macroList", list);
MainProxy.sendPacketToServer(PacketHandler.getPacket(DiscContent.class).setStack(diskProvider.getDisk()).setPosX(diskProvider.getX()).setPosY(diskProvider.getY()).setPosZ(diskProvider.getZ()));
exitGui();
} else if (macroItems.size() != 0) {
setSubGui(new GuiMessagePopup("Please enter a name"));
} else {
setSubGui(new GuiMessagePopup("Select some items"));
}
} else {
super.actionPerformed(guibutton);
}
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class GuiSolderingStation method drawGuiContainerBackgroundLayer.
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(GuiSolderingStation.TEXTURE);
int j = guiLeft;
int k = guiTop;
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);
ItemStackRenderer.renderItemIdentifierStackListIntoGui(tile.getRecipeForTagetAsItemIdentifierStackList(), null, 0, guiLeft + 44, guiTop + 17, 3, 9, 18, 18, 100.0F, DisplayAmount.NEVER);
ItemStack resultstack = tile.getTargetForTaget();
if (resultstack == null) {
resultstack = tile.getTagetForRecipe(false);
}
if (resultstack != null) {
ItemIdentifierStack iis = ItemIdentifier.get(resultstack).makeStack(0);
List<ItemIdentifierStack> iisl = new LinkedList<>();
iisl.add(iis);
ItemStackRenderer.renderItemIdentifierStackListIntoGui(iisl, null, 0, guiLeft + 141, guiTop + 47, 1, 1, 18, 18, 100.0F, DisplayAmount.NEVER);
}
mc.renderEngine.bindTexture(GuiSolderingStation.TEXTURE);
GL11.glDisable(2929);
for (int a = 0; a < 3; a++) {
for (int b = 0; b < 3; b++) {
Gui.drawRect(guiLeft + 44 + (a * 18), guiTop + 17 + (b * 18), guiLeft + 60 + (a * 18), guiTop + 33 + (b * 18), 0xc08b8b8b);
}
}
Gui.drawRect(guiLeft + 141, guiTop + 47, guiLeft + 157, guiTop + 63, 0xc08b8b8b);
GL11.glEnable(2929);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int level = 100 - tile.heat;
drawTexturedModalRect(j + 131, k + 19 + (level * 14 / 100), 176, level * 14 / 100, 14, 14 - (level * 14 / 100));
int progress = tile.progress;
if (progress >= 50) {
drawTexturedModalRect(j + 107, k + 38, 176, 14, 10, 24);
drawTexturedModalRect(j + 117, k + 38, 186, 14, ((progress - 50) * 26 / 100), 24);
} else {
if (progress >= 25) {
drawTexturedModalRect(j + 107, k + 38, 176, 14, ((progress - 25) * 10 / 25), 24);
}
drawTexturedModalRect(j + 114, k + 38, 183, 14, 3, (progress * 17 / 50));
}
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class LogisticsFluidManager method getAvailableFluid.
@Override
public TreeSet<ItemIdentifierStack> getAvailableFluid(List<ExitRoute> validDestinations) {
Map<FluidIdentifier, Integer> allAvailableItems = new HashMap<>();
for (ExitRoute r : validDestinations) {
if (r == null) {
continue;
}
if (!r.containsFlag(PipeRoutingConnectionType.canRequestFrom)) {
continue;
}
if (!(r.destination.getPipe() instanceof IProvideFluids)) {
continue;
}
IProvideFluids provider = (IProvideFluids) r.destination.getPipe();
Map<FluidIdentifier, Integer> allItems = provider.getAvailableFluids();
for (Entry<FluidIdentifier, Integer> liquid : allItems.entrySet()) {
Integer amount = allAvailableItems.get(liquid.getKey());
if (amount == null) {
allAvailableItems.put(liquid.getKey(), liquid.getValue());
} else {
long addition = ((long) amount) + liquid.getValue();
if (addition > Integer.MAX_VALUE) {
addition = Integer.MAX_VALUE;
}
allAvailableItems.put(liquid.getKey(), (int) addition);
}
}
}
TreeSet<ItemIdentifierStack> itemIdentifierStackList = allAvailableItems.entrySet().stream().map(item -> new ItemIdentifierStack(item.getKey().getItemIdentifier(), item.getValue())).collect(Collectors.toCollection(TreeSet::new));
return itemIdentifierStackList;
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class SelectItemOutOfList method mouseClicked.
@Override
protected void mouseClicked(int mouseX, int mouseY, int button) {
int x = 0;
int y = -page * 10;
int count = 0;
for (ItemIdentifierStack stack : canidate) {
if (y >= 0) {
if (guiLeft + 5 + x * 18 < mouseX && mouseX < guiLeft + 5 + x * 18 + 16 && guiTop + 17 + y * 18 < mouseY && mouseY < guiTop + 17 + y * 18 + 16) {
handler.handleItemChoise(count);
exitGui();
}
}
x++;
if (x > 7) {
x = 0;
y++;
}
count++;
if (y > 9) {
break;
}
}
super.mouseClicked(mouseX, mouseY, button);
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class SelectItemOutOfList method drawGuiContainerForegroundLayer.
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
tooltip = null;
int x = 0;
int y = -page * 10;
for (ItemIdentifierStack stack : canidate) {
if (y >= 0) {
ItemStack itemStack = stack.makeNormalStack();
FontRenderer font = itemStack.getItem().getFontRenderer(itemStack);
if (font == null) {
font = fontRendererObj;
}
itemRenderer.renderItemAndEffectIntoGUI(font, mc.renderEngine, itemStack, guiLeft + 5 + x * 18, guiTop + 17 + y * 18);
// With empty string, because damage value indicator struggles with the depth
itemRenderer.renderItemOverlayIntoGUI(font, mc.renderEngine, itemStack, guiLeft + 5 + x * 18, guiTop + 17 + y * 18, "");
if (guiLeft + 5 + x * 18 < mouseX && mouseX < guiLeft + 5 + x * 18 + 16 && guiTop + 17 + y * 18 < mouseY && mouseY < guiTop + 17 + y * 18 + 16 && !hasSubGui()) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glColorMask(true, true, true, false);
SimpleGraphics.drawGradientRect(guiLeft + 5 + x * 18, guiTop + 17 + y * 18, guiLeft + 5 + x * 18 + 16, guiTop + 17 + y * 18 + 16, Color.WHITE_50, Color.WHITE_50, 0.0);
GL11.glColorMask(true, true, true, true);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
tooltip = new Object[] { guiLeft + mouseX, guiTop + mouseY, itemStack };
}
}
x++;
if (x > 7) {
x = 0;
y++;
}
if (y > 9) {
break;
}
}
}
Aggregations