aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/HighlightCommissions.java
blob: 3bf1cb2c5f89f505c296e37b63522ff1b2b4f96d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package me.Danker.features;

import me.Danker.commands.ToggleCommand;
import me.Danker.events.GuiChestBackgroundDrawnEvent;
import me.Danker.utils.RenderUtils;
import me.Danker.utils.Utils;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemWritableBook;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.List;

public class HighlightCommissions {

    public static int HIGHLIGHT_COLOUR;

    @SubscribeEvent
    public void onGuiRender(GuiChestBackgroundDrawnEvent event) {
        if(!Utils.inSkyblock) return;
        if(!ToggleCommand.highlightCommissions) return;
        List<Slot> slots = event.slots;
        if (!event.displayName.equals("Commissions")) return;

        for (Slot slot : slots) {
            if (slot != null && slot.getStack() == null) continue;
            if (slot.getStack().getItem() instanceof ItemWritableBook) {
                for (String line : Utils.getItemLore(slot.getStack())) {
                    if (line.contains("COMPLETED")) {
                        RenderUtils.drawOnSlot(event.chestSize, slot.xDisplayPosition, slot.yDisplayPosition, HIGHLIGHT_COLOUR + 0xD7000000);
                        break;
                    }
                }

            }
        }
    }

}