use of com.infinityraider.agricraft.gui.component.GuiComponent in project AgriCraft by AgriCraft.
the class GuiJournal method addNavArrows.
private void addNavArrows() {
GuiComponent leftArrow = new GuiComponentBuilder<>(LEFT_ARROW, 1, 170, 32, 32).setRenderAction(ComponentRenderer::renderIconComponent).setMouseEnterAction((c, p) -> c.setVisable(this.currentPageNumber > 0)).setMouseLeaveAction((c, p) -> c.setVisable(false)).setMouseClickAction((c, p) -> incPage(-1)).setVisable(false).build();
GuiComponent rightArrow = new GuiComponentBuilder<>(RIGHT_ARROW, 223, 170, 32, 32).setRenderAction(ComponentRenderer::renderIconComponent).setMouseEnterAction((c, p) -> c.setVisable(this.currentPageNumber < this.getNumberOfPages() - 1)).setMouseLeaveAction((c, p) -> c.setVisable(false)).setMouseClickAction((c, p) -> incPage(1)).setVisable(false).build();
this.addComponent(leftArrow);
this.addComponent(rightArrow);
}
use of com.infinityraider.agricraft.gui.component.GuiComponent in project AgriCraft by AgriCraft.
the class JournalPageSeed method addSeeds.
private void addSeeds(List<GuiComponent> components) {
List<IAgriMutation> completedMutations = getCompletedMutations();
List<IAgriMutation> uncompletedMutations = getUncompleteMutations();
int y = 1;
int x = 132;
for (IAgriMutation mutation : completedMutations) {
// Increment Row.
y = y + MUTATION_ROW_HEIGHT;
// Child Component
final ItemStack resultStack = mutation.getChild().getSeed();
final GuiComponent child = BasicComponents.getStackComponent(resultStack, x + 69, y);
child.setMouseClickAction((c, p) -> journal.switchPage(mutation.getChild()));
components.add(child);
// Parent 1 Component
final ItemStack parent1Stack = mutation.getParents().get(0).getSeed();
final GuiComponent parent1 = BasicComponents.getStackComponent(parent1Stack, x, y);
parent1.setMouseClickAction((c, p) -> journal.switchPage(mutation.getParents().get(0)));
components.add(parent1);
// Parent 2 Component
final ItemStack parent2Stack = mutation.getParents().get(1).getSeed();
final GuiComponent parent2 = BasicComponents.getStackComponent(parent2Stack, x + 35, y);
parent2.setMouseClickAction((c, p) -> journal.switchPage(mutation.getParents().get(1)));
components.add(parent2);
}
for (IAgriMutation mutation : uncompletedMutations) {
// Increment Row.
y = y + MUTATION_ROW_HEIGHT;
// Parent 1 Component
final ItemStack parent1Stack = mutation.getParents().get(0).getSeed();
final GuiComponent parent1 = BasicComponents.getStackComponent(parent1Stack, x, y);
parent1.setMouseClickAction((c, p) -> journal.switchPage(mutation.getParents().get(0)));
components.add(parent1);
// Parent 2 Component
final ItemStack parent2Stack = mutation.getParents().get(1).getSeed();
final GuiComponent parent2 = BasicComponents.getStackComponent(parent2Stack, x + 35, y);
parent2.setMouseClickAction((c, p) -> journal.switchPage(mutation.getParents().get(1)));
components.add(parent2);
}
}
Aggregations