Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit aefc91c

Browse files
committed
more work to go
1 parent f612ba5 commit aefc91c

File tree

61 files changed

+988
-898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+988
-898
lines changed

constants/cooldowns.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"mining": {
3+
"Mining Speed Boost": [
4+
120,
5+
120,
6+
120
7+
],
8+
"Pickolubus": [
9+
120,
10+
110,
11+
100
12+
],
13+
"Vein Seeker": [
14+
60,
15+
60,
16+
60
17+
],
18+
"Maniac Miner": [
19+
60,
20+
59,
21+
59
22+
],
23+
"Gemstone Infusion": [
24+
140,
25+
140,
26+
140
27+
],
28+
"Hazardous Miner": [
29+
140,
30+
140,
31+
140
32+
]
33+
}
34+
}

src/main/java/dev/nyon/skylper/asm/mixins/GuiGraphicsMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package dev.nyon.skylper.asm.mixins;
22

3-
import dev.nyon.skylper.skyblock.mining.AbilityCooldownIdentifier;
3+
import dev.nyon.skylper.skyblock.cooldowns.AbilityCooldownIdentifier;
44
import net.minecraft.client.Minecraft;
55
import net.minecraft.client.gui.Font;
66
import net.minecraft.client.gui.GuiGraphics;

src/main/java/dev/nyon/skylper/asm/mixins/ItemCooldownsMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dev.nyon.skylper.asm.mixins;
22

3-
import dev.nyon.skylper.extensions.render.cooldown.CooldownHandler;
4-
import dev.nyon.skylper.skyblock.mining.AbilityCooldownIdentifier;
3+
import dev.nyon.skylper.skyblock.cooldowns.CooldownHandler;
4+
import dev.nyon.skylper.skyblock.cooldowns.AbilityCooldownIdentifier;
55
import net.minecraft.world.item.Item;
66
import net.minecraft.world.item.ItemCooldowns;
77
import net.minecraft.world.item.ItemStack;

src/main/kotlin/dev/nyon/skylper/Skylper.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import dev.nyon.skylper.config.configJsonBuilder
1010
import dev.nyon.skylper.extensions.event.EventHandler
1111
import dev.nyon.skylper.extensions.event.FabricEvents
1212
import dev.nyon.skylper.extensions.event.MinecraftStopEvent
13-
import dev.nyon.skylper.skyblock.mining.Mining
13+
import dev.nyon.skylper.skyblock.data.api.Apis
1414
import dev.nyon.skylper.skyblock.data.online.OnlineData
1515
import dev.nyon.skylper.skyblock.data.session.PlayerSessionData
1616
import dev.nyon.skylper.skyblock.data.skylper.PlayerDataSaver
@@ -20,7 +20,7 @@ import dev.nyon.skylper.skyblock.data.skylper.playerData
2020
import dev.nyon.skylper.skyblock.menu.Menu
2121
import dev.nyon.skylper.skyblock.misc.Misc
2222
import dev.nyon.skylper.skyblock.registerRootCommand
23-
import dev.nyon.skylper.skyblock.render.SkylperHud
23+
import dev.nyon.skylper.skyblock.render.Render
2424
import kotlinx.coroutines.*
2525
import net.fabricmc.api.ClientModInitializer
2626
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper
@@ -75,15 +75,15 @@ object Skylper : ClientModInitializer {
7575

7676
FabricEvents.listenForFabricEvents()
7777

78-
SkylperHud.init()
78+
Render.init()
7979

80-
Mining.init()
80+
Apis.init()
8181
Menu.init()
8282
Misc.init()
8383
}
8484

8585
private fun handleStop() {
86-
EventHandler.listenEvent<MinecraftStopEvent, Unit> {
86+
EventHandler.listenInfoEvent<MinecraftStopEvent> {
8787
saveConfig(internalConfig)
8888
saveConfig(playerData)
8989
}
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
package dev.nyon.skylper.skyblock.mining.hollows.locations
1+
package dev.nyon.skylper.config.screen
22

33
import dev.isxander.yacl3.api.ButtonOption
44
import dev.isxander.yacl3.api.OptionDescription
55
import dev.isxander.yacl3.api.OptionGroup
66
import dev.isxander.yacl3.dsl.YetAnotherConfigLib
77
import dev.nyon.skylper.Skylper
8-
import dev.nyon.skylper.extensions.event.EventHandler.listenEvent
8+
import dev.nyon.skylper.extensions.event.EventHandler.listenInfoEvent
99
import dev.nyon.skylper.extensions.event.TickEvent
1010
import dev.nyon.skylper.minecraft
11+
import dev.nyon.skylper.skyblock.data.api.CrystalHollowsLocationApi
1112
import dev.nyon.skylper.skyblock.data.session.PlayerSessionData
12-
import dev.nyon.skylper.skyblock.mining.hollows.HollowsModule
1313
import net.minecraft.client.gui.screens.Screen
1414
import net.minecraft.network.chat.Component
1515

1616
fun createLocationScreen(parent: Screen?): Screen = YetAnotherConfigLib("locations") {
1717
val locations by categories.registering {
18-
HollowsModule.waypoints.forEach { loc ->
18+
CrystalHollowsLocationApi.waypoints.forEach { loc ->
1919
groups.register(
2020
loc.specific.key, OptionGroup.createBuilder().apply {
2121
name(loc.specific.displayName)
2222
description(OptionDescription.of(Component.translatable("yacl3.config.locations.category.locations.description")))
2323

24-
option(ButtonOption.createBuilder()
24+
option(
25+
ButtonOption.createBuilder()
2526
.name(Component.translatable("yacl3.config.locations.category.locations.share"))
2627
.description(OptionDescription.of(Component.translatable("yacl3.config.locations.category.locations.share.description")))
2728
.available(PlayerSessionData.isOnSkyblock).action { _, _ ->
@@ -30,11 +31,12 @@ fun createLocationScreen(parent: Screen?): Screen = YetAnotherConfigLib("locatio
3031
)
3132
}.build())
3233

33-
option(ButtonOption.createBuilder()
34+
option(
35+
ButtonOption.createBuilder()
3436
.name(Component.translatable("yacl3.config.locations.category.locations.delete"))
3537
.description(OptionDescription.of(Component.translatable("yacl3.config.locations.category.locations.delete.description")))
3638
.action { _, button ->
37-
HollowsModule.waypoints.remove(loc)
39+
CrystalHollowsLocationApi.waypoints.remove(loc)
3840
button.setAvailable(false)
3941
}.build())
4042
}.build()
@@ -43,6 +45,6 @@ fun createLocationScreen(parent: Screen?): Screen = YetAnotherConfigLib("locatio
4345
}
4446
}.generateScreen(parent)
4547

46-
fun registerHollowsLocationHotkey() = listenEvent<TickEvent, Unit> {
48+
fun registerHollowsLocationHotkey() = listenInfoEvent<TickEvent> {
4749
if (Skylper.crystalHollowsLocationKeybinding.consumeClick()) minecraft.setScreen(createLocationScreen(null))
4850
}

src/main/kotlin/dev/nyon/skylper/config/screen/HollowsYaclScreen.kt renamed to src/main/kotlin/dev/nyon/skylper/config/screen/CrystalHollowsYaclScreen.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package dev.nyon.skylper.config.screen
33
import dev.isxander.yacl3.dsl.*
44
import dev.nyon.skylper.config.config
55
import dev.nyon.skylper.minecraft
6-
import dev.nyon.skylper.skyblock.mining.hollows.locations.createLocationScreen
76
import java.awt.Color
87

98
fun RootDsl.appendHollowsCategory() {

src/main/kotlin/dev/nyon/skylper/extensions/event/EventHandler.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ object EventHandler {
1111

1212
private val listeners = mutableListOf<EventInstance<*, *>>()
1313

14+
inline fun <reified E : InfoEvent> listenInfoEvent(noinline callback: E.() -> Unit) {
15+
val eventClass = E::class
16+
listenEvent(eventClass, callback)
17+
}
18+
1419
inline fun <reified E : Event<C>, C : Any?> listenEvent(noinline callback: E.() -> C) {
1520
val eventClass = E::class
1621
listenEvent(eventClass, callback)
Lines changed: 136 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package dev.nyon.skylper.extensions.event
22

3-
import dev.nyon.skylper.skyblock.mining.hollows.Crystal
4-
import dev.nyon.skylper.skyblock.mining.hollows.locations.HollowsLocation
3+
import dev.nyon.skylper.skyblock.models.mining.crystalHollows.ChestReward
4+
import dev.nyon.skylper.skyblock.models.mining.crystalHollows.Crystal
5+
import dev.nyon.skylper.skyblock.models.mining.crystalHollows.HollowsLocation
56
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext
67
import net.minecraft.client.gui.GuiGraphics
78
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
@@ -17,30 +18,73 @@ import net.minecraft.world.phys.BlockHitResult
1718
import net.minecraft.world.phys.Vec3
1819

1920
/**
20-
* Interface for events and taking generic C as return type.
21+
* Interface for events. Generic C specifies the return type.
2122
*/
2223
interface Event<C : Any?>
2324

24-
object TickEvent : Event<Unit>
25+
/**
26+
* Interfaces for events, that don't need a return type
27+
*/
28+
interface InfoEvent : Event<Unit>
2529

26-
data class AreaChangeEvent(val previous: String?, val next: String?) : Event<Unit>
30+
/**
31+
* Is invoked every tick.
32+
*/
33+
object TickEvent : InfoEvent
2734

28-
data class ProfileChangeEvent(val previous: String?, val next: String?) : Event<Unit>
35+
/**
36+
* Is invoked, when player warps to another island or logs onto Skyblock.
37+
*/
38+
data class AreaChangeEvent(val previous: String?, val next: String?) : InfoEvent
2939

30-
object SkyblockEnterEvent : Event<Unit>
40+
/**
41+
* Is invoked, when player switches profiles.
42+
*/
43+
data class ProfileChangeEvent(val previous: String?, val next: String?) : InfoEvent
3144

32-
object SkyblockQuitEvent : Event<Unit>
45+
/**
46+
* Is invoked, when player enters Skyblock.
47+
*/
48+
object SkyblockEnterEvent : InfoEvent
3349

34-
object HypixelJoinEvent : Event<Unit>
50+
/**
51+
* Is invoked, when player leaves Skyblock.
52+
*/
53+
object SkyblockQuitEvent : InfoEvent
3554

36-
object HypixelQuitEvent : Event<Unit>
55+
/**
56+
* Is invoked, when player joins Hypixel.
57+
*/
58+
object HypixelJoinEvent : InfoEvent
3759

38-
data class CrystalFoundEvent(val crystal: Crystal) : Event<Unit>
60+
/**
61+
* Is invoked, when player leaves Hypixel.
62+
*/
63+
object HypixelQuitEvent : InfoEvent
3964

40-
data class CrystalPlaceEvent(val crystal: Crystal) : Event<Unit>
65+
/**
66+
* Is invoked, when player finds a crystal in the Crystal Hollows.
67+
*/
68+
data class CrystalFoundEvent(val crystal: Crystal) : InfoEvent
69+
70+
/**
71+
* Is invoked, when player places a crystal in the Crystal Hollows.
72+
*/
73+
data class CrystalPlaceEvent(val crystal: Crystal) : InfoEvent
4174

42-
object NucleusRunCompleteEvent : Event<Unit>
75+
/**
76+
* Is invoked, when player gains a Crystal Loot Bundle.
77+
*/
78+
object NucleusRunCompleteEvent : InfoEvent
79+
80+
/**
81+
* Is invoked, when a structure in the Crystal Hollows is found.
82+
*/
83+
data class LocatedHollowsStructureEvent(val location: HollowsLocation) : InfoEvent
4384

85+
/**
86+
* Is invoked, when a particle spawns in the world.
87+
*/
4488
data class ParticleSpawnEvent(
4589
val options: ParticleOptions,
4690
val pos: Vec3,
@@ -49,48 +93,107 @@ data class ParticleSpawnEvent(
4993
val zSpeed: Double,
5094
val force: Boolean,
5195
val decreased: Boolean
52-
) : Event<Unit>
96+
) : InfoEvent
5397

54-
data class EntitySpawnEvent(val entity: Entity) : Event<Unit>
98+
/**
99+
* Is invoked, when entity spawns in the world.
100+
*/
101+
data class EntitySpawnEvent(val entity: Entity) : InfoEvent
55102

56-
data class LevelChangeEvent(val newLevel: ClientLevel?) : Event<Unit>
103+
/**
104+
* Is invoked, when a new world is loading.
105+
*/
106+
data class LevelChangeEvent(val newLevel: ClientLevel?) : InfoEvent
57107

58-
data class MessageEvent(val text: Component, val rawText: String) : Event<Unit>
108+
/**
109+
* Is invoked, when player receives a message.
110+
*/
111+
data class MessageEvent(val text: Component, val rawText: String) : InfoEvent
59112

60-
data class BlockUpdateEvent(val pos: BlockPos, val state: BlockState) : Event<Unit>
113+
/**
114+
* Is invoked, when a [BlockState] changes near the player.
115+
*/
116+
data class BlockUpdateEvent(val pos: BlockPos, val state: BlockState) : InfoEvent
61117

62-
data class BlockBreakEvent(val pos: BlockPos) : Event<Unit>
118+
/**
119+
* Is invoked, when a block broke.
120+
*/
121+
data class BlockBreakEvent(val pos: BlockPos) : InfoEvent
63122

64-
data class RenderAfterTranslucentEvent(val context: WorldRenderContext) : Event<Unit>
123+
/**
124+
* Is invoked after the translucent render of Minecraft. This is a subEvent from Fabric and should be used for
125+
* in-world rendering.
126+
*/
127+
data class RenderAfterTranslucentEvent(val context: WorldRenderContext) : InfoEvent
65128

66-
data class RenderHudEvent(val context: GuiGraphics) : Event<Unit>
129+
/**
130+
* Is invoked, when the hud is rendered. Should be used for HUD rendering.
131+
*/
132+
data class RenderHudEvent(val context: GuiGraphics) : InfoEvent
67133

68-
data class BlockInteractEvent(val result: BlockHitResult) : Event<Unit>
134+
/**
135+
* Is invoked, when a block gets interacted with.
136+
*/
137+
data class BlockInteractEvent(val result: BlockHitResult) : InfoEvent
69138

70-
object MinecraftStopEvent : Event<Unit>
139+
/**
140+
* Is invoked, when Minecraft is closed.
141+
*/
142+
object MinecraftStopEvent : InfoEvent
71143

72-
data class ScreenOpenEvent(val screen: AbstractContainerScreen<*>) : Event<Unit>
144+
/**
145+
* Is invoked, when a screen opens.
146+
*/
147+
data class ScreenOpenEvent(val screen: AbstractContainerScreen<*>) : InfoEvent
73148

74-
data class SetItemEvent(val itemStack: ItemStack) : Event<Unit>
149+
/**
150+
* Is invoked, when an item is being set into an opened inventory.
151+
*/
152+
data class SetItemEvent(val itemStack: ItemStack) : InfoEvent
75153

76-
data class InventoryInitEvent(val items: List<ItemStack>) : Event<Unit>
154+
/**
155+
* Is invoked, when an inventory is opened.
156+
*/
157+
data class InventoryInitEvent(val items: List<ItemStack>) : InfoEvent
77158

78-
data class BossBarNameUpdate(val text: Component, val rawText: String) : Event<Unit>
159+
/**
160+
* Is invoked, when the boss bar changes
161+
*/
162+
data class BossBarNameUpdate(val text: Component, val rawText: String) : InfoEvent
79163

80-
data class PowderGainEvent(val type: PowderType, val newAmount: Int) : Event<Unit> {
164+
/**
165+
* Is invoked, when the player's powder count changes.
166+
*/
167+
data class PowderUpdateEvent(val type: PowderType, val newAmount: Int) : InfoEvent {
81168
enum class PowderType {
82169
GEMSTONE,
83170
MITHRIL,
84171
GLACITE
85172
}
86173
}
87174

88-
data class SideboardUpdateEvent(val lines: List<Component>, val cleanLines: List<String>) : Event<Unit>
89-
data class TablistUpdateEvent(val lines: List<Component>, val cleanLines: List<String>) : Event<Unit>
175+
/**
176+
* Is invoked, when a player picks a treasure chest in the Crystal Hollows.
177+
*/
178+
object TreasureChestPickEvent : InfoEvent
179+
180+
/**
181+
* Is invoked, when a player receives rewards from a treasure chest in the Crystal Hollows.
182+
*/
183+
data class TreasureChestRewardsEvent(val rewards: List<ChestReward>) : InfoEvent
184+
185+
/**
186+
* Is invoked every second. Gives the clean and styled sideboard lines.
187+
*/
188+
data class SideboardUpdateEvent(val lines: List<Component>, val cleanLines: List<String>) : InfoEvent
90189

91190
/**
92-
* Return type is the color as an [Int]
191+
* Is invoked every second. Gives the clean and styled tablist lines.
93192
*/
94-
data class RenderItemBackgroundEvent(val title: Component, val rawTitle: String, val slot: Slot) : Event<Int?>
193+
data class TablistUpdateEvent(val lines: List<Component>, val cleanLines: List<String>) : InfoEvent
95194

96-
data class LocatedHollowsStructureEvent(val location: HollowsLocation) : Event<Unit>
195+
/**
196+
* Is invoked, when the background of an item in an inventory is rendered. Return type is the color the background
197+
* should become as an [Int].
198+
*/
199+
data class RenderItemBackgroundEvent(val title: Component, val rawTitle: String, val slot: Slot) : Event<Int?>

0 commit comments

Comments
 (0)