Skip to content

Commit

Permalink
chore: Merge 1.10.6 into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Sep 15, 2024
2 parents d4e2616 + ddb3851 commit e5d5e44
Show file tree
Hide file tree
Showing 30 changed files with 245 additions and 96 deletions.
14 changes: 9 additions & 5 deletions mod/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ dependencies {
}

shadowMe(platform(kotlin("bom")))
shadowMe(platform(ktor("bom", "2.3.11", addSuffix = false)))
shadowMe(platform(ktor("bom", "2.3.12", addSuffix = false)))

shadowMe(ktor("serialization-kotlinx-json"))

Expand Down Expand Up @@ -164,11 +164,15 @@ dependencies {
exclude(module = "bcprov-jdk18on")
}
compileOnly("org.bouncycastle:bcprov-jdk18on:1.78.1")
shadowMe("net.hypixel:mod-api:0.4.0")


shadowMe(annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0-beta.1")!!)
annotationProcessor("org.spongepowered:mixin:0.8.5:processor")
compileOnly("net.hypixel:mod-api-forge:1.0.1.1") {
exclude(group = "me.djtheredstoner", module = "DevAuth-forge-legacy")
}
shadowMe("net.hypixel:mod-api-forge-tweaker:1.0.1.1")

shadowMe(annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0-beta.2")!!)
annotationProcessor("org.spongepowered:mixin:0.8.7:processor")
compileOnly("org.spongepowered:mixin:0.8.5")
}

Expand Down Expand Up @@ -241,7 +245,7 @@ tasks {
relocate("kotlinx.serialization", "gg.skytils.ktx-serialization")
relocate("kotlinx.coroutines", "gg.skytils.ktx-coroutines")
relocate("gg.essential.vigilance", "gg.skytils.vigilance")
relocate("net.hypixel", "gg.skytils.hypixel-net")
relocate("net.hypixel.modapi.tweaker", "gg.skytils.hypixel-net.modapi.tweaker")

exclude(
"**/LICENSE_MixinExtras",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ private void onSendPacket(Packet<?> packet, CallbackInfo ci) {
@Inject(method = "handleSpawnMob", at = @At("TAIL"))
private void onHandleSpawnMobTail(S0FPacketSpawnMob packetIn, CallbackInfo ci) {
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());
MasterMode7Features.INSTANCE.onMobSpawned(entity);
((ExtensionEntityLivingBase) entity).getSkytilsHook().onNewDisplayName(
entity.getDataWatcher().getWatchableObjectString(2)
);
if (entity != null) {
MasterMode7Features.INSTANCE.onMobSpawned(entity);
((ExtensionEntityLivingBase) entity).getSkytilsHook().onNewDisplayName(
entity.getDataWatcher().getWatchableObjectString(2)
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(LayerCape.class)
@Mixin(value = LayerCape.class, priority = 1010)
public abstract class MixinLayerCape implements LayerRenderer<AbstractClientPlayer> {
@Shadow
@Final
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
package gg.skytils.skytilsmod.tweaker;

import gg.essential.loader.stage0.EssentialSetupTweaker;
import net.hypixel.modapi.tweaker.HypixelModAPITweaker;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.fml.relauncher.FMLSecurityManager;

Expand Down Expand Up @@ -53,6 +55,10 @@ public void acceptOptions(List<String> args, File gameDir, File assetsDir, Strin
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
super.injectIntoClassLoader(classLoader);

@SuppressWarnings("unchecked")
List<String> tweakClassNames = (List<String>) Launch.blackboard.get("TweakClasses");
tweakClassNames.add(HypixelModAPITweaker.class.getName());
}

@Override
Expand Down
9 changes: 3 additions & 6 deletions mod/src/main/kotlin/gg/skytils/skytilsmod/Skytils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ object Skytils : CoroutineScope, EventSubscriber {
}
}


fun onHypixelPacketFail(event: HypixelPacketFailedEvent) {
UChat.chat("$failPrefix Mod API request failed: ${event.reason}")
}
Expand All @@ -558,10 +559,8 @@ object Skytils : CoroutineScope, EventSubscriber {
IO.launch {
TrophyFish.loadFromApi()
}
IO.launch {
if (config.connectToWS)
WSClient.openConnection()
}
}
//#if MC<11400
if (!Utils.inSkyblock && Utils.isOnHypixel && event.packet is S3DPacketDisplayScoreboard && event.packet.func_149371_c() == 1) {
//#else
Expand Down Expand Up @@ -596,9 +595,7 @@ object Skytils : CoroutineScope, EventSubscriber {
Utils.skyblock = false
Utils.dungeons = false

IO.launch {
WSClient.closeConnection()
}
WSClient.closeConnection()
}

fun onSendPacket(event: PacketSendEvent<*>) {
Expand Down
33 changes: 32 additions & 1 deletion mod/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import gg.skytils.skytilsmod.mixins.transformers.accessors.AccessorCommandHandle
import gg.skytils.skytilsmod.utils.ModChecker
import gg.skytils.skytilsmod.utils.SuperSecretSettings
import gg.skytils.skytilsmod.utils.Utils
import gg.skytils.skytilsws.client.WSClient
import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.ClientCommandHandler
import net.minecraftforge.fml.common.Loader
Expand All @@ -51,6 +52,16 @@ object Config : Vigilant(
(if (Utils.isBSMod) "BSMod" else "Skytils") + " (${Reference.VERSION})",
sortingBehavior = ConfigSorting
) {
@Property(
type = PropertyType.SWITCH, name = "Connect to Skytils WS Server",
description = "Skytils now can relay information from other Skytils users through our first-party websocket server!\nSome features will be hidden and will not work if this switch isn't on.",
category = "General", subcategory = "API",
i18nName = "skytils.config.general.api.connect_to_skytils_ws_server",
i18nCategory = "skytils.config.general",
i18nSubcategory = "skytils.config.general.api"
)
var connectToWS = true

@Property(
type = PropertyType.SWITCH, name = "Fetch Kuudra Prices",
description = "Fetches the Kuudra prices for Skytils to use.\nSkytils currently uses a third-party to retrieve this information.\nSome features will be hidden and will not work if this switch isn't on.",
Expand Down Expand Up @@ -367,7 +378,7 @@ object Config : Vigilant(

@Property(
type = PropertyType.BUTTON, name = "Dungeon Sweat",
description = "Click if dungeon sweat???",
description = "Click if dungeon sweat???\n§1In memory of AzuredBlue, 2019-2024. §cRIP\n§7Yes this actually does something...",
category = "Dungeons", subcategory = "Miscellaneous",
searchTags = ["predev", "pre-dev", "arrow", "tic tac toe", "solver", "device"],
i18nName = "skytils.config.dungeons.miscellaneous.dungeon_sweat",
Expand Down Expand Up @@ -3480,6 +3491,16 @@ object Config : Vigilant(
)
var useSlayerHitMethod = true

@Property(
type = PropertyType.SWITCH, name = "Use Nametag to Detect Slayer",
description = "Finds your slayer based on the nametag.",
category = "Slayer", subcategory = "General",
i18nName = "skytils.config.slayer.general.use_nametag_to_detect_slayer",
i18nCategory = "skytils.config.slayer",
i18nSubcategory = "skytils.config.slayer.general"
)
var useNametagHitMethod = false

@Property(
type = PropertyType.SWITCH, name = "Ping when in Atoned Horror Danger Zone",
description = "Pings when you are standing on the Atoned Horror's TNT target.",
Expand Down Expand Up @@ -4479,6 +4500,16 @@ object Config : Vigilant(
RepartyCommand
}
}

registerListener("connectToWS") { state: Boolean ->
if (state) {
if (mc.theWorld != null) {
WSClient.openConnection()
}
} else {
WSClient.closeConnection()
}
}
}

fun init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import gg.skytils.event.impl.screen.GuiContainerSlotClickEvent
import gg.skytils.event.register
import gg.skytils.skytilsmod.Skytils
import gg.skytils.skytilsmod.Skytils.IO
import gg.skytils.skytilsmod.core.MC
import gg.skytils.skytilsmod.core.structure.GuiElement
import gg.skytils.skytilsmod.features.impl.handlers.AuctionData
import gg.skytils.skytilsmod.features.impl.handlers.KuudraPriceData
Expand All @@ -36,7 +37,9 @@ import gg.skytils.skytilsmod.utils.graphics.SmartFontRenderer
import gg.skytils.skytilsmod.utils.graphics.SmartFontRenderer.TextAlignment
import gg.skytils.skytilsmod.utils.graphics.colors.CommonColors
import gg.skytils.skytilsmod.utils.graphics.colors.CustomColor
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.inventory.ContainerChest
import net.minecraft.item.ItemStack
Expand Down Expand Up @@ -191,9 +194,11 @@ object KuudraChestProfit : EventSubscriber {
} else {
AuctionData.lowestBINs[identifier] ?: 0.0
}
items.add(KuudraChestLootItem(item.stackSize, displayName, itemValue))
withContext(Dispatchers.MC) {
items.add(KuudraChestLootItem(item.stackSize, displayName, itemValue))

value += itemValue
value += itemValue
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import gg.skytils.skytilsmod.Skytils
import gg.skytils.skytilsmod.core.structure.GuiElement
import gg.skytils.skytilsmod.core.tickTimer
import gg.skytils.skytilsmod.features.impl.dungeons.DungeonFeatures.dungeonFloorNumber
import gg.skytils.skytilsmod.features.impl.dungeons.catlas.core.map.Room
import gg.skytils.skytilsmod.features.impl.dungeons.catlas.core.map.RoomState
import gg.skytils.skytilsmod.features.impl.dungeons.catlas.core.map.RoomType
import gg.skytils.skytilsmod.features.impl.dungeons.catlas.handlers.DungeonInfo
import gg.skytils.skytilsmod.listeners.DungeonListener
import gg.skytils.skytilsmod.utils.NumberUtil
import gg.skytils.skytilsmod.utils.NumberUtil.roundToPrecision
Expand Down Expand Up @@ -92,6 +96,14 @@ object DungeonTimer : EventSubscriber {
)
}

bloodOpenTime != -1L && bloodClearTime == -1L && message == "§r§c[BOSS] The Watcher§r§f: That will be enough for now.§r" -> {
DungeonInfo.uniqueRooms.find { it.mainRoom.data.type == RoomType.BLOOD }?.let {
if (it.mainRoom.state > RoomState.CLEARED) {
it.mainRoom.state = RoomState.CLEARED
}
}
}

message == "§r§c[BOSS] The Watcher§r§f: You have proven yourself. You may pass.§r" -> {
bloodClearTime = System.currentTimeMillis()
if (Skytils.config.dungeonTimer) UChat.chat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ object ScoreCalculation {
init {
tickTimer(5, repeats = true) {
isPaul.set(
(MayorInfo.currentMayor == "Paul" && MayorInfo.mayorPerks.contains("EZPZ")) || MayorInfo.jerryMayor?.name == "Paul"
(MayorInfo.allPerks.contains("EZPZ")) || MayorInfo.jerryMayor?.name == "Paul"
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ object CatlasConfig : Vigilant(
type = PropertyType.SELECTOR,
description = "Shows names of rooms on map.",
category = "Rooms",
options = ["None", "Puzzles / Trap", "All"],
options = ["None", "Puzzles", "Puzzles / Trap", "All"],
i18nName = "catlas.config.rooms..room_names",
i18nCategory = "catlas.config.rooms"
)
var mapRoomNames = 1
var mapRoomNames = 2

@Property(
name = "Center Room Names",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,10 @@ object CatlasElement : GuiElement(name = "Dungeon Map", x = 0, y = 0) {

val name = mutableListOf<String>()

if (CatlasConfig.mapRoomNames != 0 && Utils.equalsOneOf(
roomType,
RoomType.PUZZLE,
RoomType.TRAP
) || CatlasConfig.mapRoomNames == 2 && Utils.equalsOneOf(
if ((CatlasConfig.mapRoomNames != 0 && roomType == RoomType.PUZZLE) || (CatlasConfig.mapRoomNames >= 2 && roomType == RoomType.TRAP) || (CatlasConfig.mapRoomNames == 3 && Utils.equalsOneOf(
roomType,
RoomType.NORMAL, RoomType.RARE, RoomType.CHAMPION
)
))
) {
name.addAll(room.data.name.split(" "))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Room(override val x: Int, override val z: Int, var data: RoomData) : Tile
else -> CatlasConfig.colorRoom
}
}
var uniqueRoom: UniqueRoom? = null

fun getArrayPosition(): Pair<Int, Int> {
return Pair((x - DungeonScanner.startX) / 16, (z - DungeonScanner.startZ) / 16)
Expand All @@ -51,9 +52,13 @@ class Room(override val x: Int, override val z: Int, var data: RoomData) : Tile
val unique = DungeonInfo.uniqueRooms.find { it.name == roomName }

if (unique == null) {
DungeonInfo.uniqueRooms.add(UniqueRoom(column, row, this))
UniqueRoom(column, row, this).let {
DungeonInfo.uniqueRooms.add(it)
uniqueRoom = it
}
} else {
unique.addTile(column, row, this)
uniqueRoom = unique
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ object DungeonScanner {
scanRoom(xPos, zPos, z, x)?.let {
DungeonInfo.dungeonList[z * 11 + x] = it
if (it is Room && it.data.name != "Unknown") {
IO.launch {
DungeonListener.outboundRoomQueue.add(C2SPacketDungeonRoom(SBInfo.server ?: return@launch, it.data.name, xPos, zPos, x, z, it.core, it.isSeparator))
SBInfo.server?.let { server ->
DungeonListener.outboundRoomQueue.add(C2SPacketDungeonRoom(server, it.data.name, xPos, zPos, x, z, it.core, it.isSeparator))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ object MapUpdater {

if (mapTile.state.ordinal < room.state.ordinal) {
room.state = mapTile.state
if (room is Room && room.state == RoomState.GREEN) {
room.uniqueRoom?.foundSecrets = room.uniqueRoom?.foundSecrets?.coerceAtLeast(room.data.secrets)
}
}

if (mapTile is Door && room is Door) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ object AuctionData : EventSubscriber {
}${"-SPLASH".toStringIfTrue(extraAttr.hasKey("splash"))}"
}

"RUNE" -> if (extraAttr.hasKey("runes")) {
"RUNE", "UNIQUE_RUNE" -> if (extraAttr.hasKey("runes")) {
val runes = extraAttr.getCompoundTag("runes")
val rune = runes.keySet.firstOrNull()
if (rune != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ object MayorInfo : EventSubscriber {

var currentMayor: String? = null
var mayorPerks = HashSet<String>()
var currentMinister: String? = null
var ministerPerk: String? = null
var allPerks = HashSet<String>()

var jerryMayor: Mayor? = null
var newJerryPerks = 0L
private var lastCheckedElectionOver = 0L
Expand Down Expand Up @@ -137,13 +141,23 @@ object MayorInfo : EventSubscriber {
}

fun fetchMayorData() = Skytils.IO.launch {
val res = json.decodeFromJsonElement<Mayor>(client.get("https://api.hypixel.net/resources/skyblock/election").body<JsonObject>()["mayor"]!!)
val res = client.get("https://api.hypixel.net/resources/skyblock/election").body<JsonObject>()
val mayorObj = res["mayor"] as JsonObject
val newMayor = json.decodeFromJsonElement<Mayor>(mayorObj)
val newMinister = mayorObj["minister"]?.let { json.decodeFromJsonElement<Minister>(it) }
tickTimer(1) {
currentMayor = res.name
currentMayor = newMayor.name
currentMinister = newMinister?.name
lastFetchedMayorData = System.currentTimeMillis()
if (currentMayor != "Jerry") jerryMayor = null
mayorPerks.clear()
mayorPerks.addAll(res.perks.map { it.name })
mayorPerks.addAll(newMayor.perks.map { it.name })
allPerks.clear()
allPerks.addAll(mayorPerks)
newMinister?.perk?.name?.let {
ministerPerk = it
allPerks.add(it)
}
}
}

Expand Down Expand Up @@ -183,6 +197,9 @@ class Mayor(val name: String, val perks: List<MayorPerk>)
@Serializable
class MayorPerk(val name: String, val description: String)

@Serializable
class Minister(val name: String, val perk: MayorPerk)

@Serializable
data class JerrySession(
val nextSwitch: Long,
Expand Down
Loading

0 comments on commit e5d5e44

Please sign in to comment.