diff options
-rw-r--r-- | build.gradle.kts | 2 | ||||
-rw-r--r-- | settings.gradle.kts | 2 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/DulkirMod.kt | 25 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/config/Config.kt | 18 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/events/ChatEvent.kt | 23 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/events/Events.kt | 43 | ||||
-rw-r--r-- | src/main/resources/mcmod.info | 2 | ||||
-rw-r--r-- | src/main/resources/mixins.dulkirmod.json | 2 |
8 files changed, 63 insertions, 54 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 5d145fa..fc75a8f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -126,4 +126,6 @@ tasks.shadowJar { fun relocate(name: String) = relocate(name, "com.dulkirmod.deps.$name") } +tasks.withType<Jar> { duplicatesStrategy = DuplicatesStrategy.EXCLUDE } + tasks.assemble.get().dependsOn(tasks.remapJar)
\ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index a8885ca..65de4df 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -18,4 +18,4 @@ pluginManagement { } } -rootProject.name = "examplemod" +rootProject.name = "dulkirmod" diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 6217b38..e05a06a 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -1,25 +1,31 @@ package dulkirmod -import dulkirmod.command.* +import dulkirmod.command.EnchantRuneCommand +import dulkirmod.command.FairyCommand +import dulkirmod.command.HelpCommand +import dulkirmod.command.SettingsCommand +import dulkirmod.config.Config +import dulkirmod.events.ChatEvent import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiScreen import net.minecraft.client.settings.KeyBinding +import net.minecraftforge.client.ClientCommandHandler +import net.minecraftforge.client.event.ClientChatReceivedEvent import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.client.registry.ClientRegistry import net.minecraftforge.fml.common.Mod import net.minecraftforge.fml.common.event.FMLInitializationEvent import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent import net.minecraftforge.fml.common.event.FMLPreInitializationEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent import net.minecraftforge.fml.common.gameevent.TickEvent import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent import org.lwjgl.input.Keyboard -import dulkirmod.config.Config -import net.minecraftforge.client.ClientCommandHandler import java.io.File import kotlin.coroutines.EmptyCoroutineContext @@ -48,11 +54,9 @@ class DulkirMod { @Mod.EventHandler fun onInit(event: FMLInitializationEvent) { config.init() - - - listOf( - this, - ).forEach(MinecraftForge.EVENT_BUS::register) + // REGISTER EVENTS HERE + MinecraftForge.EVENT_BUS.register(this) + MinecraftForge.EVENT_BUS.register(ChatEvent()) keyBinds.forEach(ClientRegistry::registerKeyBinding) } @@ -89,4 +93,9 @@ class DulkirMod { KeyBinding("Open Settings", Keyboard.KEY_RSHIFT, "Dulkir Mod"), ) } + + + // terminal throttle code + + } diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt index 859fd9d..b8dc20a 100644 --- a/src/main/kotlin/dulkirmod/config/Config.kt +++ b/src/main/kotlin/dulkirmod/config/Config.kt @@ -36,8 +36,26 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod") { ) var hideHeartParticles = false + @Property( + type = PropertyType.SWITCH, + name = "Throttle Notifier", + description = "Making features out of bugs wow", + category = "General" + ) + var throttleNotifier = false + + @Property( + type = PropertyType.TEXT, + name = "Throttle Notifier String", + description = "How do you want to tell people you are throttled?", + category = "General", + placeholder = "i am being throttled zzz", + protectedText = false + ) + var customMessage: String = "i am being throttled zzz" fun init() { initialize() + addDependency("customMessage", "throttleNotifier") } } diff --git a/src/main/kotlin/dulkirmod/events/ChatEvent.kt b/src/main/kotlin/dulkirmod/events/ChatEvent.kt new file mode 100644 index 0000000..898e2e7 --- /dev/null +++ b/src/main/kotlin/dulkirmod/events/ChatEvent.kt @@ -0,0 +1,23 @@ +package dulkirmod.events + +import dulkirmod.DulkirMod +import net.minecraftforge.client.event.ClientChatReceivedEvent +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class ChatEvent { + @SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW) + fun onChat(event: ClientChatReceivedEvent) { + if (event.type == 2.toByte()) { + return + } + val unformatted = stripColorCodes(event.message.unformattedText) + if (unformatted == "Warping you to your SkyBlock island..." && DulkirMod.config.throttleNotifier) { + event.isCanceled = true; + DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage) + } + } + private fun stripColorCodes(string: String): String { + return string.replace("ยง.".toRegex(), "") + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/events/Events.kt b/src/main/kotlin/dulkirmod/events/Events.kt deleted file mode 100644 index bc4654d..0000000 --- a/src/main/kotlin/dulkirmod/events/Events.kt +++ /dev/null @@ -1,43 +0,0 @@ -package dulkirmod.events - -import net.minecraft.client.gui.inventory.GuiContainer -import net.minecraft.client.model.ModelBase -import net.minecraft.entity.EntityLivingBase -import net.minecraft.inventory.Container -import net.minecraft.inventory.Slot -import net.minecraft.network.Packet -import net.minecraftforge.fml.common.eventhandler.Cancelable -import net.minecraftforge.fml.common.eventhandler.Event - -open class ClickEvent : Event() { - @Cancelable - class LeftClickEvent : ClickEvent() - - @Cancelable - class RightClickEvent : ClickEvent() -} - -open class GuiContainerEvent(val container: Container, val gui: GuiContainer) : Event() { - @Cancelable - class DrawSlotEvent(container: Container, gui: GuiContainer, var slot: Slot) : - GuiContainerEvent(container, gui) - - @Cancelable - class SlotClickEvent(container: Container, gui: GuiContainer, var slot: Slot?, var slotId: Int) : - GuiContainerEvent(container, gui) -} - -@Cancelable -class ReceivePacketEvent(val packet: Packet<*>) : Event() - -@Cancelable -class RenderLivingEntityEvent( - var entity: EntityLivingBase, - var p_77036_2_: Float, - var p_77036_3_: Float, - var p_77036_4_: Float, - var p_77036_5_: Float, - var p_77036_6_: Float, - var scaleFactor: Float, - var modelBase: ModelBase -) : Event() diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f735008..dc2d9ce 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -6,7 +6,7 @@ "version": "${version}", "mcversion": "${mcversion}", "authorList": [ - "Dulkir", "Nopo" + "Dulkir" ] } ] diff --git a/src/main/resources/mixins.dulkirmod.json b/src/main/resources/mixins.dulkirmod.json index bff8106..ee75ec9 100644 --- a/src/main/resources/mixins.dulkirmod.json +++ b/src/main/resources/mixins.dulkirmod.json @@ -2,7 +2,7 @@ "minVersion": "0.6", "compatibilityLevel": "JAVA_8", "package": "dulkirmod.mixins", - "refmap": "mixins.skyblockclient.refmap.json", + "refmap": "mixins.dulkirmod.refmap.json", "client": [ "MixinRendererManager" ], |