1
1
package dev.nyon.skylper.extensions.event
2
2
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
5
6
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext
6
7
import net.minecraft.client.gui.GuiGraphics
7
8
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
@@ -17,30 +18,73 @@ import net.minecraft.world.phys.BlockHitResult
17
18
import net.minecraft.world.phys.Vec3
18
19
19
20
/* *
20
- * Interface for events and taking generic C as return type.
21
+ * Interface for events. Generic C specifies the return type.
21
22
*/
22
23
interface Event <C : Any ?>
23
24
24
- object TickEvent : Event<Unit>
25
+ /* *
26
+ * Interfaces for events, that don't need a return type
27
+ */
28
+ interface InfoEvent : Event <Unit >
25
29
26
- data class AreaChangeEvent (val previous : String? , val next : String? ) : Event<Unit>
30
+ /* *
31
+ * Is invoked every tick.
32
+ */
33
+ object TickEvent : InfoEvent
27
34
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
29
39
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
31
44
32
- object SkyblockQuitEvent : Event<Unit>
45
+ /* *
46
+ * Is invoked, when player enters Skyblock.
47
+ */
48
+ object SkyblockEnterEvent : InfoEvent
33
49
34
- object HypixelJoinEvent : Event<Unit>
50
+ /* *
51
+ * Is invoked, when player leaves Skyblock.
52
+ */
53
+ object SkyblockQuitEvent : InfoEvent
35
54
36
- object HypixelQuitEvent : Event<Unit>
55
+ /* *
56
+ * Is invoked, when player joins Hypixel.
57
+ */
58
+ object HypixelJoinEvent : InfoEvent
37
59
38
- data class CrystalFoundEvent (val crystal : Crystal ) : Event<Unit>
60
+ /* *
61
+ * Is invoked, when player leaves Hypixel.
62
+ */
63
+ object HypixelQuitEvent : InfoEvent
39
64
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
41
74
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
43
84
85
+ /* *
86
+ * Is invoked, when a particle spawns in the world.
87
+ */
44
88
data class ParticleSpawnEvent (
45
89
val options : ParticleOptions ,
46
90
val pos : Vec3 ,
@@ -49,48 +93,107 @@ data class ParticleSpawnEvent(
49
93
val zSpeed : Double ,
50
94
val force : Boolean ,
51
95
val decreased : Boolean
52
- ) : Event<Unit>
96
+ ) : InfoEvent
53
97
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
55
102
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
57
107
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
59
112
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
61
117
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
63
122
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
65
128
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
67
133
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
69
138
70
- object MinecraftStopEvent : Event<Unit>
139
+ /* *
140
+ * Is invoked, when Minecraft is closed.
141
+ */
142
+ object MinecraftStopEvent : InfoEvent
71
143
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
73
148
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
75
153
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
77
158
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
79
163
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 {
81
168
enum class PowderType {
82
169
GEMSTONE ,
83
170
MITHRIL ,
84
171
GLACITE
85
172
}
86
173
}
87
174
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
90
189
91
190
/* *
92
- * Return type is the color as an [Int]
191
+ * Is invoked every second. Gives the clean and styled tablist lines.
93
192
*/
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
95
194
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