Search in sources :

Example 1 with GuiComponent

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);
}
Also used : GuiComponentBuilder(com.infinityraider.agricraft.gui.component.GuiComponentBuilder) IAgriPlant(com.infinityraider.agricraft.api.v1.plant.IAgriPlant) ComponentRenderer(com.infinityraider.agricraft.gui.component.ComponentRenderer) MathHelper(com.agricraft.agricore.util.MathHelper) ArrayList(java.util.ArrayList) GuiComponent(com.infinityraider.agricraft.gui.component.GuiComponent) ItemStack(net.minecraft.item.ItemStack) ItemJournal(com.infinityraider.agricraft.items.ItemJournal) List(java.util.List) Side(net.minecraftforge.fml.relauncher.Side) AgriGuiWrapper(com.infinityraider.agricraft.gui.AgriGuiWrapper) ResourceLocation(net.minecraft.util.ResourceLocation) ComponentGui(com.infinityraider.agricraft.gui.ComponentGui) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) GuiComponentBuilder(com.infinityraider.agricraft.gui.component.GuiComponentBuilder) GuiComponent(com.infinityraider.agricraft.gui.component.GuiComponent)

Example 2 with GuiComponent

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);
    }
}
Also used : GuiComponent(com.infinityraider.agricraft.gui.component.GuiComponent) IAgriMutation(com.infinityraider.agricraft.api.v1.mutation.IAgriMutation) ItemStack(net.minecraft.item.ItemStack)

Aggregations

GuiComponent (com.infinityraider.agricraft.gui.component.GuiComponent)2 ItemStack (net.minecraft.item.ItemStack)2 MathHelper (com.agricraft.agricore.util.MathHelper)1 IAgriMutation (com.infinityraider.agricraft.api.v1.mutation.IAgriMutation)1 IAgriPlant (com.infinityraider.agricraft.api.v1.plant.IAgriPlant)1 AgriGuiWrapper (com.infinityraider.agricraft.gui.AgriGuiWrapper)1 ComponentGui (com.infinityraider.agricraft.gui.ComponentGui)1 ComponentRenderer (com.infinityraider.agricraft.gui.component.ComponentRenderer)1 GuiComponentBuilder (com.infinityraider.agricraft.gui.component.GuiComponentBuilder)1 ItemJournal (com.infinityraider.agricraft.items.ItemJournal)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 Side (net.minecraftforge.fml.relauncher.Side)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1