use of buildcraft.transport.pipe.behaviour.PipeBehaviourEmzuli.SlotIndex in project BuildCraft by BuildCraft.
the class GuiEmzuliPipe_BC8 method drawBackgroundLayer.
@Override
protected void drawBackgroundLayer(float partialTicks) {
ICON_GUI.drawAt(mainGui.rootElement);
SlotIndex currentSlot = container.behaviour.getCurrentSlot();
for (SlotIndex index : container.behaviour.getActiveSlots()) {
boolean current = index == currentSlot;
int x = (index.ordinal() < 2 ? 4 : 155);
int y = (index.ordinal() % 2 == 0 ? 21 : 49);
ISprite sprite = current ? BCCoreSprites.TRIGGER_TRUE : BCLibSprites.LOCK;
GuiIcon.drawAt(sprite, mainGui.rootElement.getX() + x, mainGui.rootElement.getY() + y, 16);
}
}
use of buildcraft.transport.pipe.behaviour.PipeBehaviourEmzuli.SlotIndex in project BuildCraft by BuildCraft.
the class GuiEmzuliPipe_BC8 method addButton.
private void addButton(SlotIndex index, int x, int y) {
Supplier<EnumDyeColor> getter = () -> container.behaviour.slotColours.get(index);
Consumer<EnumDyeColor> setter = c -> container.paintWidgets.get(index).setColour(c);
IGuiPosition elem = mainGui.rootElement.offset(x, y);
GuiButtonDrawable button = new GuiButtonDrawable(mainGui, index.name(), elem, PAINT_BUTTON_BUILDER);
button.registerListener((b, key) -> {
final EnumDyeColor old = getter.get();
EnumDyeColor nColour;
switch(key) {
case 0:
{
nColour = ColourUtil.getNextOrNull(old);
break;
}
case 1:
{
nColour = ColourUtil.getPrevOrNull(old);
break;
}
case 2:
{
nColour = null;
break;
}
default:
{
return;
}
}
setter.accept(nColour);
});
mainGui.shownElements.add(button);
// Button paintbrush
IGuiArea area = new GuiRectangle(20, 20).offset(elem);
ISimpleDrawable paintIcon = (px, py) -> {
EnumDyeColor colour = getter.get();
if (colour == null) {
ICON_NO_PAINT.drawAt(px + 2, py + 2);
} else {
ISprite sprite = BCTransportSprites.ACTION_PIPE_COLOUR[colour.ordinal()];
GuiIcon.drawAt(sprite, px + 2, py + 2, 16);
}
};
mainGui.shownElements.add(new GuiElementDrawable(mainGui, area, paintIcon, false));
ITooltipElement tooltips = list -> {
EnumDyeColor colour = getter.get();
String line;
if (colour == null) {
line = LocaleUtil.localize("gui.pipes.emzuli.nopaint");
} else {
line = LocaleUtil.localize("gui.pipes.emzuli.paint", ColourUtil.getTextFullTooltip(colour));
}
list.add(new ToolTip(line));
};
mainGui.shownElements.add(new GuiElementToolTip(mainGui, area, tooltips));
}
Aggregations