Skip to content

Commit

Permalink
Merge branch 'main' into feature/raredropfiltering
Browse files Browse the repository at this point in the history
Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com>
  • Loading branch information
j10a1n15 authored Jul 6, 2024
2 parents e06b0c2 + 5364686 commit 6d12b4a
Show file tree
Hide file tree
Showing 20 changed files with 343 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void createPartyManagementButtons(UIComponent topBarBlock, float scaleFac
.setHeight(new PixelConstraint(55f * scaleFactor))
.setChildOf(topBarBlock)
.setText("Disband")
.setTextScale(1.5f)
.setTextScale(new PixelConstraint(1.5f))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/party disband"));

new PSSButton()
Expand All @@ -121,7 +121,7 @@ public void createPartyManagementButtons(UIComponent topBarBlock, float scaleFac
.setHeight(new PixelConstraint(55f * scaleFactor))
.setChildOf(topBarBlock)
.setText("Kick Offline")
.setTextScale(1.25f)
.setTextScale(new PixelConstraint(1.25f))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/party kickoffline"));

new PSSButton()
Expand All @@ -131,7 +131,7 @@ public void createPartyManagementButtons(UIComponent topBarBlock, float scaleFac
.setHeight(new PixelConstraint(55f * scaleFactor))
.setChildOf(topBarBlock)
.setText("Reparty")
.setTextScale(1.5f)
.setTextScale(new PixelConstraint(1.5f))
.onMouseClickConsumer(event -> PartyManager.reparty(partyMembers));

new PSSButton()
Expand All @@ -141,7 +141,7 @@ public void createPartyManagementButtons(UIComponent topBarBlock, float scaleFac
.setHeight(new PixelConstraint(55f * scaleFactor))
.setChildOf(topBarBlock)
.setText("Ask if ready")
.setTextScale(1.25f)
.setTextScale(new PixelConstraint(1.25f))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/pc Ready?"));

String partyBreakdown = "Party Size: " + partyMembers.size() + "\n";
Expand Down Expand Up @@ -201,7 +201,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("F1")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon CATACOMBS_FLOOR_ONE"));

new PSSButton()
Expand All @@ -211,7 +211,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("F2")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon CATACOMBS_FLOOR_TWO"));

new PSSButton()
Expand All @@ -221,7 +221,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("F3")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon CATACOMBS_FLOOR_THREE"));

new PSSButton()
Expand All @@ -231,7 +231,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("F4")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon CATACOMBS_FLOOR_FOUR"));

new PSSButton()
Expand All @@ -241,7 +241,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("F5")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon CATACOMBS_FLOOR_FIVE"));

new PSSButton()
Expand All @@ -251,7 +251,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("F6")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon CATACOMBS_FLOOR_SIX"));

new PSSButton()
Expand All @@ -261,7 +261,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("F7")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon CATACOMBS_FLOOR_SEVEN"));


Expand All @@ -272,7 +272,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("M1")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon MASTER_CATACOMBS_FLOOR_ONE"));

new PSSButton()
Expand All @@ -282,7 +282,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("M2")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon MASTER_CATACOMBS_FLOOR_TWO"));

new PSSButton()
Expand All @@ -292,7 +292,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("M3")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon MASTER_CATACOMBS_FLOOR_THREE"));

new PSSButton()
Expand All @@ -302,7 +302,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("M4")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon MASTER_CATACOMBS_FLOOR_FOUR"));

new PSSButton()
Expand All @@ -312,7 +312,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("M5")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon MASTER_CATACOMBS_FLOOR_FIVE"));

new PSSButton()
Expand All @@ -322,7 +322,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("M6")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon MASTER_CATACOMBS_FLOOR_SIX"));

new PSSButton()
Expand All @@ -332,7 +332,7 @@ public void createJoinFloorButtons(UIComponent topBarBlock, float scaleFactor) {
.setHeight(new PixelConstraint(35f * scaleFactor))
.setChildOf(topBarBlock)
.setText("M7")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/joindungeon MASTER_CATACOMBS_FLOOR_SEVEN"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ private void createMemberBlockColumnFive(UIComponent memberBlock, float scaleFac
.setHeight(new PixelConstraint(55f * scaleFactor))
.setChildOf(memberBlock)
.setText("Kick")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/party kick " + this.username));

new PSSButton()
Expand All @@ -450,7 +450,7 @@ private void createMemberBlockColumnFive(UIComponent memberBlock, float scaleFac
.setHeight(new PixelConstraint(55f * scaleFactor))
.setChildOf(memberBlock)
.setText("Promote")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/party promote " + this.username));

new PSSButton()
Expand All @@ -460,7 +460,7 @@ private void createMemberBlockColumnFive(UIComponent memberBlock, float scaleFac
.setHeight(new PixelConstraint(55f * scaleFactor))
.setChildOf(memberBlock)
.setText("Transfer")
.setTextScale(scaleFactor)
.setTextScale(new PixelConstraint(scaleFactor))
.onMouseClickConsumer(event -> PartlySaneSkies.Companion.getMinecraft().thePlayer.sendChatMessage("/party transfer " + this.username));

UIComponent refreshButton = new UIRoundedRectangle(10f)
Expand All @@ -471,7 +471,7 @@ private void createMemberBlockColumnFive(UIComponent memberBlock, float scaleFac
.setColor(new Color(60, 222, 79))
.setChildOf(memberBlock);

ElementaUtils.INSTANCE.uiImageFromResourceLocation(new ResourceLocation("partlysaneskies", "textures/gui/party_finder/refresh.png"))
ElementaUtils.INSTANCE.getUiImage(new ResourceLocation("partlysaneskies", "textures/gui/party_finder/refresh.png"))
.setX(new CenterConstraint())
.setY(new CenterConstraint())
.setWidth(new PixelConstraint(20f * scaleFactor))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public void addBestMinionCalculator() {
.setHeight(fromWidthScaleFactor(60))
.setWidth(fromWidthScaleFactor(100))
.setText("Calculate Best Minion")
.setTextScale(fromWidthScaleFactor(1).getValue())
.setTextScale(fromWidthScaleFactor(1))

.setChildOf(bestMinionBar);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import com.google.gson.JsonObject
import com.google.gson.JsonParser
import me.partlysanestudios.partlysaneskies.config.Keybinds
import me.partlysanestudios.partlysaneskies.config.OneConfigScreen
import me.partlysanestudios.partlysaneskies.config.psconfig.Config
import me.partlysanestudios.partlysaneskies.config.psconfig.ConfigManager
import me.partlysanestudios.partlysaneskies.config.psconfig.Toggle
import me.partlysanestudios.partlysaneskies.config.psconfig.Toggle.Companion.asBoolean
import me.partlysanestudios.partlysaneskies.config.psconfig.Toggle.Companion.asToggle
import me.partlysanestudios.partlysaneskies.data.cache.PetData
import me.partlysanestudios.partlysaneskies.data.cache.StatsData
import me.partlysanestudios.partlysaneskies.data.cache.VisitorLogbookData
Expand Down Expand Up @@ -67,13 +71,13 @@ import me.partlysanestudios.partlysaneskies.features.farming.endoffarmnotifer.En
import me.partlysanestudios.partlysaneskies.features.farming.endoffarmnotifer.RangeHighlight
import me.partlysanestudios.partlysaneskies.features.farming.garden.*
import me.partlysanestudios.partlysaneskies.features.foraging.TreecapitatorCooldown
import me.partlysanestudios.partlysaneskies.features.gui.CustomMainMenu
import me.partlysanestudios.partlysaneskies.features.gui.RefreshKeybinds
import me.partlysanestudios.partlysaneskies.features.gui.hud.CooldownHud
import me.partlysanestudios.partlysaneskies.features.gui.hud.LocationBannerDisplay
import me.partlysanestudios.partlysaneskies.features.gui.hud.rngdropbanner.DropBannerDisplay
import me.partlysanestudios.partlysaneskies.features.gui.hud.rngdropbanner.DropWebhook
import me.partlysanestudios.partlysaneskies.features.gui.hud.rngdropbanner.RareDropGUIManager
import me.partlysanestudios.partlysaneskies.features.gui.mainmenu.PSSMainMenu
import me.partlysanestudios.partlysaneskies.features.information.WikiArticleOpener
import me.partlysanestudios.partlysaneskies.features.mining.MiningEvents
import me.partlysanestudios.partlysaneskies.features.mining.PickaxeWarning
Expand Down Expand Up @@ -129,6 +133,8 @@ class PartlySaneSkies {
const val CHAT_PREFIX = "§r§b§lPartly Sane Skies§r§7>> §r"
var discordCode = "v4PU3WeH7z"
val config: OneConfigScreen = OneConfigScreen
private var cachedFirstLaunch = false
val isFirstLaunch get() = cachedFirstLaunch

lateinit var minecraft: Minecraft
private set
Expand All @@ -153,6 +159,10 @@ class PartlySaneSkies {
}

var latestVersion = "(Unknown)"

val coreConfig = Config()
.registerOption("alreadyStarted", Toggle("Already Started", "Has this already been started with PSS enabled?", false))
.registerOption("promptedMainMenu", Toggle("Prompted main menu", defaultState = false))
}

// Method runs at mod initialization
Expand All @@ -169,7 +179,7 @@ class PartlySaneSkies {
PublicDataManager.getFile("main_menu.json")
}.start()
Thread {
CustomMainMenu.loadFunFact()
PSSMainMenu.loadFunFact()
}.start()

// Loads extra json data
Expand Down Expand Up @@ -257,7 +267,7 @@ class PartlySaneSkies {
registerEvent(BitsShopValue)
registerEvent(SkymartValue)
registerEvent(VisitorTradeValue)
registerEvent(CustomMainMenu.Companion)
registerEvent(PSSMainMenu)
registerEvent(WrongToolCropWarning.CropToolData)
registerEvent(PetAlert)
registerEvent(SkillUpgradeWebhook)
Expand Down Expand Up @@ -296,6 +306,7 @@ class PartlySaneSkies {
RareDropGUIManager.registerCommand()
WebhookMenu.registerWebhookCommand()

registerCoreConfig()
ExampleWebhook.register()
DropWebhook.register()
SkillUpgradeWebhook.register()
Expand All @@ -304,6 +315,8 @@ class PartlySaneSkies {
BestiaryLevelUpWebhook.register()
PetLevelUpWebhook.register()



ConfigManager.loadAllConfigs()


Expand Down Expand Up @@ -340,6 +353,9 @@ class PartlySaneSkies {
if (config.privacyMode == 2) {
PrivacyMode.enablePrivacyMode()
}

checkFirstLaunch()

// Finished loading
log(Level.INFO, "Partly Sane Skies has loaded (Version: ${VERSION}).")
}
Expand Down Expand Up @@ -414,6 +430,19 @@ class PartlySaneSkies {
}
}

private fun checkFirstLaunch() {
if (coreConfig.find("alreadyStarted")?.asBoolean != true) {
cachedFirstLaunch = true
coreConfig.find("alreadyStarted")?.asToggle?.state = true
log("Partly Sane Skies starting for the first time")
}
}


private fun registerCoreConfig() {
ConfigManager.registerNewConfig("psscore.json", coreConfig)
}

@SubscribeEvent
fun onClientConnectedToServer(event: ClientConnectedToServerEvent?) {
if (DOGFOOD) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,24 @@ class Config : ConfigOption() {

private val options = LinkedHashMap<String, ConfigOption>()
// Recursively create new options to get to the path
fun registerOption(path: String, configOption: ConfigOption) {
fun registerOption(path: String, configOption: ConfigOption): Config {
val indexOfSplit = path.indexOf("/")

if (indexOfSplit == -1) {
options[path] = configOption
configOption.parent = this
return

return this
}

val firstKey = path.substring(0, indexOfSplit)

val newConfig = Config()
options[firstKey] = newConfig

newConfig.registerOption(path.substring(indexOfSplit), configOption)

return this
}

fun getAllOptions(): LinkedHashMap<String, ConfigOption> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ import gg.essential.elementa.constraints.CenterConstraint
import gg.essential.elementa.dsl.*
import gg.essential.universal.UMatrixStack
import me.partlysanestudios.partlysaneskies.PartlySaneSkies.Companion.config
import me.partlysanestudios.partlysaneskies.PartlySaneSkies.Companion.minecraft
import me.partlysanestudios.partlysaneskies.commands.PSSCommand
import me.partlysanestudios.partlysaneskies.config.psconfig.Config
import me.partlysanestudios.partlysaneskies.config.psconfig.Toggle
import me.partlysanestudios.partlysaneskies.config.psconfig.Toggle.Companion.asToggle
import me.partlysanestudios.partlysaneskies.features.themes.ThemeManager
import me.partlysanestudios.partlysaneskies.render.gui.components.PSSToggle
import me.partlysanestudios.partlysaneskies.render.gui.constraints.ScaledPixelConstraint.Companion.scaledPixels
import me.partlysanestudios.partlysaneskies.utils.ElementaUtils.uiImageFromResourceLocation
import me.partlysanestudios.partlysaneskies.utils.ElementaUtils.uiImage
import me.partlysanestudios.partlysaneskies.utils.MinecraftUtils
import net.minecraft.util.ResourceLocation
import java.awt.Color
Expand Down Expand Up @@ -105,7 +104,7 @@ class WebhookMenu: WindowScreen(ElementaVersion.V5) {
} childOf window

private val sideSwitchIcon = ResourceLocation("partlysaneskies", "textures/gui/webhookedit/sideswitch.png")
.uiImageFromResourceLocation()
.uiImage
.constrain {
x = CenterConstraint()
y = CenterConstraint()
Expand Down
Loading

0 comments on commit 6d12b4a

Please sign in to comment.