-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
157 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
|
||
networkTimeout=30000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
plugins { | ||
kotlin("jvm") version "1.6.21" apply false | ||
id("cc.polyfrost.multi-version.root") | ||
kotlin("jvm") version "1.8.22" apply false | ||
id("org.polyfrost.multi-version.root") | ||
id("com.github.johnrengelman.shadow") version "7.1.2" apply false | ||
} | ||
|
||
preprocess { | ||
// "1.12.2-forge"(11202, "srg") { | ||
"1.8.9-forge"(10809, "srg") | ||
} | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package net.optifine.render; | ||
|
||
public interface RenderEnv { | ||
public class RenderEnv { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,21 @@ | ||
package me.redth.mmcutils | ||
|
||
import cc.polyfrost.oneconfig.libs.universal.ChatColor | ||
import me.redth.mmcutils.core.Core | ||
import me.redth.mmcutils.config.ModConfig | ||
import net.minecraft.client.Minecraft | ||
import net.minecraft.scoreboard.ScorePlayerTeam | ||
import net.minecraftforge.client.event.ClientChatReceivedEvent | ||
import net.minecraftforge.client.event.RenderGameOverlayEvent | ||
import net.minecraftforge.common.MinecraftForge | ||
import net.minecraftforge.fml.common.Mod | ||
import net.minecraftforge.fml.common.event.FMLInitializationEvent | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent | ||
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientDisconnectionFromServerEvent | ||
import java.util.Timer | ||
import kotlin.concurrent.schedule | ||
|
||
@Mod(modid = MMCUtils.MODID, name = MMCUtils.NAME, version = MMCUtils.VERSION, modLanguageAdapter = "cc.polyfrost.oneconfig.utils.KotlinLanguageAdapter") | ||
object MMCUtils { | ||
const val MODID = "@ID@" | ||
const val NAME = "@NAME@" | ||
const val VERSION = "@VER@" | ||
private val ALL_PROXY = arrayOf("AS Practice", "EU Practice", "NA Practice", "SA Practice") | ||
private val BRIDGING_GAMES = arrayOf("Bed Fight", "Fireball Fight", "Bridges", "Battle Rush") | ||
private val mc = Minecraft.getMinecraft() | ||
|
||
var checkedScoreboard = false | ||
var inPractice = false | ||
var inPartyChat = false | ||
var inBridgingGame = false | ||
|
||
@Mod.EventHandler | ||
fun init(e: FMLInitializationEvent) { | ||
MinecraftForge.EVENT_BUS.register(this) | ||
ModConfig.initialize() | ||
} | ||
|
||
@SubscribeEvent | ||
fun onQuit(e: ClientDisconnectionFromServerEvent) { | ||
inBridgingGame = false | ||
inPartyChat = false | ||
inPractice = false | ||
checkedScoreboard = false | ||
} | ||
|
||
@SubscribeEvent | ||
fun onChat(e: ClientChatReceivedEvent) { | ||
val cleanText = e.message.unformattedText!! | ||
|
||
scheduleCheckScoreboard(cleanText) | ||
|
||
if (!inPractice) return | ||
|
||
tryPartyChat(cleanText) | ||
checkBridgingGame(cleanText) | ||
checkGameEnd(cleanText) | ||
} | ||
|
||
@SubscribeEvent | ||
fun preventTablist(e: RenderGameOverlayEvent.Pre) { | ||
if (!ModConfig.disablePlayerList) return | ||
if (e.type != RenderGameOverlayEvent.ElementType.PLAYER_LIST) return | ||
if (!inPractice) return | ||
e.isCanceled = true | ||
} | ||
|
||
private fun tryPartyChat(chat: String) { | ||
if (inPartyChat) return | ||
if (chat !in ALL_PROXY) return | ||
if (!ModConfig.autoPartyChat) return | ||
|
||
mc.thePlayer.sendChatMessage("/p chat") | ||
inPartyChat = true | ||
} | ||
|
||
private fun checkBridgingGame(chat: String) { | ||
if (inBridgingGame) return | ||
if (chat !in BRIDGING_GAMES) return | ||
|
||
inBridgingGame = true | ||
} | ||
|
||
private fun checkGameEnd(chat: String) { | ||
if (!chat.startsWith("Match Results")) return | ||
|
||
if (inBridgingGame) inBridgingGame = false | ||
|
||
if (ModConfig.autoGG) mc.thePlayer.sendChatMessage(ModConfig.autoGGText) | ||
} | ||
|
||
private fun scheduleCheckScoreboard(chat: String) { | ||
if (checkedScoreboard) return | ||
if (inPractice) return | ||
if (chat != "Minemen Club") return | ||
if (!ModConfig.autoQueue) return | ||
|
||
Timer().schedule(1000L) { checkScoreboard() } | ||
MinecraftForge.EVENT_BUS.register(Core) | ||
ModConfig | ||
} | ||
|
||
private fun checkScoreboard() { | ||
checkedScoreboard = true | ||
val scoreboard = mc.theWorld.scoreboard ?: return | ||
val objective = scoreboard.getObjectiveInDisplaySlot(1) ?: return | ||
for (score in scoreboard.getSortedScores(objective)) { | ||
val team = scoreboard.getPlayersTeam(score.playerName) ?: continue | ||
val text = ChatColor.stripColorCodes(ScorePlayerTeam.formatPlayerName(team, score.playerName))?: continue | ||
val mmcProxy = text.split(".minemen.club").firstOrNull() ?: continue | ||
if (mmcProxy.length != 2) continue | ||
mc.thePlayer.sendChatMessage("/joinqueue $mmcProxy-practice") | ||
inPractice = true | ||
break | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package me.redth.mmcutils.config | ||
|
||
import cc.polyfrost.oneconfig.hud.SingleTextHud | ||
import me.redth.mmcutils.MMCUtils | ||
import net.minecraft.client.Minecraft | ||
import cc.polyfrost.oneconfig.utils.dsl.mc | ||
import me.redth.mmcutils.core.Core | ||
|
||
class HeightLimitHud : SingleTextHud("Height Limit Distance", false) { | ||
override fun getText(example: Boolean) = if (MMCUtils.inBridgingGame) { | ||
val distance = 100 - Minecraft.getMinecraft().thePlayer.posY.toInt() | ||
override fun getText(example: Boolean) = if (Core.inBridgingGame) { | ||
val distance = 100 - mc.thePlayer.posY.toInt() | ||
distance.toString() | ||
} else "3" | ||
|
||
override fun shouldShow() = super.shouldShow() && MMCUtils.inBridgingGame | ||
override fun shouldShow() = super.shouldShow() && Core.inBridgingGame | ||
} |
Oops, something went wrong.