Skip to content

Commit

Permalink
v1.0.6.1 - Waypoints and Dungeons update
Browse files Browse the repository at this point in the history
  • Loading branch information
Nat3z committed Apr 20, 2022
1 parent 5219c07 commit 380fd6a
Show file tree
Hide file tree
Showing 35 changed files with 1,022 additions and 54 deletions.
75 changes: 73 additions & 2 deletions src/main/java/mixin/natia/skytweaks/SkyTweaksConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ public class SkyTweaksConfig implements BlendingConfig {
)
public static boolean alertRareDrops = true;

@SerializeField(
name = "Lobby Day Notifier",
description = "Alerts the current day of the lobby you are in everytime you swap.",
category = "General",
subCategory = "Quality of Life",
type = SerializeType.TOGGLE,
UAYOR = false
)
public static boolean serverDayNotifier = true;

@SerializeField(
name = "Skyblock Timers",
description = "Shows Timers for Skyblock events. Required for some modules to work.",
Expand All @@ -73,6 +83,16 @@ public class SkyTweaksConfig implements BlendingConfig {
)
public static boolean allowTimers = false;

@SerializeField(
name = "Trade GUI Helper",
description = "A helper that shows bad trades and also possible scams.",
category = "General",
subCategory = "Quality of Life",
type = SerializeType.TOGGLE,
UAYOR = false
)
public static boolean tradeGui = false;

@SerializeField(
name = "Don't Render Players in Hub",
description = "Stops rendering players in Hub. The only exception is NPCS.",
Expand Down Expand Up @@ -208,6 +228,26 @@ public class SkyTweaksConfig implements BlendingConfig {
)
public static boolean copyFails = true;

@SerializeField(
name = "Point Bats",
description = "Adds a compass that points to bats.",
category = "Dungeons",
subCategory = "Dungeons",
type = SerializeType.TOGGLE,
UAYOR = false
)
public static boolean pointBats = false;

@SerializeField(
name = "Point Bats Color",
description = "Color of the compass that points to bats.",
category = "Dungeons",
subCategory = "Dungeons",
type = SerializeType.COLOR_WHEEL,
UAYOR = false
)
public static int pointBatsColor = new Color(50, 50, 50).getRGB();

/*@SerializeField(
name = "Highlight Inactive Terminals",
description = "Highlights all skipped/uncompleted terminals in F7. UAYOR because you can see blocks through walls. (NOT TESTED)",
Expand Down Expand Up @@ -274,6 +314,16 @@ public class SkyTweaksConfig implements BlendingConfig {
)
public static boolean rngMeter = false;

@SerializeField(
name = "Slayer Time Notification",
description = "Shows the slayer time after the completion of a quest.",
category = "Slayers",
subCategory = "General",
type = SerializeType.TOGGLE,
UAYOR = false
)
public static boolean slayerTimeNotify = false;

@SerializeField(
name = "Copy RNGesus",
description = "Copies every RNGesus drop that you have received.",
Expand Down Expand Up @@ -354,7 +404,17 @@ public class SkyTweaksConfig implements BlendingConfig {
type = SerializeType.COLOR_WHEEL,
UAYOR = false
)
public static int yangGlyphHighlightColor = new Color(0, 101, 164).getRed();
public static int yangGlyphHighlightColor = new Color(0, 101, 164).getRGB();

@SerializeField(
name = "Yang Glyph Compass Color",
description = "Highlight color of the YANG GLYPH compass.",
category = "Slayers",
subCategory = "Voidgloom Seraph",
type = SerializeType.COLOR_WHEEL,
UAYOR = false
)
public static int yangGlyphCompassColor = new Color(6, 222, 68).getRGB();

@SerializeField(
name = "Yang Glyph Notify Type",
Expand Down Expand Up @@ -458,7 +518,18 @@ public class SkyTweaksConfig implements BlendingConfig {
UAYOR = false,
hidden = true
)
public static HudElement bazaarLeaderboardHUD = new HudElement(20, 20, 190, 100, null);
public static HudElement bazaarLeaderboardHUD = new HudElement(20, 20, 190, 100, null);

@SerializeField(
name = "Trade Log HUD",
description = "Trade HUD",
category = "HUD",
type = SerializeType.HUD,
subCategory = "",
UAYOR = false,
hidden = true
)
public static HudElement tradeLogHUD = new HudElement(0, 0, 190, 100, new HudPreviews.VoidgloomAssist());

/* HUD stuff at end */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mixin.natia.skytweaks.mixins;

import natia.skytweaks.gui.GuiHook;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiContainer;
Expand Down Expand Up @@ -45,5 +46,10 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks, CallbackInfo
}
}*/
}

@Inject(method = "drawSlot", at = @At("RETURN"))
public void drawSlot_RETURN(Slot slotIn, CallbackInfo ci) {
if (inventorySlots instanceof ContainerChest) {
GuiHook.Companion.getTradeGui().drawSlots((ContainerChest) inventorySlots);
}
}
}
25 changes: 20 additions & 5 deletions src/main/kotlin/natia/skytweaks/SecretUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,14 @@ object SecretUtils {

public val allcachedBazaar: MutableList<JsonObject> = ArrayList<JsonObject>()
fun updateBazaarCache() {
WebUtils.fetch("https://api.hypixel.net/skyblock/bazaar") { res ->
if (res.asJson().get("success").getAsBoolean()) {
bazaarCached = res.asJson()
allcachedBazaar.add(bazaarCached)
Thread {
WebUtils.fetch("https://api.hypixel.net/skyblock/bazaar") { res ->
if (res.asJson().get("success").getAsBoolean()) {
bazaarCached = res.asJson()
allcachedBazaar.add(bazaarCached)
}
}
}
}.start()
}

fun averageBazaar(): MutableList<BazaarAverage> {
Expand Down Expand Up @@ -545,4 +547,17 @@ object SecretUtils {

}

val String.parsable: Boolean
get() {
try {
Integer.parseInt(this)
return true
} catch (ex: Exception) {
return false
}
}

fun BlockPos.toVec3(): Vec3 {
return Vec3(this.x.toDouble(), this.y.toDouble(), this.z.toDouble())
}
}
8 changes: 6 additions & 2 deletions src/main/kotlin/natia/skytweaks/SkyTweaks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import gg.blendingMC.BlendingMC
import gg.blendingMC.settings.BlendingMCSettings
import natia.skytweaks.commands.RepartyCommand
import natia.skytweaks.commands.SavePickupLog
import natia.skytweaks.commands.waypoints.WaypointsCommand
import natia.skytweaks.config.SkyTweaksBlend
import natia.skytweaks.config.SkyTweaksCommand
import natia.skytweaks.config.SkyTweaksHUDCommand
Expand All @@ -14,6 +15,7 @@ import natia.skytweaks.features.altC.QuickTab
import natia.skytweaks.hooks.*
import natia.skytweaks.features.griffin.GriffinBurrowWaypoints
import natia.skytweaks.gui.GuiHook
import natia.skytweaks.gui.trade.ItemLoreHook
import natia.skytweaks.networking.ColorText
import net.minecraft.client.Minecraft
import net.minecraftforge.client.ClientCommandHandler
Expand Down Expand Up @@ -56,6 +58,7 @@ class SkyTweaks {
MinecraftForge.EVENT_BUS.register(QuickTab())
MinecraftForge.EVENT_BUS.register(GriffinBurrowWaypoints.instance)
MinecraftForge.EVENT_BUS.register(BatDied.instance)
// MinecraftForge.EVENT_BUS.register(ItemLoreHook())

/* Cosmetics */
MinecraftForge.EVENT_BUS.register(ColorText())
Expand All @@ -68,6 +71,7 @@ class SkyTweaks {
ClientCommandHandler.instance.registerCommand(SkyTweaksHUDCommand())
ClientCommandHandler.instance.registerCommand(SkyTweaksCommand())
ClientCommandHandler.instance.registerCommand(RepartyCommand())
ClientCommandHandler.instance.registerCommand(WaypointsCommand())

configHandler!!.saveConfig()

Expand All @@ -77,8 +81,8 @@ class SkyTweaks {

companion object {
const val MODID: String = "skytweaks-mod"
const val VERSION = "v1.0.5.2.1"
const val IS_UNSTABLE = true
const val VERSION = "v1.0.6.1"
const val IS_UNSTABLE = false
@JvmField
val LOGGER: Logger = LogManager.getLogger("SkyTweaks Logger")!!

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package natia.skytweaks.commands.waypoints

import natia.skytweaks.features.waypoints.GlobalWaypoints
import natia.skytweaks.features.waypoints.Waypoint
import net.minecraft.client.gui.GuiButton
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.gui.GuiTextField
import net.minecraft.client.gui.ScaledResolution
import net.minecraft.util.BlockPos
import net.minecraft.util.Vec3
import org.lwjgl.input.Keyboard
import java.awt.Color

class WaypointCreateGui(val pos: BlockPos) : GuiScreen() {

var waypointName: GuiTextField? = null
override fun initGui() {
super.initGui()
waypointName = GuiTextField(0, fontRendererObj, width / 2 - 80, 50, 200, 15)
waypointName!!.isFocused = true;
}

override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) {
drawCenteredString(mc.fontRendererObj, "Waypoint Name", width / 2,
20, Color.GRAY.rgb)
waypointName!!.drawTextBox()
super.updateScreen()
super.drawScreen(mouseX, mouseY, partialTicks)
}

override fun mouseClicked(mouseX: Int, mouseY: Int, mouseButton: Int) {
waypointName!!.mouseClicked(mouseX, mouseY, mouseButton)
super.mouseClicked(mouseX, mouseY, mouseButton)
}

override fun keyTyped(typedChar: Char, keyCode: Int) {
waypointName!!.textboxKeyTyped(typedChar, keyCode)
super.keyTyped(typedChar, keyCode)
}

override fun onGuiClosed() {
super.onGuiClosed()
exit()
}

fun exit() {
GlobalWaypoints.instance.waypoints.add(Waypoint(pos, waypointName!!.text))
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package natia.skytweaks.commands.waypoints

import natia.skytweaks.features.waypoints.GlobalWaypoints
import natia.skytweaks.features.waypoints.Waypoint
import net.minecraft.client.Minecraft
import net.minecraft.client.audio.SoundHandler
import net.minecraft.client.gui.Gui
import net.minecraft.client.gui.GuiButton
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.util.ResourceLocation
import org.lwjgl.input.Mouse
import java.awt.Color

class WaypointSelect(val buttonID: Int, val x: Int, val y: Int, val waypoint: Waypoint) : GuiButton(buttonID, x, y, 160, 20, "") {

val mc = Minecraft.getMinecraft()

override fun drawButton(mc1: Minecraft?, mouseX: Int, mouseY: Int) {
super.drawButton(mc, mouseX, mouseY)
if (!this.visible) return

GlStateManager.enableAlpha()
Gui.drawRect(x, y, x + this.width, y + this.height, Color(103, 99, 101).rgb)
GlStateManager.disableAlpha()
GlStateManager.color(1f, 1f, 1f)

mc.fontRendererObj.drawString(waypoint.name, (x + 10).toFloat(), (y + 7).toFloat(), Color.WHITE.rgb, true)

drawShareButton(mouseX, mouseY)
drawRemoveButton(mouseX, mouseY)
}

fun drawShareButton(mouseX: Int, mouseY: Int) {
val shareButtonX = x + 120
val shareButtonY = y + 3
val shareButtonWidth = 15
val shareButtonHeight = 15

val isShareHovered =
mouseX >= shareButtonX && mouseY >= shareButtonY && mouseX < shareButtonX + shareButtonWidth && mouseY < shareButtonY + shareButtonHeight

mc.textureManager.bindTexture(ResourceLocation("secretmod", "gui/share.png"))
GlStateManager.enableAlpha()
Gui.drawModalRectWithCustomSizedTexture(shareButtonX, shareButtonY, 0f, 0f, shareButtonWidth, shareButtonHeight,
shareButtonWidth.toFloat(), shareButtonHeight.toFloat()
)
GlStateManager.disableAlpha()
/* Click Event */
if (!Mouse.getEventButtonState() || !isShareHovered) return
mc.thePlayer.closeScreen()
mc.thePlayer.sendChatMessage(waypoint.toShareable())
}

override fun playPressSound(soundHandlerIn: SoundHandler?) {

}

fun drawRemoveButton(mouseX: Int, mouseY: Int) {
val removeButtonX = x + 140
val removeButtonY = y + 3
val removeButtonWidth = 15
val removeButtonHeight = 15

val isShareHovered =
mouseX >= removeButtonX && mouseY >= removeButtonY && mouseX < removeButtonX + removeButtonWidth && mouseY < removeButtonY + removeButtonHeight

mc.textureManager.bindTexture(ResourceLocation("secretmod", "gui/trash.png"))
GlStateManager.enableAlpha()
Gui.drawModalRectWithCustomSizedTexture(removeButtonX, removeButtonY, 0f, 0f, removeButtonWidth, removeButtonHeight,
removeButtonWidth.toFloat(), removeButtonHeight.toFloat()
)
GlStateManager.disableAlpha()
/* Click Event */
if (!Mouse.getEventButtonState() || !isShareHovered) return
mc.thePlayer.closeScreen()
GlobalWaypoints.instance.waypoints.remove(waypoint)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package natia.skytweaks.commands.waypoints

import cc.blendingMC.vicious.BlendingConfigGui
import natia.skytweaks.SkyTweaks
import natia.skytweaks.hooks.TickHook
import net.minecraft.command.CommandBase
import net.minecraft.command.CommandException
import net.minecraft.command.ICommandSender

class WaypointsCommand : CommandBase() {
/**
* Gets the name of the command
*/
override fun getCommandName(): String {
return "waypoints"
}

override fun getCommandAliases(): MutableList<String> {
return arrayListOf("wp")
}

/**
* Gets the usage string for the command.
*
* @param sender
*/
override fun getCommandUsage(sender: ICommandSender): String {
return "/waypoints"
}

/**
* Callback when the command is invoked
*
* @param sender
* @param args
*/
@Throws(CommandException::class)
override fun processCommand(sender: ICommandSender, args: Array<String>) {
TickHook.scheduleGui(WaypointsGui())
}

override fun canCommandSenderUseCommand(sender: ICommandSender): Boolean {
return true
}
}
Loading

0 comments on commit 380fd6a

Please sign in to comment.