Skip to content

Commit

Permalink
Made PacketEvent cancellable
Browse files Browse the repository at this point in the history
  • Loading branch information
odtheking committed Nov 22, 2024
1 parent f72af4f commit c4de773
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/kotlin/me/odinmain/events/impl/PacketEvents.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package me.odinmain.events.impl

import net.minecraft.network.Packet
import net.minecraftforge.fml.common.eventhandler.Cancelable
import net.minecraftforge.fml.common.eventhandler.Event

open class PacketEvent(val packet: Packet<*>) : Event() {

@Cancelable
class Receive(packet: Packet<*>) : PacketEvent(packet)

@Cancelable
class Send(packet: Packet<*>) : PacketEvent(packet)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object Splits : Module(

val (times, current) = getAndUpdateSplitsTimes(currentSplits)
if (currentSplits.splits.isEmpty()) return@HudSetting 0f to 0f
val x = getMCTextWidth("Professor: 00m 00s")
val x = getMCTextWidth("Professor: 0m 00s")
currentSplits.splits.dropLast(1).forEachIndexed { index, split ->
val time = formatTime(if (index >= times.size) 0 else times[index], numbersAfterDecimal)
mcText(split.name, 1f, 9f + index * getMCTextHeight(), 1f, Color.WHITE, shadow = true, center = false)
Expand Down

0 comments on commit c4de773

Please sign in to comment.