aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/FilletMagmafish.java
blob: 06a35dcdf1befb684ca9f0912903d5f9234ff8fb (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package me.Danker.features;

import me.Danker.commands.ToggleCommand;
import me.Danker.events.ModInitEvent;
import me.Danker.utils.RenderUtils;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;

public class FilletMagmafish {

    static Map<String, Integer> fillet = new HashMap<>();
    static int total = 0;

    @SubscribeEvent
    public void init(ModInitEvent event) {
        fillet.put("SULPHER_SKITTER_BRONZE", 40);
        fillet.put("SULPHER_SKITTER_SILVER", 60);
        fillet.put("SULPHER_SKITTER_GOLD", 80);
        fillet.put("SULPHER_SKITTER_DIAMOND", 120);
        fillet.put("OBFUSCATED_FISH_1_BRONZE", 16);
        fillet.put("OBFUSCATED_FISH_1_SILVER", 24);
        fillet.put("OBFUSCATED_FISH_1_GOLD", 32);
        fillet.put("OBFUSCATED_FISH_1_DIAMOND", 48);
        fillet.put("STEAMING_HOT_FLOUNDER_BRONZE", 20);
        fillet.put("STEAMING_HOT_FLOUNDER_SILVER", 28);
        fillet.put("STEAMING_HOT_FLOUNDER_GOLD", 40);
        fillet.put("STEAMING_HOT_FLOUNDER_DIAMOND", 60);
        fillet.put("GUSHER_BRONZE", 32);
        fillet.put("GUSHER_SILVER", 48);
        fillet.put("GUSHER_GOLD", 64);
        fillet.put("GUSHER_DIAMOND", 96);
        fillet.put("BLOBFISH_BRONZE", 4);
        fillet.put("BLOBFISH_SILVER", 8);
        fillet.put("BLOBFISH_GOLD", 12);
        fillet.put("BLOBFISH_DIAMOND", 16);
        fillet.put("OBFUSCATED_FISH_2_BRONZE", 40);
        fillet.put("OBFUSCATED_FISH_2_SILVER", 60);
        fillet.put("OBFUSCATED_FISH_2_GOLD", 80);
        fillet.put("OBFUSCATED_FISH_2_DIAMOND", 120);
        fillet.put("SLUGFISH_BRONZE", 40);
        fillet.put("SLUGFISH_SILVER", 60);
        fillet.put("SLUGFISH_GOLD", 80);
        fillet.put("SLUGFISH_DIAMOND", 120);
        fillet.put("FLYFISH_BRONZE", 32);
        fillet.put("FLYFISH_SILVER", 48);
        fillet.put("FLYFISH_GOLD", 64);
        fillet.put("FLYFISH_DIAMOND", 96);
        fillet.put("OBFUSCATED_FISH_3_BRONZE", 400);
        fillet.put("OBFUSCATED_FISH_3_SILVER", 700);
        fillet.put("OBFUSCATED_FISH_3_GOLD", 1000);
        fillet.put("OBFUSCATED_FISH_3_DIAMOND", 1300);
        fillet.put("LAVA_HORSE_BRONZE", 12);
        fillet.put("LAVA_HORSE_SILVER", 16);
        fillet.put("LAVA_HORSE_GOLD", 20);
        fillet.put("LAVA_HORSE_DIAMOND", 24);
        fillet.put("MANA_RAY_BRONZE", 40);
        fillet.put("MANA_RAY_SILVER", 60);
        fillet.put("MANA_RAY_GOLD", 80);
        fillet.put("MANA_RAY_DIAMOND", 120);
        fillet.put("VOLCANIC_STONEFISH_BRONZE", 20);
        fillet.put("VOLCANIC_STONEFISH_SILVER", 28);
        fillet.put("VOLCANIC_STONEFISH_GOLD", 40);
        fillet.put("VOLCANIC_STONEFISH_DIAMOND", 60);
        fillet.put("VANILLE_BRONZE", 80);
        fillet.put("VANILLE_SILVER", 120);
        fillet.put("VANILLE_GOLD", 160);
        fillet.put("VANILLE_DIAMOND", 240);
        fillet.put("SKELETON_FISH_BRONZE", 32);
        fillet.put("SKELETON_FISH_SILVER", 48);
        fillet.put("SKELETON_FISH_GOLD", 64);
        fillet.put("SKELETON_FISH_DIAMOND", 96);
        fillet.put("MOLDFIN_BRONZE", 32);
        fillet.put("MOLDFIN_SILVER", 48);
        fillet.put("MOLDFIN_GOLD", 64);
        fillet.put("MOLDFIN_DIAMOND", 96);
        fillet.put("SOUL_FISH_BRONZE", 32);
        fillet.put("SOUL_FISH_SILVER", 48);
        fillet.put("SOUL_FISH_GOLD", 64);
        fillet.put("SOUL_FISH_DIAMOND", 96);
        fillet.put("KARATE_FISH_BRONZE", 40);
        fillet.put("KARATE_FISH_SILVER", 60);
        fillet.put("KARATE_FISH_GOLD", 80);
        fillet.put("KARATE_FISH_DIAMOND", 120);
        fillet.put("GOLDEN_FISH_BRONZE", 400);
        fillet.put("GOLDEN_FISH_SILVER", 700);
        fillet.put("GOLDEN_FISH_GOLD", 1000);
        fillet.put("GOLDEN_FISH_DIAMOND", 1300);
    }

    @SubscribeEvent
    public void onGuiOpen(GuiOpenEvent event) {
        if (!ToggleCommand.showTotalMagmafish || !Utils.inSkyblock) return;

        if (event.gui instanceof GuiInventory) {
            ItemStack[] inv = Minecraft.getMinecraft().thePlayer.inventory.mainInventory;

            for (ItemStack stack : inv) {
                String id = Utils.getSkyblockItemID(stack);
                if (id == null) continue;

                total += Optional.ofNullable(fillet.get(id)).orElse(0);
            }
        } else {
            total = 0;
        }
    }

    @SubscribeEvent
    public void onGuiScreenRender(GuiScreenEvent.BackgroundDrawnEvent event) {
        if (!ToggleCommand.showTotalMagmafish || !Utils.inSkyblock) return;

        if (event.gui instanceof GuiInventory) {
            if (total == 0) return;

            NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US);
            String display = EnumChatFormatting.BLUE + "Magmafish: " + nf.format(total);

            ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
            int width = sr.getScaledWidth();
            int height = (sr.getScaledHeight() - 222) / 2 + 10;

            RenderUtils.drawCenteredText(display, width, height, 1D);
        }
    }

}