aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-01-26 12:35:17 +0100
committernea <nea@nea.moe>2023-01-26 12:35:17 +0100
commite29354f810f69a509fba8e6c2ac58d1ce65c5483 (patch)
tree887c7eb64f54e98c41543c0f0613151f7715ed09
parentf89a90e08d2b6cff70d84bb4c35bbdc8a0b49bc0 (diff)
parentf1a5ba28e92da4f46b39da27277b1c8b7a6ec4bb (diff)
downloadNotEnoughUpdates-e29354f810f69a509fba8e6c2ac58d1ce65c5483.tar.gz
NotEnoughUpdates-e29354f810f69a509fba8e6c2ac58d1ce65c5483.tar.bz2
NotEnoughUpdates-e29354f810f69a509fba8e6c2ac58d1ce65c5483.zip
Merge remote-tracking branch 'origin/master' into disabledoptionsdisabledoptions
-rw-r--r--.idea/copyright/NotEnoughUpdates.xml2
-rw-r--r--annotations/build.gradle.kts44
-rw-r--r--annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSubscribe.kt24
-rw-r--r--annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSymbolProcessor.kt165
-rw-r--r--annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSymbolProcessorProvider.kt30
-rw-r--r--annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUEventSubscriber.kt34
-rw-r--r--annotations/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider20
-rw-r--r--build.gradle.kts70
-rw-r--r--buildSrc/src/main/kotlin/neubs/buildflags.kt23
-rw-r--r--gradle.properties3
-rw-r--r--oneconfigquarantine/build.gradle.kts9
-rw-r--r--settings.gradle.kts1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java92
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/events/ReplaceItemEvent.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/OldAnimationChecker.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/loader/KotlinLoadingTweaker.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneContactHelper.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java185
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java21
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NullzeeSphere.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java33
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/CustomBiomes.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/DwarvenMinesTextures.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/item/enchants/EnchantStyleCustomizer.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/EnderNodeHighlighter.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/FrozenTreasuresHighlighter.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/GlowingMushroomHighlighter.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiUtils.java71
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java24
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerDeadmau5Head.java38
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java23
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java121
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java45
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java205
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java629
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/TitleUtil.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java2
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt2
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt7
-rw-r--r--src/main/resources/mixins.notenoughupdates.json2
-rw-r--r--src/test/kotlin/io/github/moulberry/notenoughupdates/util/PetLevelingTest.kt18
86 files changed, 1449 insertions, 697 deletions
diff --git a/.idea/copyright/NotEnoughUpdates.xml b/.idea/copyright/NotEnoughUpdates.xml
index c1c6368d..d3ac04b2 100644
--- a/.idea/copyright/NotEnoughUpdates.xml
+++ b/.idea/copyright/NotEnoughUpdates.xml
@@ -1,7 +1,7 @@
<component name="CopyrightManager">
<copyright>
<option name="allowReplaceRegexp" value="Copyright" />
- <option name="notice" value="Copyright (C) 2023 NotEnoughUpdates contributors&#10;&#10;This file is part of NotEnoughUpdates.&#10;&#10;NotEnoughUpdates is free software: you can redistribute it&#10;and/or modify it under the terms of the GNU Lesser General Public&#10;License as published by the Free Software Foundation, either&#10;version 3 of the License, or (at your option) any later version.&#10;&#10;NotEnoughUpdates is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&#10;Lesser General Public License for more details.&#10;&#10;You should have received a copy of the GNU Lesser General Public License&#10;along with NotEnoughUpdates. If not, see &lt;https://www.gnu.org/licenses/&gt;." />
+ <option name="notice" value="Copyright (C) &amp;#36;originalComment.match(&quot;Copyright \(C\) (\d+)&quot;,1,&quot;-&quot;)&amp;#36;today.year NotEnoughUpdates contributors&#10;&#10;This file is part of NotEnoughUpdates.&#10;&#10;NotEnoughUpdates is free software: you can redistribute it&#10;and/or modify it under the terms of the GNU Lesser General Public&#10;License as published by the Free Software Foundation, either&#10;version 3 of the License, or (at your option) any later version.&#10;&#10;NotEnoughUpdates is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&#10;Lesser General Public License for more details.&#10;&#10;You should have received a copy of the GNU Lesser General Public License&#10;along with NotEnoughUpdates. If not, see &lt;https://www.gnu.org/licenses/&gt;." />
<option name="myName" value="NotEnoughUpdates" />
</copyright>
</component>
diff --git a/annotations/build.gradle.kts b/annotations/build.gradle.kts
new file mode 100644
index 00000000..c9e13173
--- /dev/null
+++ b/annotations/build.gradle.kts
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+plugins {
+ kotlin("jvm")
+ java
+}
+
+repositories {
+ mavenCentral()
+}
+
+tasks.withType<JavaCompile> {
+ if (JavaVersion.current().isJava9Compatible) {
+ options.release.set(8)
+ }
+}
+
+dependencies {
+ implementation(kotlin("stdlib-jdk8"))
+ implementation("com.google.devtools.ksp:symbol-processing-api:1.8.0-1.0.8")
+ implementation("com.squareup:kotlinpoet:1.12.0")
+ implementation("com.squareup:kotlinpoet-ksp:1.12.0")
+}
+
+
+
+
diff --git a/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSubscribe.kt b/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSubscribe.kt
new file mode 100644
index 00000000..1ba6be99
--- /dev/null
+++ b/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSubscribe.kt
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.autosubscribe
+
+@Retention(AnnotationRetention.SOURCE)
+@Target(AnnotationTarget.CLASS)
+annotation class NEUAutoSubscribe
diff --git a/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSymbolProcessor.kt b/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSymbolProcessor.kt
new file mode 100644
index 00000000..157749d0
--- /dev/null
+++ b/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSymbolProcessor.kt
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2023 Linnea Gräf
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.autosubscribe
+
+import com.google.devtools.ksp.getDeclaredFunctions
+import com.google.devtools.ksp.getDeclaredProperties
+import com.google.devtools.ksp.processing.CodeGenerator
+import com.google.devtools.ksp.processing.KSPLogger
+import com.google.devtools.ksp.processing.Resolver
+import com.google.devtools.ksp.processing.SymbolProcessor
+import com.google.devtools.ksp.symbol.ClassKind
+import com.google.devtools.ksp.symbol.KSAnnotated
+import com.google.devtools.ksp.symbol.KSClassDeclaration
+import com.google.devtools.ksp.symbol.Modifier
+import com.google.devtools.ksp.validate
+import com.squareup.kotlinpoet.FileSpec
+import com.squareup.kotlinpoet.FunSpec
+import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
+import com.squareup.kotlinpoet.TypeSpec
+import com.squareup.kotlinpoet.asTypeName
+import com.squareup.kotlinpoet.ksp.toClassName
+import com.squareup.kotlinpoet.ksp.writeTo
+import java.util.function.Consumer
+import java.util.function.Supplier
+
+internal class NEUAutoSymbolProcessor(val codeGenerator: CodeGenerator, val logger: KSPLogger) : SymbolProcessor {
+ fun collectSubscribers(elements: List<KSAnnotated>): List<NEUEventSubscriber> = buildList {
+ for (element in elements) {
+ if (element !is KSClassDeclaration) {
+ logger.error("@NEUAutoSubscribe is only valid on class or object declarations", element)
+ continue
+ }
+ if (element.typeParameters.isNotEmpty()) {
+ logger.error("@NEUAutoSubscribe is not valid on generic classes", element)
+ continue
+ }
+ val name = element.qualifiedName
+ if (name == null) {
+ logger.error("@NEUAutoSubscribe could not find name", element)
+ continue
+ }
+ when (element.classKind) {
+ ClassKind.CLASS -> {
+ val instanceGetter = element.getDeclaredFunctions().find {
+ it.simpleName.asString() == "getInstance"
+ }
+ val instanceVariable = element.getDeclaredProperties().find {
+ it.simpleName.asString() == "INSTANCE"
+ }
+ if (instanceGetter != null) {
+ val returnType = instanceGetter.returnType
+ if (returnType == null || !element.asStarProjectedType().isAssignableFrom(returnType.resolve())) {
+ logger.error(
+ "getInstance() does not have the expected return type ${element.asStarProjectedType()}",
+ instanceGetter
+ )
+ continue
+ }
+ add(NEUEventSubscriber(InvocationKind.GET_INSTANCE, element))
+ } else if (instanceVariable != null) {
+ val variableType = instanceVariable.type
+ if (!element.asStarProjectedType().isAssignableFrom(variableType.resolve())) {
+ logger.error(
+ "INSTANCE does not have expected type ${element.asStarProjectedType()}",
+ instanceVariable
+ )
+ continue
+ }
+ add(NEUEventSubscriber(InvocationKind.ACCESS_INSTANCE, element))
+ } else {
+ add(NEUEventSubscriber(InvocationKind.DEFAULT_CONSTRUCTOR, element))
+ }
+ }
+
+ ClassKind.OBJECT -> {
+ add(NEUEventSubscriber(InvocationKind.OBJECT_INSTANCE, element))
+ }
+
+ else -> {
+ logger.error(
+ "@NEUAutoSubscribe is only valid on classes and objects, not on ${element.classKind}",
+ element
+ )
+ continue
+ }
+ }
+ }
+
+ }
+
+ val subscribers = mutableListOf<NEUEventSubscriber>()
+ override fun process(resolver: Resolver): List<KSAnnotated> {
+ val candidates = resolver.getSymbolsWithAnnotation(NEUAutoSubscribe::class.qualifiedName!!).toList()
+ val valid = candidates.filter { it.validate() }
+ val invalid = candidates.filter { !it.validate() }
+
+ subscribers.addAll(collectSubscribers(valid))
+ return invalid
+ }
+
+ override fun finish() {
+ if (subscribers.isEmpty()) return
+ val deps = subscribers.mapNotNull { it.declaration.containingFile }
+ logger.info("Dependencies: $deps")
+ FileSpec.builder("io.github.moulberry.notenoughupdates.autosubscribe", "AutoLoad")
+ .addFileComment("@generated by ${NEUAutoSymbolProcessor::class.simpleName}")
+ .addType(
+ TypeSpec.objectBuilder("AutoLoad")
+ .addFunction(
+ FunSpec.builder("provide")
+ .addParameter(
+ "consumer",
+ Consumer::class.asTypeName()
+ .parameterizedBy(Supplier::class.parameterizedBy(Any::class))
+ )
+ .apply {
+ subscribers.sortedBy { it.declaration.simpleName.asString() }.forEach { (invocationKind, declaration) ->
+ when (invocationKind) {
+ InvocationKind.GET_INSTANCE -> addStatement(
+ "consumer.accept { %T.getInstance() }",
+ declaration.toClassName()
+ )
+
+ InvocationKind.OBJECT_INSTANCE -> addStatement(
+ "consumer.accept { %T }",
+ declaration.toClassName()
+ )
+
+ InvocationKind.DEFAULT_CONSTRUCTOR -> addStatement(
+ "consumer.accept { %T() }",
+ declaration.toClassName()
+ )
+
+ InvocationKind.ACCESS_INSTANCE -> addStatement(
+ "consumer.accept { %T.INSTANCE }",
+ declaration.toClassName()
+ )
+ }
+ }
+ }
+ .build()
+ )
+ .build()
+ )
+ .build()
+ .writeTo(codeGenerator, aggregating = true, originatingKSFiles = deps)
+ }
+}
diff --git a/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSymbolProcessorProvider.kt b/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSymbolProcessorProvider.kt
new file mode 100644
index 00000000..ef0edd88
--- /dev/null
+++ b/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUAutoSymbolProcessorProvider.kt
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.autosubscribe
+
+import com.google.devtools.ksp.processing.SymbolProcessor
+import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
+import com.google.devtools.ksp.processing.SymbolProcessorProvider
+
+class NEUAutoSymbolProcessorProvider : SymbolProcessorProvider {
+ override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor {
+ return NEUAutoSymbolProcessor(environment.codeGenerator, environment.logger)
+ }
+}
diff --git a/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUEventSubscriber.kt b/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUEventSubscriber.kt
new file mode 100644
index 00000000..d17b6004
--- /dev/null
+++ b/annotations/src/main/kotlin/io/github/moulberry/notenoughupdates/autosubscribe/NEUEventSubscriber.kt
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2023 Linnea Gräf
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.autosubscribe
+
+import com.google.devtools.ksp.symbol.KSClassDeclaration
+
+internal data class NEUEventSubscriber(
+ val invocationKind: InvocationKind,
+ val declaration: KSClassDeclaration,
+)
+
+internal enum class InvocationKind {
+ GET_INSTANCE,
+ OBJECT_INSTANCE,
+ DEFAULT_CONSTRUCTOR,
+ ACCESS_INSTANCE,
+}
diff --git a/annotations/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider b/annotations/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider
new file mode 100644
index 00000000..eaad70ce
--- /dev/null
+++ b/annotations/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2023 NotEnoughUpdates contributors
+#
+# This file is part of NotEnoughUpdates.
+#
+# NotEnoughUpdates is free software: you can redistribute it
+# and/or modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation, either
+# version 3 of the License, or (at your option) any later version.
+#
+# NotEnoughUpdates is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+#
+
+io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSymbolProcessorProvider
diff --git a/build.gradle.kts b/build.gradle.kts
index e9e769a8..e41aa513 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -30,8 +30,8 @@ plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
id("io.github.juuxel.loom-quiltflower") version "1.7.3"
`maven-publish`
- id("io.freefair.lombok") version "6.5.1"
- kotlin("jvm") version "1.7.20"
+ kotlin("jvm") version "1.8.0"
+ id("com.google.devtools.ksp") version "1.8.0-1.0.8"
}
@@ -62,6 +62,7 @@ loom {
pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter())
mixinConfig("mixins.notenoughupdates.json")
}
+ @Suppress("UnstableApiUsage")
mixin {
defaultRefmapName.set("mixins.notenoughupdates.refmap.json")
}
@@ -78,44 +79,43 @@ repositories {
maven("https://repo.polyfrost.cc/releases")
}
-lombok {
- version.set("1.18.24")
-}
-
-
-val shadowImplementation by configurations.creating {
+val shadowImplementation: Configuration by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}
-val shadowOnly by configurations.creating {
+val shadowOnly: Configuration by configurations.creating {
}
-val shadowApi by configurations.creating {
+val shadowApi: Configuration by configurations.creating {
configurations.api.get().extendsFrom(this)
}
-val devEnv by configurations.creating {
+val devEnv: Configuration by configurations.creating {
configurations.runtimeClasspath.get().extendsFrom(this)
isCanBeResolved = false
isCanBeConsumed = false
isVisible = false
}
-val kotlinDependencies by configurations.creating {
+val kotlinDependencies: Configuration by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}
-val oneconfigQuarantineSourceSet = sourceSets.create("oneconfig") {
+val oneconfigQuarantineSourceSet: SourceSet = sourceSets.create("oneconfig") {
java {
srcDir(layout.projectDirectory.dir("src/main/oneconfig"))
}
- kotlin {
+}
+
+configurations {
+ val main = getByName(sourceSets.main.get().compileClasspathConfigurationName)
+ "oneconfigImplementation" {
+ extendsFrom(main)
}
}
dependencies {
- implementation("org.projectlombok:lombok:1.18.22")
minecraft("com.mojang:minecraft:1.8.9")
mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9")
forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9")
@@ -126,21 +126,27 @@ dependencies {
runtimeOnly("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-alpha+") // Should be included in jar
}
- "oneconfigImplementation"(sourceSets.main.get().output)
- "oneconfigImplementation"(sourceSets.main.get().compileClasspath)
"oneconfigCompileOnly"(project(":oneconfigquarantine", configuration = "namedElements"))
+ "oneconfigImplementation"(sourceSets.main.get().output)
"runtimeOnly"(oneconfigQuarantineSourceSet.output)
// Please keep this version in sync with KotlinLoadingTweaker
- implementation(enforcedPlatform("org.jetbrains.kotlin:kotlin-bom:1.7.21"))
+ implementation(enforcedPlatform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
kotlinDependencies(kotlin("stdlib"))
+ compileOnly(ksp(project(":annotations"))!!)
+ compileOnly("org.projectlombok:lombok:1.18.24")
+ annotationProcessor("org.projectlombok:lombok:1.18.24")
+ "oneconfigAnnotationProcessor"("org.projectlombok:lombok:1.18.24")
+
shadowImplementation("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
isTransitive = false // Dependencies of mixin are already bundled by minecraft
}
annotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT")
+
+ @Suppress("VulnerableLibrariesLocal")
shadowApi("info.bliki.wiki:bliki-core:3.1.0")
- testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
+ testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
testAnnotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT")
// modImplementation("io.github.notenoughupdates:MoulConfig:0.0.1")
@@ -151,15 +157,24 @@ dependencies {
java {
withSourcesJar()
- toolchain.languageVersion.set(JavaLanguageVersion.of(8))
+// toolchain.languageVersion.set(JavaLanguageVersion.of(8))
}
// Tasks:
tasks.withType(JavaCompile::class) {
options.encoding = "UTF-8"
+ options.isFork = true
+ if (JavaVersion.current().isJava9Compatible)
+ options.release.set(8)
+}
+tasks.named("compileOneconfigJava", JavaCompile::class) {
+ doFirst {
+ println("oneconfig args: ${this@named.options.compilerArgs}")
+ }
}
+
tasks.named<Test>("test") {
useJUnitPlatform()
}
@@ -189,12 +204,16 @@ val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") {
}
}
+tasks.remapSourcesJar {
+ this.enabled = false
+}
+
/* Bypassing https://github.com/johnrengelman/shadow/issues/111 */
// Use Zip instead of Jar as to not include META-INF
val kotlinDependencyCollectionJar by tasks.creating(Zip::class) {
archiveFileName.set("kotlin-libraries-wrapped.jar")
destinationDirectory.set(project.layout.buildDirectory.dir("kotlinwrapper"))
- from(kotlinDependencies.files)
+ from(kotlinDependencies)
into("neu-kotlin-libraries-wrapped")
}
@@ -227,6 +246,15 @@ tasks.processResources {
}
}
+idea {
+ module {
+ // Not using += due to https://github.com/gradle/gradle/issues/8749
+ sourceDirs = sourceDirs + file("build/generated/ksp/main/kotlin") // or tasks["kspKotlin"].destination
+ testSourceDirs = testSourceDirs + file("build/generated/ksp/test/kotlin")
+ generatedSourceDirs = generatedSourceDirs + file("build/generated/ksp/main/kotlin") + file("build/generated/ksp/test/kotlin")
+ }
+}
+
sourceSets.main {
output.setResourcesDir(file("$buildDir/classes/java/main"))
}
diff --git a/buildSrc/src/main/kotlin/neubs/buildflags.kt b/buildSrc/src/main/kotlin/neubs/buildflags.kt
index 6b7ab489..27c4bbcf 100644
--- a/buildSrc/src/main/kotlin/neubs/buildflags.kt
+++ b/buildSrc/src/main/kotlin/neubs/buildflags.kt
@@ -19,8 +19,13 @@
package neubs
+import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
+import org.gradle.api.file.RegularFileProperty
+import org.gradle.api.provider.MapProperty
+import org.gradle.api.tasks.*
+import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.the
import java.nio.charset.StandardCharsets
import java.util.*
@@ -28,22 +33,16 @@ import java.util.*
const val NEU_BUILDFLAGS_PREFIX = "neu.buildflags."
class NEUBuildFlags : Plugin<Project> {
+
override fun apply(target: Project) {
val props =
target.properties.filterKeys { it.startsWith(NEU_BUILDFLAGS_PREFIX) }.mapValues { it.value as String }
target.extensions.add("buildflags", Extension(props))
- target.tasks.create("generateBuildFlags") {
- outputs.upToDateWhen { false }
- val t = target.layout.buildDirectory.file("buildflags.properties")
- outputs.file(t)
- doLast {
- val p = Properties()
- p.putAll(props)
- t.get().asFile.writer(StandardCharsets.UTF_8).use {
- p.store(it, "Store build time configuration for NEU")
- }
- }
-
+ target.tasks.create<WriteProperties>("generateBuildFlags") {
+ this.encoding = StandardCharsets.UTF_8.name()
+ this.setProperties(props)
+ this.comment = "Store build time configuration for NEU"
+ this.setOutputFile(target.layout.buildDirectory.file("buildflags.properties"))
}
}
diff --git a/gradle.properties b/gradle.properties
index 0009739e..0eb2e107 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,7 @@
org.gradle.jvmargs=-Xmx2G
+org.gradle.parallel=true
+org.gradle.caching=true
+kotlin.incremental.useClasspathSnapshot=true
loom.platform=forge
# NEU Buildflags. Please keep these flags in a commented out form while checked into version control.
# See BuildFlags.java for usages of these values.
diff --git a/oneconfigquarantine/build.gradle.kts b/oneconfigquarantine/build.gradle.kts
index 32bc3b7c..15797e1e 100644
--- a/oneconfigquarantine/build.gradle.kts
+++ b/oneconfigquarantine/build.gradle.kts
@@ -1,3 +1,5 @@
+import net.fabricmc.loom.task.RemapJarTask
+
/*
* Copyright (C) 2022 NotEnoughUpdates contributors
*
@@ -43,3 +45,10 @@ dependencies {
modApi("cc.polyfrost:oneconfig-1.8.9-forge:0.1.0-alpha+") // Don't you just love 0.1.0-alpha+
}
+tasks.withType<JavaCompile> {
+ this.enabled = false
+}
+tasks.withType<RemapJarTask> {
+ println(this)
+ this.enabled = false
+}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index a910edd3..86073a5b 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -40,4 +40,5 @@ pluginManagement {
}
include("oneconfigquarantine")
+include("annotations")
rootProject.name = "NotEnoughUpdates"
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
index 754e2dc3..8096c2d5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
@@ -208,7 +208,7 @@ public class ItemPriceInformation {
}
return added;
- } else if (auctionItem) {
+ } else if (auctionItem && !auctionInfoErrored) {
List<Integer> lines = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.priceInfoAuc;
boolean added = false;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index ce15b09a..5c3083a3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -748,7 +748,7 @@ public class NEUManager {
}
}
- public String getUUIDFromNBT(NBTTagCompound tag) {
+ public static String getUUIDFromNBT(NBTTagCompound tag) {
String uuid = null;
if (tag != null && tag.hasKey("ExtraAttributes", 10)) {
NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");
@@ -965,7 +965,7 @@ public class NEUManager {
.resolveInternalName();
}
- public String getUUIDForItem(ItemStack stack) {
+ public static String getUUIDForItem(ItemStack stack) {
if (stack == null) return null;
NBTTagCompound tag = stack.getTagCompound();
return getUUIDFromNBT(tag);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 7159ef89..cb0f3fc0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -1046,7 +1046,7 @@ public class NEUOverlay extends Gui {
}
}
- if (Keyboard.getEventKeyState()) {
+ if (!Keyboard.getEventKeyState()) {
if (!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) {
searchBarHasFocus = false;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 8d2a5307..a4643eb5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -23,75 +23,35 @@ import com.google.common.collect.Sets;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.autosubscribe.AutoLoad;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.commands.Commands;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
-import io.github.moulberry.notenoughupdates.cosmetics.CapeManager;
import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
-import io.github.moulberry.notenoughupdates.dungeons.DungeonMap;
import io.github.moulberry.notenoughupdates.listener.ChatListener;
import io.github.moulberry.notenoughupdates.listener.ItemTooltipEssenceShopListener;
import io.github.moulberry.notenoughupdates.listener.ItemTooltipListener;
import io.github.moulberry.notenoughupdates.listener.ItemTooltipRngListener;
import io.github.moulberry.notenoughupdates.listener.NEUEventListener;
-import io.github.moulberry.notenoughupdates.listener.OldAnimationChecker;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
import io.github.moulberry.notenoughupdates.listener.WorldListener;
-import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneContactHelper;
-import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneFavourites;
-import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneWarning;
-import io.github.moulberry.notenoughupdates.miscfeatures.AntiCoopAdd;
-import io.github.moulberry.notenoughupdates.miscfeatures.AuctionBINWarning;
-import io.github.moulberry.notenoughupdates.miscfeatures.AuctionProfit;
-import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
-import io.github.moulberry.notenoughupdates.miscfeatures.CrystalOverlay;
-import io.github.moulberry.notenoughupdates.miscfeatures.CrystalWishingCompassSolver;
-import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
import io.github.moulberry.notenoughupdates.miscfeatures.CustomSkulls;
-import io.github.moulberry.notenoughupdates.miscfeatures.DungeonNpcProfitOverlay;
-import io.github.moulberry.notenoughupdates.miscfeatures.DwarvenMinesWaypoints;
-import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
-import io.github.moulberry.notenoughupdates.miscfeatures.EnforcedConfigValues;
import io.github.moulberry.notenoughupdates.miscfeatures.FairySouls;
-import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper;
-import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns;
import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
-import io.github.moulberry.notenoughupdates.miscfeatures.MiningStuff;
import io.github.moulberry.notenoughupdates.miscfeatures.NPCRetexturing;
import io.github.moulberry.notenoughupdates.miscfeatures.Navigation;
-import io.github.moulberry.notenoughupdates.miscfeatures.NullzeeSphere;
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
-import io.github.moulberry.notenoughupdates.miscfeatures.PowerStoneStatsDisplay;
import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
-import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu;
-import io.github.moulberry.notenoughupdates.miscfeatures.WardrobeMouseButtons;
-import io.github.moulberry.notenoughupdates.miscfeatures.WitherCloakChanger;
-import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes;
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBlockSounds;
-import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.DwarvenMinesTextures;
-import io.github.moulberry.notenoughupdates.miscfeatures.item.enchants.EnchantStyleCustomizer;
import io.github.moulberry.notenoughupdates.miscfeatures.updater.AutoUpdater;
-import io.github.moulberry.notenoughupdates.miscfeatures.world.EnderNodeHighlighter;
-import io.github.moulberry.notenoughupdates.miscfeatures.world.FrozenTreasuresHighlighter;
-import io.github.moulberry.notenoughupdates.miscfeatures.world.GlowingMushroomHighlighter;
-import io.github.moulberry.notenoughupdates.miscgui.CalendarOverlay;
-import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector;
-import io.github.moulberry.notenoughupdates.miscgui.SignCalculator;
-import io.github.moulberry.notenoughupdates.miscgui.TrophyRewardOverlay;
-import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager;
import io.github.moulberry.notenoughupdates.mixins.AccessorMinecraft;
import io.github.moulberry.notenoughupdates.oneconfig.IOneConfigCompat;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
-import io.github.moulberry.notenoughupdates.overlays.EquipmentOverlay;
-import io.github.moulberry.notenoughupdates.overlays.FuelBar;
import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.recipes.RecipeGenerator;
-import io.github.moulberry.notenoughupdates.util.Constants;
-import io.github.moulberry.notenoughupdates.util.SBInfo;
-import io.github.moulberry.notenoughupdates.util.TitleUtil;
import io.github.moulberry.notenoughupdates.util.Utils;
-import io.github.moulberry.notenoughupdates.util.XPInformation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
@@ -131,6 +91,7 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Set;
+@NEUAutoSubscribe
@Mod(
modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION, clientSideOnly = true, useMetadata = true,
guiFactory = "io.github.moulberry.notenoughupdates.core.config.MoulConfigGuiForgeInterop")
@@ -298,63 +259,18 @@ public class NotEnoughUpdates {
IOneConfigCompat.getInstance().ifPresent(it -> it.initConfig(config, this::saveConfig));
- MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new NEUEventListener(this));
MinecraftForge.EVENT_BUS.register(new RecipeGenerator(this));
- MinecraftForge.EVENT_BUS.register(CapeManager.getInstance());
- //MinecraftForge.EVENT_BUS.register(new SBGamemodes());
- MinecraftForge.EVENT_BUS.register(new EnchantingSolvers());
- MinecraftForge.EVENT_BUS.register(new CalendarOverlay());
- MinecraftForge.EVENT_BUS.register(SBInfo.getInstance());
- MinecraftForge.EVENT_BUS.register(CustomItemEffects.INSTANCE);
- MinecraftForge.EVENT_BUS.register(new Constants());
- MinecraftForge.EVENT_BUS.register(new DungeonMap());
- MinecraftForge.EVENT_BUS.register(new SunTzu());
- MinecraftForge.EVENT_BUS.register(new WitherCloakChanger());
- MinecraftForge.EVENT_BUS.register(new MiningStuff());
- MinecraftForge.EVENT_BUS.register(FairySouls.getInstance());
- MinecraftForge.EVENT_BUS.register(new CrystalOverlay());
- MinecraftForge.EVENT_BUS.register(new ItemCooldowns());
- MinecraftForge.EVENT_BUS.register(new DwarvenMinesWaypoints());
- MinecraftForge.EVENT_BUS.register(new FuelBar());
- MinecraftForge.EVENT_BUS.register(new AuctionProfit());
- MinecraftForge.EVENT_BUS.register(new DungeonNpcProfitOverlay());
- MinecraftForge.EVENT_BUS.register(XPInformation.getInstance());
MinecraftForge.EVENT_BUS.register(OverlayManager.petInfoOverlay);
MinecraftForge.EVENT_BUS.register(OverlayManager.timersOverlay);
- MinecraftForge.EVENT_BUS.register(new NullzeeSphere());
- MinecraftForge.EVENT_BUS.register(InventoryStorageSelector.getInstance());
- MinecraftForge.EVENT_BUS.register(SlotLocking.getInstance());
- MinecraftForge.EVENT_BUS.register(FishingHelper.getInstance());
- MinecraftForge.EVENT_BUS.register(CrystalWishingCompassSolver.getInstance());
- MinecraftForge.EVENT_BUS.register(new DwarvenMinesTextures());
- MinecraftForge.EVENT_BUS.register(EquipmentOverlay.INSTANCE);
- MinecraftForge.EVENT_BUS.register(CustomBiomes.INSTANCE);
MinecraftForge.EVENT_BUS.register(new ChatListener(this));
MinecraftForge.EVENT_BUS.register(new ItemTooltipListener(this));
MinecraftForge.EVENT_BUS.register(new ItemTooltipRngListener(this));
MinecraftForge.EVENT_BUS.register(new ItemTooltipEssenceShopListener(this));
MinecraftForge.EVENT_BUS.register(new RenderListener(this));
- MinecraftForge.EVENT_BUS.register(new OldAnimationChecker());
- MinecraftForge.EVENT_BUS.register(new SignCalculator());
- MinecraftForge.EVENT_BUS.register(TrophyRewardOverlay.getInstance());
- MinecraftForge.EVENT_BUS.register(PowerStoneStatsDisplay.getInstance());
- MinecraftForge.EVENT_BUS.register(AntiCoopAdd.getInstance());
- MinecraftForge.EVENT_BUS.register(AbiphoneWarning.getInstance());
- MinecraftForge.EVENT_BUS.register(new BetterContainers());
- MinecraftForge.EVENT_BUS.register(AuctionBINWarning.getInstance());
- MinecraftForge.EVENT_BUS.register(MinionHelperManager.getInstance());
MinecraftForge.EVENT_BUS.register(navigation);
- MinecraftForge.EVENT_BUS.register(new GlowingMushroomHighlighter());
MinecraftForge.EVENT_BUS.register(new WorldListener(this));
- MinecraftForge.EVENT_BUS.register(EnchantStyleCustomizer.INSTANCE);
- MinecraftForge.EVENT_BUS.register(TitleUtil.getInstance());
- MinecraftForge.EVENT_BUS.register(EnderNodeHighlighter.getInstance());
- MinecraftForge.EVENT_BUS.register(FrozenTreasuresHighlighter.getInstance());
- MinecraftForge.EVENT_BUS.register(AbiphoneFavourites.getInstance());
- MinecraftForge.EVENT_BUS.register(AbiphoneContactHelper.getInstance());
- MinecraftForge.EVENT_BUS.register(new WardrobeMouseButtons());
- MinecraftForge.EVENT_BUS.register(EnforcedConfigValues.INSTANCE);
+ AutoLoad.INSTANCE.provide(supplier -> MinecraftForge.EVENT_BUS.register(supplier.get()));
if (Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) {
IReloadableResourceManager manager = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
index e606fc49..6ae5dd80 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
@@ -731,7 +731,7 @@ public class APIManager {
public void updateBazaar() {
manager.apiUtils
- .newHypixelApiRequest("skyblock/bazaar")
+ .newAnonymousHypixelApiRequest("skyblock/bazaar")
.requestJson()
.thenAccept(jsonObject -> {
if (!jsonObject.get("success").getAsBoolean()) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
index 7a609a2a..4a7c1939 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
@@ -24,6 +24,7 @@ import com.google.common.collect.HashBiMap;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.shader.Framebuffer;
@@ -44,6 +45,7 @@ import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+@NEUAutoSubscribe
public class CapeManager {
public static final CapeManager INSTANCE = new CapeManager();
public long lastCapeUpdate = 0;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
index e15168f5..686cef8e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
@@ -22,6 +22,7 @@ package io.github.moulberry.notenoughupdates.dungeons;
import com.google.common.collect.Iterables;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.util.NEUResourceManager;
@@ -73,6 +74,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
+@NEUAutoSubscribe
public class DungeonMap {
private static final ResourceLocation GREEN_CHECK = new ResourceLocation(
"notenoughupdates:dungeon_map/green_check.png");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/events/ReplaceItemEvent.java b/src/main/java/io/github/moulberry/notenoughupdates/events/ReplaceItemEvent.java
index 2cdcf083..335d8fe0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/events/ReplaceItemEvent.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/events/ReplaceItemEvent.java
@@ -19,17 +19,17 @@
package io.github.moulberry.notenoughupdates.events;
-import net.minecraft.inventory.InventoryBasic;
+import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class ReplaceItemEvent extends NEUEvent {
final ItemStack original;
- final InventoryBasic inventory;
+ final IInventory inventory;
final int slotNumber;
ItemStack replaceWith;
- public ReplaceItemEvent(ItemStack original, InventoryBasic inventory, int slotNumber) {
+ public ReplaceItemEvent(ItemStack original, IInventory inventory, int slotNumber) {
this.original = original;
this.inventory = inventory;
this.slotNumber = slotNumber;
@@ -40,7 +40,7 @@ public class ReplaceItemEvent extends NEUEvent {
return original;
}
- public InventoryBasic getInventory() {
+ public IInventory getInventory() {
return inventory;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
index 31930b01..8563189c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
@@ -61,7 +61,7 @@ public class ChatListener {
private static final Pattern SLAYER_EXP_PATTERN = Pattern.compile(
" (Spider|Zombie|Wolf|Enderman|Blaze) Slayer LVL (\\d) - (?:Next LVL in ([\\d,]+) XP!|LVL MAXED OUT!)");
private static final Pattern SKY_BLOCK_LEVEL_PATTERN = Pattern.compile("\\[(\\d{1,4})\\] .*");
- private final Pattern PARTY_FINDER_PATTERN = Pattern.compile("§dParty Finder §r§f> (.*)§ejoined the dungeon group!");
+ private final Pattern PARTY_FINDER_PATTERN = Pattern.compile("§dParty Finder §r§f> (.*)§ejoined the (dungeon )?group!");
private AtomicBoolean missingRecipe = new AtomicBoolean(false);
@@ -316,10 +316,7 @@ public class ChatListener {
}
}
- if (unformatted.equals("You uncovered a treasure chest!") ||
- unformatted.equals("You have successfully picked the lock on this chest!")
- || (unformatted.startsWith("You received +") && unformatted.endsWith(" Powder")))
- OverlayManager.powderGrindingOverlay.message(unformatted);
+ OverlayManager.powderGrindingOverlay.onMessage(unformatted);
if (unformatted.startsWith("ENDER NODE!"))
EnderNodeHighlighter.getInstance().highlightedBlocks.clear();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/OldAnimationChecker.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/OldAnimationChecker.java
index 7858918b..8d62c0aa 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/OldAnimationChecker.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/OldAnimationChecker.java
@@ -21,12 +21,14 @@ package io.github.moulberry.notenoughupdates.listener;
import com.google.common.collect.Lists;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.util.NotificationHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+@NEUAutoSubscribe
public class OldAnimationChecker {
private void unregister() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/loader/KotlinLoadingTweaker.java b/src/main/java/io/github/moulberry/notenoughupdates/loader/KotlinLoadingTweaker.java
index 0c63b17d..bf4e746f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/loader/KotlinLoadingTweaker.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/loader/KotlinLoadingTweaker.java
@@ -82,7 +82,7 @@ public class KotlinLoadingTweaker implements ITweaker {
* Full version format: [1, 7, 20] (1.7.20)
* RC version format: [1, 7, 20, 1] (1.7.20-rc1)
*/
- public static final int[] BUNDLED_KOTLIN_VERSION = new int[]{1, 7, 20};
+ public static final int[] BUNDLED_KOTLIN_VERSION = new int[]{1, 8, 0};
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneContactHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneContactHelper.java
index d2a5fc84..3178d241 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneContactHelper.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneContactHelper.java
@@ -24,6 +24,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.util.Constants;
@@ -36,6 +37,7 @@ import org.lwjgl.input.Keyboard;
import java.util.List;
import java.util.Map;
+@NEUAutoSubscribe
public class AbiphoneContactHelper {
private static final AbiphoneContactHelper INSTANCE = new AbiphoneContactHelper();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java
index ce96b29a..3366fd1e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.config.KeybindHelper;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
@@ -44,6 +45,7 @@ import java.awt.*;
import java.util.ArrayList;
import java.util.List;
+@NEUAutoSubscribe
public class AbiphoneFavourites {
private static final AbiphoneFavourites INSTANCE = new AbiphoneFavourites();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
index 67ac4f4c..2c28bcd1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.GuiElement;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
@@ -41,6 +42,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
+@NEUAutoSubscribe
public class AbiphoneWarning extends GuiElement {
private static final AbiphoneWarning INSTANCE = new AbiphoneWarning();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java
index aaa13d39..40425560 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -32,6 +33,7 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+@NEUAutoSubscribe
public class AntiCoopAdd {
private static final AntiCoopAdd INSTANCE = new AntiCoopAdd();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
index 75813700..8f6671d2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
@@ -21,6 +21,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.GuiElement;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
@@ -43,6 +44,7 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@NEUAutoSubscribe
public class AuctionBINWarning extends GuiElement {
private static final AuctionBINWarning INSTANCE = new AuctionBINWarning();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
index 82c392e4..c0e40ec9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -39,6 +40,7 @@ import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.GL11;
+@NEUAutoSubscribe
public class AuctionProfit {
public static final ResourceLocation auctionProfitImage =
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
index dc7b0e15..e7331378 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
@@ -21,6 +21,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
@@ -47,6 +48,7 @@ import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
+@NEUAutoSubscribe
public class BetterContainers {
private static final ResourceLocation TOGGLE_OFF = new ResourceLocation("notenoughupdates:dynamic_54/toggle_off.png");
private static final ResourceLocation TOGGLE_ON = new ResourceLocation("notenoughupdates:dynamic_54/toggle_on.png");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
index c0653742..047f3c99 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.util.ReverseWorldRenderer;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import net.minecraft.client.Minecraft;
@@ -48,6 +49,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+@NEUAutoSubscribe
public class CrystalOverlay {
private enum CrystalType {
FARMING_MINION(8, 0xDAA520),
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java
index 50975af9..c6e714fe 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.Line;
import io.github.moulberry.notenoughupdates.core.util.Vec3Comparable;
import io.github.moulberry.notenoughupdates.events.SpawnParticleEvent;
@@ -52,6 +53,7 @@ import java.util.Locale;
import java.util.function.BooleanSupplier;
import java.util.function.LongSupplier;
+@NEUAutoSubscribe
public class CrystalWishingCompassSolver {
enum SolverState {
NOT_STARTED,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
index 452f8a9b..e959c761 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -76,6 +77,7 @@ import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@NEUAutoSubscribe
public class CustomItemEffects {
public static final CustomItemEffects INSTANCE = new CustomItemEffects();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
index 34a40c2f..711d5235 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
+ * Copyright (C) 2022-2023 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
@@ -22,6 +22,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
@@ -52,6 +53,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@NEUAutoSubscribe
public class DungeonNpcProfitOverlay {
private static final ResourceLocation dungeonProfitResource =
@@ -334,7 +336,7 @@ public class DungeonNpcProfitOverlay {
}
}
}
- } else if (essenceMatcher.matches()) {
+ } else if (essenceMatcher.matches() && NotEnoughUpdates.INSTANCE.config.dungeons.useEssenceCostFromBazaar) {
String essenceType = essenceMatcher.group("essenceType");
String essenceAmount = essenceMatcher.group("essenceAmount");
if (essenceType == null || essenceAmount == null) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java
index 6b2c9ac9..e2eb13b2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.overlays.MiningOverlay;
@@ -46,6 +47,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@NEUAutoSubscribe
public class DwarvenMinesWaypoints {
private final HashMap<String, Vector3f> waypointsMap = new HashMap<String, Vector3f>() {{
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
index d5cbfdde..695c9851 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -45,6 +46,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
+@NEUAutoSubscribe
public class EnchantingSolvers {
public static SolverType currentSolver = SolverType.NONE;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
index 9e3343a4..5a611178 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
@@ -25,6 +25,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
@@ -64,6 +65,7 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
+@NEUAutoSubscribe
public class FairySouls {
private static FairySouls instance = null;
private static final String unknownProfile = "unknown";
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
index e3afc73d..800e25b1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.ChromaColour;
import io.github.moulberry.notenoughupdates.events.SpawnParticleEvent;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
@@ -53,6 +54,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+@NEUAutoSubscribe
public class FishingHelper {
private static final FishingHelper INSTANCE = new FishingHelper();
@@ -148,7 +150,7 @@ public class FishingHelper {
int ticksExisted = hook.ticksExisted;
float seconds = ticksExisted / 20F;
int color;
- if (seconds >= 30) {
+ if (seconds >= 20) {
color = ChromaColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.fishing.fishingTimerColor30SecPlus);
if (NotEnoughUpdates.INSTANCE.config.fishing.fishingSound30Sec && !playedSound) {
ISound sound = new PositionedSound(new ResourceLocation("random.orb")) {{
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
index ee5eef9e..5651a6ed 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
@@ -36,10 +37,26 @@ import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@NEUAutoSubscribe
public class ItemCooldowns {
+
+ private static final Pattern COOLDOWN_LORE = Pattern.compile("\\u00a78Cooldown: \\u00a7a(\\d+)s");
+
+ private static final Pattern PICKAXE_ABILITY_ACTIVATION =
+ Pattern.compile("\\u00a7r\\u00a7aYou used your \\u00a7r\\u00a7..+ \\u00a7r\\u00a7aPickaxe Ability!\\u00a7r");
+
+ private static final Pattern BONZO_ABILITY_ACTIVATION =
+ Pattern.compile("\\u00a7r\\u00a7aYour \\u00a7r\\u00a7[9|5](\\u269A )*Bonzo's Mask \\u00a7r\\u00a7asaved your life!\\u00a7r");
+
+ private static final Pattern SPIRIT_ABILITY_ACTIVATION =
+ Pattern.compile("\\u00a7r\\u00a76Second Wind Activated\\u00a7r\\u00a7a! \\u00a7r\\u00a7aYour Spirit Mask saved your life!\\u00a7r");
+
private static final Map<ItemStack, Float> durabilityOverrideMap = new HashMap<>();
+
public static long pickaxeUseCooldownMillisRemaining = -1;
private static long treecapitatorCooldownMillisRemaining = -1;
+ private static long bonzomaskCooldownMillisRemaining = -1;
+ private static long spiritMaskCooldownMillisRemaining = -1;
public static boolean firstLoad = true;
public static long firstLoadMillis = 0;
@@ -47,17 +64,27 @@ public class ItemCooldowns {
private static long lastMillis = 0;
public static long pickaxeCooldown = -1;
+ private static long bonzoMaskCooldown = -1;
+ private static long spiritMaskCooldown = -1;
public static TreeMap<Long, BlockPos> blocksClicked = new TreeMap<>();
private static int tickCounter = 0;
+ enum Item {
+ PICKAXES,
+ BONZO_MASK,
+ SPIRIT_MASK
+ }
+
@SubscribeEvent
public void tick(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.END && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
if (tickCounter++ >= 20 * 10) {
tickCounter = 0;
pickaxeCooldown = -1;
+ bonzoMaskCooldown = -1;
+ spiritMaskCooldown = -1;
}
long currentTime = System.currentTimeMillis();
@@ -66,7 +93,6 @@ public class ItemCooldowns {
firstLoad = false;
}
-
Long key;
while ((key = blocksClicked.floorKey(currentTime - 1500)) != null) {
blocksClicked.remove(key);
@@ -83,6 +109,12 @@ public class ItemCooldowns {
if (treecapitatorCooldownMillisRemaining >= 0) {
treecapitatorCooldownMillisRemaining -= millisDelta;
}
+ if (bonzomaskCooldownMillisRemaining >= 0) {
+ bonzomaskCooldownMillisRemaining -= millisDelta;
+ }
+ if (spiritMaskCooldownMillisRemaining >= 0) {
+ spiritMaskCooldownMillisRemaining -= millisDelta;
+ }
}
}
@@ -121,14 +153,14 @@ public class ItemCooldowns {
if (blocksClicked.containsValue(pos)) {
IBlockState oldState = Minecraft.getMinecraft().theWorld.getBlockState(pos);
if (oldState.getBlock() != packetIn.getBlockState().getBlock()) {
- onBlockMined(pos);
+ onBlockMined();
}
}
}
- public static void onBlockMined(BlockPos pos) {
+ public static void onBlockMined() {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
+ String internalname = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withItemStack(held).resolveInternalName();
if (internalname != null) {
if (treecapitatorCooldownMillisRemaining < 0 &&
(internalname.equals("TREECAPITATOR_AXE") || internalname.equals("JUNGLE_AXE"))) {
@@ -137,11 +169,6 @@ public class ItemCooldowns {
}
}
- private static final Pattern PICKAXE_ABILITY_REGEX = Pattern.compile("\\u00a7r\\u00a7aYou used your " +
- "\\u00a7r\\u00a7..+ \\u00a7r\\u00a7aPickaxe Ability!\\u00a7r");
-
- private static final Pattern PICKAXE_COOLDOWN_LORE_REGEX = Pattern.compile("\\u00a78Cooldown: \\u00a7a(\\d+)s");
-
private static boolean isPickaxe(String internalname) {
if (internalname == null) return false;
@@ -153,36 +180,69 @@ public class ItemCooldowns {
} else return internalname.equals("GEMSTONE_GAUNTLET") || internalname.equals("PICKONIMBUS") || internalname.equals("DIVAN_DRILL");
}
- private static void updatePickaxeCooldown() {
- if (pickaxeCooldown == -1 && NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) {
- for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
- if (stack != null && stack.hasTagCompound()) {
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
- if (isPickaxe(internalname)) {
- for (String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound())) {
- Matcher matcher = PICKAXE_COOLDOWN_LORE_REGEX.matcher(line);
- if (matcher.find()) {
- try {
- pickaxeCooldown = Integer.parseInt(matcher.group(1));
- return;
- } catch (Exception ignored) {
- }
- }
- }
- }
+ @SubscribeEvent
+ public void onChatMessage(ClientChatReceivedEvent event) {
+ if (PICKAXE_ABILITY_ACTIVATION.matcher(event.message.getFormattedText()).matches() &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility && pickaxeCooldown != 0) {
+ findCooldownInTooltip(Item.PICKAXES);
+ pickaxeUseCooldownMillisRemaining = pickaxeCooldown * 1000;
+ }
+
+ if (BONZO_ABILITY_ACTIVATION.matcher(event.message.getFormattedText()).matches() &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.bonzoAbility && bonzoMaskCooldown != 0) {
+ findCooldownInTooltip(Item.BONZO_MASK);
+ bonzomaskCooldownMillisRemaining = bonzoMaskCooldown * 1000;
+ }
+
+ if (SPIRIT_ABILITY_ACTIVATION.matcher(event.message.getFormattedText()).matches() &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.spiritAbility && spiritMaskCooldown != 0) {
+ findCooldownInTooltip(Item.SPIRIT_MASK);
+ spiritMaskCooldownMillisRemaining = spiritMaskCooldown * 1000;
+ }
+ }
+
+ private static void findCooldownInTooltip(Item item) {
+ for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
+ setSpecificCooldown(stack, item);
+ }
+
+ // Check helmet slot for items that can also be equipped as a helmet
+ ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.armorInventory[3];
+ setSpecificCooldown(stack, item);
+ }
+
+ private static void setSpecificCooldown(ItemStack stack, Item item) {
+ if (stack != null && stack.hasTagCompound()) {
+
+ String internalname = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withItemStack(stack).resolveInternalName();
+
+ if (internalname != null) {
+ switch (item) {
+ case PICKAXES:
+ if (isPickaxe(internalname)) pickaxeCooldown = setCooldown(stack);
+ break;
+ case BONZO_MASK:
+ if (internalname.equals("BONZO_MASK") || internalname.equals("STARRED_BONZO_MASK")) bonzoMaskCooldown = setCooldown(stack);
+ break;
+ case SPIRIT_MASK:
+ if (internalname.equals("SPIRIT_MASK")) spiritMaskCooldown = setCooldown(stack);
+ break;
}
}
- pickaxeCooldown = 0;
}
}
- @SubscribeEvent
- public void onChatMessage(ClientChatReceivedEvent event) {
- if (pickaxeCooldown != 0 && PICKAXE_ABILITY_REGEX.matcher(event.message.getFormattedText()).matches() &&
- NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) {
- updatePickaxeCooldown();
- pickaxeUseCooldownMillisRemaining = pickaxeCooldown * 1000;
+ private static int setCooldown(ItemStack stack) {
+ for (String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound())) {
+ Matcher matcher = COOLDOWN_LORE.matcher(line);
+ if (matcher.find()) {
+ try {
+ return Integer.parseInt(matcher.group(1));
+ } catch (Exception ignored) {
+ }
+ }
}
+ return -1;
}
public static float getDurabilityOverride(ItemStack stack) {
@@ -193,27 +253,20 @@ public class ItemCooldowns {
return durabilityOverrideMap.get(stack);
}
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
+ String internalname = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withItemStack(stack).resolveInternalName();
if (internalname == null) {
durabilityOverrideMap.put(stack, -1f);
return -1;
}
- if (isPickaxe(internalname)) {
- updatePickaxeCooldown();
-
- if (pickaxeUseCooldownMillisRemaining < 0) {
- durabilityOverrideMap.put(stack, -1f);
- return -1;
- }
+ // Pickaxes
+ if (isPickaxe(internalname) && NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) {
+ findCooldownInTooltip(Item.PICKAXES);
- if (pickaxeUseCooldownMillisRemaining > pickaxeCooldown * 1000) {
- return stack.getItemDamage();
- }
- float dura = (float) (pickaxeUseCooldownMillisRemaining / (pickaxeCooldown * 1000.0));
- durabilityOverrideMap.put(stack, dura);
- return dura;
- } else if (internalname.equals("TREECAPITATOR_AXE") || internalname.equals("JUNGLE_AXE")) {
+ return durabilityOverride(pickaxeUseCooldownMillisRemaining, pickaxeCooldown, stack);
+ }
+ // Treecapitator / Jungle Axe
+ if (internalname.equals("TREECAPITATOR_AXE") || internalname.equals("JUNGLE_AXE")) {
if (treecapitatorCooldownMillisRemaining < 0) {
durabilityOverrideMap.put(stack, -1f);
return -1;
@@ -222,12 +275,42 @@ public class ItemCooldowns {
if (treecapitatorCooldownMillisRemaining > getTreecapCooldownWithPet()) {
return stack.getItemDamage();
}
- float dura = (treecapitatorCooldownMillisRemaining / (float) getTreecapCooldownWithPet());
- durabilityOverrideMap.put(stack, dura);
- return dura;
+
+ float durability = treecapitatorCooldownMillisRemaining / (float) getTreecapCooldownWithPet();
+ durabilityOverrideMap.put(stack, durability);
+
+ return durability;
+ }
+ // Bonzo Mask
+ if ((internalname.equals("BONZO_MASK") || internalname.equals("STARRED_BONZO_MASK")) && NotEnoughUpdates.INSTANCE.config.itemOverlays.bonzoAbility) {
+ findCooldownInTooltip(Item.BONZO_MASK);
+
+ return durabilityOverride(bonzomaskCooldownMillisRemaining, bonzoMaskCooldown, stack);
+ }
+ // Spirit Mask
+ if (internalname.equals("SPIRIT_MASK") && NotEnoughUpdates.INSTANCE.config.itemOverlays.spiritAbility) {
+ findCooldownInTooltip(Item.SPIRIT_MASK);
+
+ return durabilityOverride(spiritMaskCooldownMillisRemaining, spiritMaskCooldown, stack);
}
durabilityOverrideMap.put(stack, -1f);
return -1;
}
+
+ private static float durabilityOverride(float millisRemaining, long cooldown, ItemStack stack) {
+ if (millisRemaining < 0) {
+ durabilityOverrideMap.put(stack, -1f);
+ return -1;
+ }
+
+ if (millisRemaining > cooldown * 1000) {
+ return stack.getItemDamage();
+ }
+
+ float durability = (float) (millisRemaining / (cooldown * 1000.0));
+ durabilityOverrideMap.put(stack, durability);
+
+ return durability;
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java
index 15fc8ef8..dad801ec 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java
@@ -21,6 +21,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.ChromaColour;
import net.minecraft.client.Minecraft;
@@ -67,8 +68,6 @@ public class ItemCustomizeManager {
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
private static ItemDataMap itemDataMap = new ItemDataMap();
- private static final HashMap<Integer, String> itemUuidCache = new HashMap<>();
-
public static class ItemDataMap {
public HashMap<String, ItemData> itemData = new HashMap<>();
}
@@ -269,25 +268,10 @@ public class ItemCustomizeManager {
return CUSTOM_GLINT_TEXTURE;
}
- public static String getUuidForItem(ItemStack stack) {
- if (!stack.hasTagCompound()) return null;
-
- int nbtHash = stack.getTagCompound().hashCode();
-
- if (itemUuidCache.containsKey(nbtHash)) {
- return itemUuidCache.get(nbtHash);
- }
-
- String uuid = NotEnoughUpdates.INSTANCE.manager.getUUIDForItem(stack);
-
- itemUuidCache.put(nbtHash, uuid);
- return uuid;
- }
-
public static ItemData getDataForItem(ItemStack stack) {
if (stack == null) return null;
- String uuid = getUuidForItem(stack);
+ String uuid = NEUManager.getUUIDForItem(stack);
if (uuid == null) {
return null;
@@ -297,7 +281,6 @@ public class ItemCustomizeManager {
}
public static void tick() {
- itemUuidCache.clear();
disableTextureBinding = false;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java
index 12e0301b..2cbd3125 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
import io.github.moulberry.notenoughupdates.overlays.MiningOverlay;
import io.github.moulberry.notenoughupdates.util.SBInfo;
@@ -44,6 +45,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.Map;
+@NEUAutoSubscribe
public class MiningStuff {
private static BlockPos overlayLoc = null;
private static long titaniumNotifMillis = 0;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NullzeeSphere.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NullzeeSphere.java
index 6302343e..08d48962 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NullzeeSphere.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NullzeeSphere.java
@@ -19,6 +19,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.util.ReverseWorldRenderer;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import net.minecraft.client.Minecraft;
@@ -41,6 +42,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+@NEUAutoSubscribe
public class NullzeeSphere {
public static boolean enabled = false;
public static float size = 20;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
index 37cb14b5..e350c489 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
@@ -470,6 +470,11 @@ public class PetInfoOverlay extends TextOverlay {
xp = xp * getBoostMultiplier(pet.petItem);
}
}
+ JsonObject pets = Constants.PETS;
+ if (pets != null && pets.has("custom_pet_leveling") && pets.get("custom_pet_leveling").getAsJsonObject().has(pet.petType.toUpperCase()) &&
+ pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().has("xp_multiplier")) {
+ xp *= pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().get("xp_multiplier").getAsFloat();
+ }
return xp;
}
@@ -721,16 +726,18 @@ public class PetInfoOverlay extends TextOverlay {
JsonObject petItem2 = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(
currentPet2.skin != null ? currentPet2.skin : (currentPet2.petType + ";" + currentPet2.rarity.petId));
if (petItem2 != null) {
- Vector2f position = getPosition(overlayWidth, overlayHeight, false);
+ Vector2f position = getPosition(overlayWidth, overlayHeight, true);
int x = (int) position.x;
- int y = (int) position.y + NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText.size() * 10 + 10;
+ int y = (int) position.y + NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText.size() * 10;
ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem2);
GlStateManager.enableDepth();
GlStateManager.pushMatrix();
+ Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale);
GlStateManager.translate(x - 2, y - 2, 0);
GlStateManager.scale(2, 2, 1);
Utils.drawItemStack(stack, 0, 0);
+ Utils.pushGuiScale(0);
GlStateManager.popMatrix();
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java
index 975bbe6e..31dd71eb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PowerStoneStatsDisplay.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
@@ -39,6 +40,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
+@NEUAutoSubscribe
public class PowerStoneStatsDisplay {
private static PowerStoneStatsDisplay instance = null;
private final NumberFormat format = NumberFormat.getInstance(Locale.US);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
index 8a487739..b447cf61 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
@@ -22,10 +22,13 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.config.KeybindHelper;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent;
import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
+import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
@@ -39,7 +42,10 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
@@ -59,6 +65,7 @@ import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
+@NEUAutoSubscribe
public class SlotLocking {
private static final SlotLocking INSTANCE = new SlotLocking();
@@ -416,6 +423,9 @@ public class SlotLocking {
}
drawLinkArrow(x1, y1, x2, y2);
+ setTopHalfBarrier = true;
+ } else {
+ setTopHalfBarrier = false;
}
}
@@ -729,4 +739,27 @@ public class SlotLocking {
return locked != null &&
(locked.locked || (NotEnoughUpdates.INSTANCE.config.slotLocking.bindingAlsoLocks && locked.boundTo != -1));
}
+
+ boolean setTopHalfBarrier = false;
+ @SubscribeEvent
+ public void barrierInventory(ReplaceItemEvent event) {
+ if (event.getSlotNumber() < 9 ||
+ (pairingSlot != null && (event.getSlotNumber() == pairingSlot.slotNumber || isArmourSlot(event.getSlotNumber(), pairingSlot.slotNumber))) ||
+ !setTopHalfBarrier ||
+ !(event.getInventory() instanceof InventoryPlayer)) return;
+ ItemStack stack = new ItemStack(Blocks.barrier);
+ ItemUtils.getOrCreateTag(stack).setBoolean(
+ "NEUHIDETOOLIP",
+ true
+ );
+ event.replaceWith(stack);
+ }
+
+ boolean isArmourSlot(int eventSlotNumber, int pairingSlotNumber) {
+ if (eventSlotNumber == 39 && pairingSlotNumber == 5) return true;
+ if (eventSlotNumber == 38 && pairingSlotNumber == 6) return true;
+ if (eventSlotNumber == 37 && pairingSlotNumber == 7) return true;
+ if (eventSlotNumber == 36 && pairingSlotNumber == 8) return true;
+ return false;
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
index 7fc8beba..736d5058 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
@@ -19,6 +19,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
@@ -30,6 +31,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.Random;
+@NEUAutoSubscribe
public class SunTzu {
private static boolean enabled = false;
private static int quoteNum = 0;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt
index 4e99f5a7..f38d3752 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
+ * Copyright (C) 2022-2023 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
@@ -19,12 +19,14 @@
package io.github.moulberry.notenoughupdates.miscfeatures
import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
import io.github.moulberry.notenoughupdates.core.config.KeybindHelper
import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraftforge.client.event.GuiScreenEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+@NEUAutoSubscribe
class WardrobeMouseButtons {
private val keybinds: List<Int> get() = listOf(
@@ -41,8 +43,17 @@ class WardrobeMouseButtons {
private var lastClick = -1L
@SubscribeEvent
- fun onGui(event: GuiScreenEvent) {
- if (!NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.enableWardrobeKeybinds) return
+ fun onGuiKeyboardInput(event: GuiScreenEvent.KeyboardInputEvent.Pre) {
+ checkKeybinds(event)
+ }
+
+ @SubscribeEvent
+ fun onGuiMouseInput(event: GuiScreenEvent.MouseInputEvent.Pre) {
+ checkKeybinds(event)
+ }
+
+ private fun checkKeybinds(event: GuiScreenEvent) {
+ if (!NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.enableWardrobeKeybinds || !NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return
val gui = event.gui as? GuiChest ?: return
if (!Utils.getOpenChestName().contains("Wardrobe")) return
@@ -51,9 +62,11 @@ class WardrobeMouseButtons {
if (System.currentTimeMillis() - lastClick > 300) {
Utils.sendLeftMouseClick(gui.inventorySlots.windowId, 36 + i)
lastClick = System.currentTimeMillis()
+ event.isCanceled = true
}
break
}
}
}
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java
index 02d7bf7b..704606bf 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@@ -33,6 +34,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
+@NEUAutoSubscribe
public class WitherCloakChanger {
public static boolean isCloakActive = false;
/**
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/CustomBiomes.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/CustomBiomes.java
index 48a01187..dd97a1f0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/CustomBiomes.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/CustomBiomes.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures.customblockzones;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.OnBlockBreakSoundEffect;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.block.BlockColored;
@@ -37,6 +38,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.HashMap;
import java.util.Map;
+
+@NEUAutoSubscribe
public class CustomBiomes {
public static final CustomBiomes INSTANCE = new CustomBiomes();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/DwarvenMinesTextures.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/DwarvenMinesTextures.java
index 1c6acc1d..df437fee 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/DwarvenMinesTextures.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/customblockzones/DwarvenMinesTextures.java
@@ -24,6 +24,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
@@ -46,6 +47,7 @@ import java.util.Set;
import static io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes.isMithril;
import static io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes.isTitanium;
+@NEUAutoSubscribe
public class DwarvenMinesTextures implements IslandZoneSubdivider {
private static class IgnoreColumn {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/item/enchants/EnchantStyleCustomizer.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/item/enchants/EnchantStyleCustomizer.java
index 47acfa60..82db0b30 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/item/enchants/EnchantStyleCustomizer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/item/enchants/EnchantStyleCustomizer.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures.item.enchants;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.util.LRUCache;
import io.github.moulberry.notenoughupdates.util.LateBindingChroma;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -33,6 +34,7 @@ import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
+@NEUAutoSubscribe
public class EnchantStyleCustomizer {
public static EnchantStyleCustomizer INSTANCE = new EnchantStyleCustomizer();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/EnderNodeHighlighter.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/EnderNodeHighlighter.java
index ce0e6a25..51fc950c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/EnderNodeHighlighter.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/EnderNodeHighlighter.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures.world;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.SpawnParticleEvent;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
@@ -33,6 +34,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import static io.github.moulberry.notenoughupdates.util.MathUtil.basicallyEqual;
+@NEUAutoSubscribe
public class EnderNodeHighlighter extends GenericBlockHighlighter {
private static final EnderNodeHighlighter INSTANCE = new EnderNodeHighlighter();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/FrozenTreasuresHighlighter.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/FrozenTreasuresHighlighter.java
index a7a8706a..2f8071a0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/FrozenTreasuresHighlighter.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/FrozenTreasuresHighlighter.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures.world;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import net.minecraft.block.Block;
@@ -34,6 +35,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List;
+@NEUAutoSubscribe
public class FrozenTreasuresHighlighter extends GenericBlockHighlighter {
private static final FrozenTreasuresHighlighter INSTANCE = new FrozenTreasuresHighlighter();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/GlowingMushroomHighlighter.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/GlowingMushroomHighlighter.java
index fa5794ea..17f5f527 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/GlowingMushroomHighlighter.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/GlowingMushroomHighlighter.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures.world;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.SpawnParticleEvent;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
@@ -33,6 +34,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import static io.github.moulberry.notenoughupdates.util.MathUtil.isDecimalPartApproximately;
+@NEUAutoSubscribe
public class GlowingMushroomHighlighter extends GenericBlockHighlighter {
@SubscribeEvent
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
index 5f5c4832..48d37f2f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
@@ -24,6 +24,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -66,6 +67,7 @@ import java.util.regex.Pattern;
import static io.github.moulberry.notenoughupdates.util.GuiTextures.help;
+@NEUAutoSubscribe
public class CalendarOverlay {
private static final ResourceLocation BACKGROUND = new ResourceLocation("notenoughupdates:calendar/background.png");
private static final ResourceLocation DISPLAYBAR = new ResourceLocation("notenoughupdates:calendar/displaybar.png");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
index aa977413..e81834d3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
@@ -28,7 +28,6 @@ import io.github.moulberry.notenoughupdates.recipes.RecipeHistory;
import io.github.moulberry.notenoughupdates.recipes.RecipeSlot;
import io.github.moulberry.notenoughupdates.recipes.RecipeType;
import io.github.moulberry.notenoughupdates.util.Utils;
-import lombok.var;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java
index 205dcd83..8ee68457 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscgui;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.config.KeybindHelper;
import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -39,7 +40,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
-
+@NEUAutoSubscribe
public class InventoryStorageSelector {
private static final InventoryStorageSelector INSTANCE = new InventoryStorageSelector();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java
index ac676a98..4f01e551 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscgui;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.SignSubmitEvent;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiEditSign;
import io.github.moulberry.notenoughupdates.util.Calculator;
@@ -35,6 +36,7 @@ import java.text.DecimalFormat;
import java.math.BigDecimal;
import java.util.Objects;
+@NEUAutoSubscribe
public class SignCalculator {
String lastSource = null;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
index 828e50b1..e13934e1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
@@ -22,6 +22,7 @@ package io.github.moulberry.notenoughupdates.miscgui;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.util.Constants;
@@ -50,6 +51,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+@NEUAutoSubscribe
public class TrophyRewardOverlay {
private static TrophyRewardOverlay instance = null;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java
index 512ebb8f..03eb227c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.miscgui.minionhelper;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.loaders.MinionHelperApiLoader;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.loaders.MinionHelperChatLoader;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.loaders.MinionHelperInventoryLoader;
@@ -41,6 +42,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+@NEUAutoSubscribe
public class MinionHelperManager {
private static MinionHelperManager instance = null;
private final Map<String, Minion> minions = new HashMap<>();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
index 91d92091..a5bb99b8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
@@ -294,8 +294,9 @@ public abstract class MixinGuiContainer extends GuiScreen {
@Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = TARGET_CANBEHOVERED))
public boolean drawScreen_canBeHovered(Slot slot) {
- if (NotEnoughUpdates.INSTANCE.config.improvedSBMenu.hideEmptyPanes &&
- BetterContainers.isOverriding() && BetterContainers.isBlankStack(slot.slotNumber, slot.getStack())) {
+ if ((NotEnoughUpdates.INSTANCE.config.improvedSBMenu.hideEmptyPanes &&
+ BetterContainers.isOverriding() && BetterContainers.isBlankStack(slot.slotNumber, slot.getStack())) ||
+ slot.getStack() != null && slot.getStack().hasTagCompound() && slot.getStack().getTagCompound().getBoolean("NEUHIDETOOLIP")) {
return false;
}
return slot.canBeHovered();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java
index b978b433..8baa2bef 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java
@@ -20,16 +20,26 @@
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.gui.GuiScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import java.net.URI;
+
@Mixin(GuiScreen.class)
public class MixinGuiScreen {
@Inject(method = "sendChatMessage(Ljava/lang/String;Z)V", at = @At("HEAD"))
public void onSendChatMessage(String message, boolean addToChat, CallbackInfo ci) {
SBInfo.getInstance().onSendChatMessage(message);
}
+
+ @Inject(method = "openWebLink", at = @At("HEAD"), cancellable = true)
+ public void onOpenWebLink(URI url, CallbackInfo ci) {
+ if (Utils.openUrl(url.toString())) {
+ ci.cancel();
+ }
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiUtils.java
new file mode 100644
index 00000000..0ad2a098
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiUtils.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraftforge.fml.client.config.GuiUtils;
+import org.lwjgl.input.Mouse;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.ModifyVariable;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import java.util.List;
+
+@Mixin(value = GuiUtils.class, remap = false)
+public class MixinGuiUtils {
+ @Inject(method = "drawHoveringText", at = @At("HEAD"))
+ private static void drawHoveringText_head(
+ List<String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font, CallbackInfo ci) {
+ Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.guiScale);
+ }
+
+ @ModifyVariable(method = "drawHoveringText", at = @At(value = "HEAD"), ordinal = 0, argsOnly = true)
+ private static int drawHoveringText_modifyMouseX(int mouseX) {
+ return Mouse.getX() * Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.guiScale).getScaledWidth() / Minecraft.getMinecraft().displayWidth;
+ }
+
+ @ModifyVariable(method = "drawHoveringText", at = @At(value = "HEAD"), ordinal = 1, argsOnly = true)
+ private static int drawHoveringText_modifyMouseY(int mouseY) {
+ return Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.guiScale).getScaledHeight() -
+ Mouse.getY() * Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.guiScale).getScaledHeight() / Minecraft.getMinecraft().displayHeight;
+ }
+
+
+ @ModifyVariable(method = "drawHoveringText", at = @At(value = "HEAD"), ordinal = 2, argsOnly = true)
+ private static int drawHoveringText_modifyWidth(int width) {
+ return Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.guiScale).getScaledWidth();
+ }
+
+ @ModifyVariable(method = "drawHoveringText", at = @At(value = "HEAD"), ordinal = 3, argsOnly = true)
+ private static int drawHoveringText_modifyHeight(int height) {
+ return Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.guiScale).getScaledHeight();
+ }
+
+ @Inject(method = "drawHoveringText", at = @At("TAIL"))
+ private static void drawHoveringText_tail(
+ List<String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font, CallbackInfo ci) {
+ Utils.resetGuiScale();
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java
index de117002..22e53ae1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java
@@ -19,13 +19,17 @@
package io.github.moulberry.notenoughupdates.mixins;
+import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent;
import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(InventoryPlayer.class)
public class MixinInventoryPlayer {
@@ -42,4 +46,24 @@ public class MixinInventoryPlayer {
SlotLocking.getInstance().changedSlot($this.currentItem);
}
+
+ @Shadow public ItemStack[] mainInventory;
+ @Shadow public ItemStack[] armorInventory;
+
+ @Inject(method = "getStackInSlot", at = @At("HEAD"), cancellable = true)
+ public void on(int index, CallbackInfoReturnable<ItemStack> cir) {
+ ItemStack itemStack =
+ index < mainInventory.length
+ ? this.mainInventory[index]
+ : this.armorInventory[index - mainInventory.length];
+ ReplaceItemEvent replaceItemEventInventory = new ReplaceItemEvent(
+ itemStack,
+ ((InventoryPlayer) (Object) this),
+ index
+ );
+ replaceItemEventInventory.post();
+ if (replaceItemEventInventory.getReplacement() != replaceItemEventInventory.getOriginal()) {
+ cir.setReturnValue(replaceItemEventInventory.getReplacement());
+ }
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerDeadmau5Head.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerDeadmau5Head.java
new file mode 100644
index 00000000..14ae9c74
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerDeadmau5Head.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.miscfeatures.entityviewer.GUIClientPlayer;
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.renderer.entity.layers.LayerDeadmau5Head;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(LayerDeadmau5Head.class)
+public class MixinLayerDeadmau5Head {
+
+ @Inject(method = "doRenderLayer(Lnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V", at = @At("HEAD"), cancellable = true)
+ public void doRenderLayer(
+ AbstractClientPlayer entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale, CallbackInfo ci) {
+ if (entitylivingbaseIn instanceof GUIClientPlayer) ci.cancel();
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java
index 10a4de0e..9d7a0775 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java
@@ -263,8 +263,8 @@ public class Fishing {
@Expose
@ConfigOption(
- name = "Fishing timer colour (30s)",
- desc = "Colour of the fishing timer after 30 seconds or more have passed",
+ name = "Fishing timer colour (20s)",
+ desc = "Colour of the fishing timer after 20 seconds or more have passed",
searchTags = "color"
)
@ConfigEditorColour
@@ -273,8 +273,8 @@ public class Fishing {
@Expose
@ConfigOption(
- name = "Fishing timer ping (30s)",
- desc = "Play a sound after 30 seconds passed"
+ name = "Fishing timer ping (20s)",
+ desc = "Play a sound after 20 seconds passed"
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 6)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
index d477b62b..081fd4b3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
@@ -468,4 +468,20 @@ public class ItemOverlays {
@ConfigEditorBoolean
public boolean pickaxeAbility = true;
+ @Expose
+ @ConfigOption(
+ name = "Bonzo Mask Ability Cooldown",
+ desc = "Show the cooldown duration of a bonzo mask ability as the durability."
+ )
+ @ConfigEditorBoolean
+ public boolean bonzoAbility = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Spirit Mask Ability Cooldown",
+ desc = "Show the cooldown duration of the spirit mask ability as the durability."
+ )
+ @ConfigEditorBoolean
+ public boolean spiritAbility = true;
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java
index b82b44c2..74400f59 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java
@@ -233,12 +233,31 @@ public class Mining {
@ConfigOption(
name = "Star Cult Tab",
desc = "Only show the star cult timer when tab list is open\n" +
- "\u00A7cThis only works outside of Dwarven Caves!"
+ "§cThis only works outside of Dwarven Caves!"
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 2)
public boolean starCultDisplayOnlyShowTab = false;
+ @Expose
+ @ConfigOption(
+ name = "Commission Task Tips",
+ desc = "Show tips to help complete commission tasks"
+ )
+ @ConfigEditorDropdown(
+ values = {"Off", "Only while sneaking", "Always"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int commissionTaskTips = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Tips in New Line",
+ desc = "Show the Commission Task Tips in the next line.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean commissionTaskTipNewLine = true;
+
@ConfigOption(
name = "Metal Detector Solver",
desc = ""
@@ -738,7 +757,7 @@ public class Mining {
@Expose
@ConfigOption(
name = "Enable Tracker",
- desc = "Show an Overlay with useful information related to Power Grinding"
+ desc = "Show an Overlay with useful information related to Powder Grinding"
)
@ConfigAccordionId(id = 9)
@ConfigEditorBoolean
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
index b72610b8..47e51eec 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
@@ -305,8 +305,8 @@ public class Misc {
@Expose
@ConfigOption(
- name = "Dungeon Groups PV",
- desc = "View another player's profile by clicking on the chat message when they join in a dungeon group."
+ name = "Group Join PV",
+ desc = "View another player's profile by clicking on the chat message when they join in a dungeon or kuudra group."
)
@ConfigEditorBoolean
public boolean dungeonGroupsPV = true;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
index 8539c3c4..45a96577 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
@@ -24,6 +24,7 @@ import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigAccord
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorAccordion;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDraggableList;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorKeybind;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
@@ -147,6 +148,16 @@ public class TooltipTweaks {
@Expose
@ConfigOption(
+ name = "Resize tooltips",
+ desc = "Resizes tooltips to make them readable"
+ )
+ @ConfigEditorDropdown(
+ values = {"Default", "Small", "Normal", "Large", "Auto"}
+ )
+ public int guiScale = 0;
+
+ @Expose
+ @ConfigOption(
name = "Expand Pet Exp Requirement",
desc = "Show which the full amount of pet xp required"
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java
index 5cd8f6b3..db81bfa4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java
@@ -24,6 +24,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.GuiInventoryBackgroundDrawnEvent;
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
@@ -54,6 +55,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+@NEUAutoSubscribe
public class EquipmentOverlay {
public static EquipmentOverlay INSTANCE = new EquipmentOverlay();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java
index f2e485f2..9212eb6f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.overlays;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.config.gui.GuiPositionEditor;
import io.github.moulberry.notenoughupdates.util.SBInfo;
@@ -38,6 +39,7 @@ import org.lwjgl.opengl.GL14;
import java.awt.*;
+@NEUAutoSubscribe
public class FuelBar {
public static final ResourceLocation FUEL_BAR = new ResourceLocation("notenoughupdates:fuel_bar.png");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
index f25407b6..ea253e94 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
@@ -31,7 +31,6 @@ import io.github.moulberry.notenoughupdates.util.StarCultCalculator;
import io.github.moulberry.notenoughupdates.util.TabListUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.Items;
@@ -39,10 +38,6 @@ import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.WorldSettings;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-import org.lwjgl.input.Keyboard;
import org.lwjgl.util.vector.Vector2f;
import java.util.ArrayList;
@@ -379,22 +374,35 @@ public class MiningOverlay extends TextTabOverlay {
} else if (entry.getValue() >= 0.25) {
col = GOLD;
}
+ String tips = getTipPart(entry.getKey());
+ boolean newLine = NotEnoughUpdates.INSTANCE.config.mining.commissionTaskTipNewLine;
+ String newLineTip = null;
+ if (newLine) {
+ if (!tips.isEmpty()) {
+ newLineTip = " " + tips;
+ tips = "";
+ }
+ }
NEUConfig.HiddenLocationSpecific locationSpecific = NotEnoughUpdates.INSTANCE.config.getLocationSpecific();
int max;
if (-1 != (max = locationSpecific.commissionMaxes.getOrDefault(entry.getKey(), -1))) {
commissionsStrings.add(
- DARK_AQUA + entry.getKey() + ": " + col + Math.round(entry.getValue() * max) + "/" + max);
+ DARK_AQUA + entry.getKey() + ": " + col + Math.round(entry.getValue() * max) + "/" + max + tips);
} else {
String valS = Utils.floatToString(entry.getValue() * 100, 1);
- commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + valS + "%");
+ commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + valS + "%" + tips);
+ }
+ if (newLineTip != null) {
+ commissionsStrings.add(newLineTip);
}
}
}
if (ItemCooldowns.firstLoadMillis > 0) {
//set cooldown on first skyblock load.
- ItemCooldowns.pickaxeUseCooldownMillisRemaining = 60 * 1000 - (System.currentTimeMillis() - ItemCooldowns.firstLoadMillis);
+ ItemCooldowns.pickaxeUseCooldownMillisRemaining =
+ 60 * 1000 - (System.currentTimeMillis() - ItemCooldowns.firstLoadMillis);
ItemCooldowns.firstLoadMillis = 0;
}
@@ -449,7 +457,7 @@ public class MiningOverlay extends TextTabOverlay {
}
if (starCultDisplay) {
- if(overlayStrings == null) overlayStrings = new ArrayList<>();
+ if (overlayStrings == null) overlayStrings = new ArrayList<>();
if (!NotEnoughUpdates.INSTANCE.config.mining.starCultDisplayOnlyShowTab ||
lastTabState) {
@@ -467,7 +475,7 @@ public class MiningOverlay extends TextTabOverlay {
}
if (forgeDisplay) {
- if(overlayStrings == null) overlayStrings = new ArrayList<>();
+ if (overlayStrings == null) overlayStrings = new ArrayList<>();
if (!NotEnoughUpdates.INSTANCE.config.mining.forgeDisplayOnlyShowTab ||
lastTabState) {
@@ -484,14 +492,97 @@ public class MiningOverlay extends TextTabOverlay {
if (overlayStrings != null && overlayStrings.isEmpty()) overlayStrings = null;
}
+ private String getTipPart(String name) {
+ int settings = NotEnoughUpdates.INSTANCE.config.mining.commissionTaskTips;
+ if (settings == 0) return "";
+
+ if (!Minecraft.getMinecraft().thePlayer.isSneaking() && settings == 1) return "";
+
+ String tip = getTip(name);
+ if (tip == null) return " §4???";
+
+ return " §8§l>§7 " + tip;
+ }
+
+ private String getTip(String name) {
+ if (SBInfo.getInstance().getLocation().equals("mining_3")) { // Dwarven Mines
+ if (name.equals("First Event")) return "Participate in any §6Mining Event";
+
+ // During Event
+ if (name.equals("Lucky Raffle")) return "Collect 20 Raffle Tickets during §6Raffle Event";
+ if (name.equals("Goblin Raid Slayer")) return "Kill 20 Goblins during §6Goblin Raid Event";
+ if (name.equals("Raffle")) return "Participate in §6Raffle Event";
+ if (name.equals("Goblin Raid")) return "Participate in §6Goblin Raid event";
+ if (name.equals("2x Mithril Powder Collector")) return "Collect 500 Mithril Powder during §62x Powder event";
+
+ // Slay
+ if (name.equals("Ice Walker Slayer")) return "Kill 50 Ice Walkers §b(Great Ice Wall)";
+ if (name.equals("Goblin Slayer")) return "Kill 100 Goblins §b(Goblin Borrows)";
+ if (name.equals("Golden Goblin Slayer")) return "Kill 1 Golden Goblin (anywhere)";
+ if (name.equals("Star Sentry Puncher")) return "Damage Star Sentries 10 times (anywhere)";
+
+ // Mining
+ if (name.equals("Mithril Miner")) return "Break 500 Mithril (anywhere)";
+ if (name.equals("Titanium Miner")) return "Break 15 Titanium (anywhere)";
+
+ if (name.equals("Cliffside Veins Mithril")) return "Break 350 Mithril §b(Cliffside Veins)";
+ if (name.equals("Royal Mines Mithril")) return "Break 350 Mithril §b(Royal Mines)";
+ if (name.equals("Lava Springs Mithril")) return "Break 350 Mithril §b(Lava Springs)";
+ if (name.equals("Rampart's Quarry Mithril")) return "Break 350 Mithril §b(Rampart's Quarry)";
+ if (name.equals("Upper Mines Mithril")) return "Break 350 Mithril §b(Upper Mines)";
+
+ if (name.equals("Cliffside Veins Titanium")) return "Break 10 Titanium §b(Cliffside Veins)";
+ if (name.equals("Lava Springs Titanium")) return "Break 10 Titanium §b(Lava Springs)";
+ if (name.equals("Royal Mines Titanium")) return "Break 10 Titanium §b(Royal Mines)";
+ if (name.equals("Rampart's Quarry Titanium")) return "Break 10 Titanium §b(Rampart's Quarry)";
+ if (name.equals("Upper Mines Titanium")) return "Break 10 Titanium §b(Upper Mines)";
+
+ } else if (SBInfo.getInstance().getLocation().equals("crystal_hollows")) { // Crystal Hollows
+ if (name.equals("Chest Looter")) return "Open 3 chests";
+ if (name.equals("Hard Stone Miner")) return "Break 1,000 Hard Stone";
+
+ String jungle = " §a(Jungle)";
+ String goblin = " §6(Golbin Holdout)";
+ String mithril = " §b(Mithril Deposits)";
+ String precursor = " §8(Precursor Remenants)";
+ String magma = " §c(Magma Fields)";
+
+ if (name.equals("Goblin Slayer")) return "Kill 13 Goblins" + goblin;
+ if (name.equals("Sludge Slayer")) return "Kill 25 Sludges" + jungle;
+ if (name.equals("Thyst Slayer")) return "Kill 5 Thysts, when breaking Amethysts" + jungle;
+ if (name.equals("Boss Corleone Slayer")) return "Find and kill Corleone" + mithril;
+ if (name.equals("Yog Slayer")) return "Kill 13 Yogs" + magma;
+ if (name.equals("Automaton Slayer")) return "Kill 13 Automatons" + precursor;
+ if (name.equals("Team Treasurite Member Slayer")) return "Kill 13 Team Treasurite Members" + mithril;
+
+ if (name.endsWith("Crystal Hunter")) {
+ if (name.startsWith("Amethyst")) return "Temple Jump & Run" + jungle;
+ if (name.startsWith("Jade")) return "4 weapons from Mines of Divan" + mithril;
+ if (name.startsWith("Amber")) return "King and Queen" + goblin;
+ if (name.startsWith("Sapphire")) return "6 Robot Parts in Precursor City" + precursor;
+ if (name.startsWith("Topaz")) return "Kill Bal" + magma;
+ }
+
+ if (name.endsWith("Gemstone Collector")) {
+ if (name.startsWith("Amber")) return "Break orange glass" + goblin;
+ if (name.startsWith("Sapphire")) return "Break blue glass" + precursor;
+ if (name.startsWith("Jade")) return "Break green glass" + mithril;
+ if (name.startsWith("Amethyst")) return "Break purple glass" + jungle;
+ if (name.startsWith("Ruby")) return "Break red glass (anywhere)";
+ if (name.startsWith("Topaz")) return "Break yellow glass" + magma;
+ }
+ }
+
+ return null;
+ }
+
private static List<String> getForgeStrings(List<ForgeItem> forgeItems) {
List<String> forgeString = new ArrayList<>();
long currentTimeMillis = System.currentTimeMillis();
forgeIDLabel:
for (int i = 0; i < 5; i++) {
- for (ForgeItem forgeItem : forgeItems) {
- if (forgeItem.forgeID == i) {
- ForgeItem item = forgeItem;
+ for (ForgeItem item : forgeItems) {
+ if (item.forgeID == i) {
if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplay == 0) {
if (item.status == 2 && item.finishTime < currentTimeMillis) {
@@ -541,7 +632,6 @@ public class MiningOverlay extends TextTabOverlay {
}
}
forgeItems.add(item);
- return;
}
public static class ForgeItem {
@@ -617,6 +707,9 @@ public class MiningOverlay extends TextTabOverlay {
if (!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlayIcons) return;
GlStateManager.enableDepth();
+ // No icon for the tip line
+ if (line.contains(">")) return;
+
ItemStack icon = null;
String cleaned = Utils.cleanColour(line);
String beforeColon = cleaned.split(":")[0];
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java
index 50ecce90..ad8755e3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java
@@ -19,8 +19,6 @@
package io.github.moulberry.notenoughupdates.overlays;
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.config.Position;
@@ -28,26 +26,19 @@ import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.util.SBInfo;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.nio.charset.StandardCharsets;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
-import java.util.stream.Collectors;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class PowderGrindingOverlay extends TextTabOverlay {
private final static JsonParser PARSER = new JsonParser();
+ private final static Pattern pattern =
+ Pattern.compile("You received \\+([0-9]+(?:,\\d+)*) (Mithril|Gemstone) Powder\\.");
public int chestCount = 0;
public int openedChestCount = 0;
@@ -112,7 +103,8 @@ public class PowderGrindingOverlay extends TextTabOverlay {
overlayStrings.add("\u00a73Opened Chests: \u00a7a" + format.format(this.openedChestCount));
break;
case 2:
- overlayStrings.add("\u00a73Unopened Chests: \u00a7c" + format.format(this.chestCount - this.openedChestCount));
+ overlayStrings.add(
+ "\u00a73Unopened Chests: \u00a7c" + format.format(this.chestCount - this.openedChestCount));
break;
case 3:
overlayStrings.add("\u00a73Mithril Powder Found: \u00a72" +
@@ -141,21 +133,26 @@ public class PowderGrindingOverlay extends TextTabOverlay {
if (overlayStrings != null && overlayStrings.isEmpty()) overlayStrings = null;
}
- public void message(String message) {
+ public void onMessage(String message) {
if (message.equals("You uncovered a treasure chest!")) {
this.chestCount++;
} else if (message.equals("You have successfully picked the lock on this chest!")) {
this.openedChestCount++;
} else {
- boolean mithril = message.endsWith(" Mithril Powder");
- boolean gemstone = message.endsWith(" Gemstone Powder");
- if (!(mithril || gemstone)) return;
- try {
- int amount = Integer.parseInt(message.split(" ")[2].replaceAll("\\+", ""));
- if (mithril) this.mithrilPowderFound += amount;
- else this.gemstonePowderFound += amount;
- } catch (NumberFormatException | IndexOutOfBoundsException e) {
- e.printStackTrace();
+ Matcher matcher = pattern.matcher(message);
+ if (matcher.matches()) {
+ String rawNumber = matcher.group(1).replace(",", "");
+ try {
+ int amount = Integer.parseInt(rawNumber);
+ String type = matcher.group(2);
+ if (type.equals("Mithril")) {
+ this.mithrilPowderFound += amount;
+ } else if (type.equals("Gemstone")) {
+ this.gemstonePowderFound += amount;
+ }
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ }
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
index 873ee9f2..47df3c6e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
@@ -691,7 +691,7 @@ public class BasicPage extends GuiProfileViewerPage {
"/" +
StringUtils.shortNumberFormat(maxXp));
}
- String totalXpS = GuiProfileViewer.numberFormat.format((int) level.totalXp);
+ String totalXpS = GuiProfileViewer.numberFormat.format((long) level.totalXp);
tooltipToDisplay.add(EnumChatFormatting.GRAY + "Total XP: " + EnumChatFormatting.DARK_PURPLE + totalXpS +
EnumChatFormatting.DARK_GRAY + " (" +
DECIMAL_FORMAT.format(guiProfileViewer.getPercentage(entry.getKey().toLowerCase(), level)) +
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
index de5d384a..4bf65cc6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -171,10 +171,7 @@ public class GuiProfileViewer extends GuiScreen {
);
public final GuiElementTextField playerNameTextField;
public final GuiElementTextField inventoryTextField = new GuiElementTextField("", GuiElementTextField.SCALE_TEXT);
- public final GuiElementTextField killDeathSearchTextField = new GuiElementTextField(
- "",
- GuiElementTextField.SCALE_TEXT
- );
+ public final GuiElementTextField killDeathSearchTextField = new GuiElementTextField("", GuiElementTextField.SCALE_TEXT);
private final Map<ProfileViewerPage, GuiProfileViewerPage> pages = new HashMap<>();
public int sizeX;
public int sizeY;
@@ -192,7 +189,7 @@ public class GuiProfileViewer extends GuiScreen {
private double lastBgBlurFactor = -1;
private boolean showBingoPage;
- public GuiProfileViewer(final ProfileViewer.Profile profile) {
+ public GuiProfileViewer(ProfileViewer.Profile profile) {
GuiProfileViewer.profile = profile;
GuiProfileViewer.profileId = profile.getLatestProfile();
String name = "";
@@ -219,7 +216,7 @@ public class GuiProfileViewer extends GuiScreen {
pages.put(ProfileViewerPage.CRIMSON_ISLE, new CrimsonIslePage(this));
}
- private static float getMaxLevelXp(final JsonArray levels, final int offset, final int maxLevel) {
+ private static float getMaxLevelXp(JsonArray levels, int offset, int maxLevel) {
float xpTotal = 0;
for (int i = offset; i < offset + maxLevel - 1; i++) {
@@ -230,7 +227,7 @@ public class GuiProfileViewer extends GuiScreen {
}
@Deprecated
- public static String shortNumberFormat(final double n, final int iteration) {
+ public static String shortNumberFormat(double n, int iteration) {
return StringUtils.shortNumberFormat(n, iteration
);
}
@@ -252,7 +249,7 @@ public class GuiProfileViewer extends GuiScreen {
}
@Override
- public void drawScreen(final int mouseX, final int mouseY, final float partialTicks) {
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
currentTime = System.currentTimeMillis();
if (startTime == 0) startTime = currentTime;
@@ -275,10 +272,10 @@ public class GuiProfileViewer extends GuiScreen {
}
}
- sizeX = 431;
- sizeY = 202;
- guiLeft = (width - sizeX) / 2;
- guiTop = (height - sizeY) / 2;
+ this.sizeX = 431;
+ this.sizeY = 202;
+ guiLeft = (this.width - this.sizeX) / 2;
+ guiTop = (this.height - this.sizeY) / 2;
JsonObject currProfileInfo = profile != null ? profile.getProfileInformation(profileId) : null;
if (NotEnoughUpdates.INSTANCE.config.profileViewer.alwaysShowBingoTab) {
@@ -320,7 +317,7 @@ public class GuiProfileViewer extends GuiScreen {
if (!(page == ProfileViewerPage.LOADING)) {
playerNameTextField.render(guiLeft + sizeX - 100, guiTop + sizeY + 5);
- final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
if (profile != null) {
//Render Profile chooser button
@@ -378,10 +375,8 @@ public class GuiProfileViewer extends GuiScreen {
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_unknown);
Utils.drawTexturedRect(guiLeft - 16 - 5, guiTop + sizeY + 5, 16, 16, GL11.GL_NEAREST);
}
- //Render Open In SkyCrypt button
- renderBlurredBackground(
- width,
- height, guiLeft + 100 + 6 + 2, guiTop + sizeY + 3 + 2, 100 - 4, 20 - 4);
+ //Render Open In Skycrypt button
+ renderBlurredBackground(width, height, guiLeft + 100 + 6 + 2, guiTop + sizeY + 3 + 2, 100 - 4, 20 - 4);
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown);
Utils.drawTexturedRect(
guiLeft + 100 + 6,
@@ -395,7 +390,7 @@ public class GuiProfileViewer extends GuiScreen {
GL11.GL_NEAREST
);
Utils.drawStringCenteredScaledMaxWidth(
- "Open in SkyCrypt",
+ "Open in Skycrypt",
Minecraft.getMinecraft().fontRendererObj,
guiLeft + 50 + 100 + 6,
guiTop + sizeY + 3 + 10,
@@ -404,15 +399,12 @@ public class GuiProfileViewer extends GuiScreen {
new Color(63, 224, 208, 255).getRGB()
);
- if (
- profileDropdownSelected && !profile.getProfileNames().isEmpty() && scaledResolution.getScaleFactor() < 4) {
- final int dropdownOptionSize = scaledResolution.getScaleFactor() == 3 ? 10 : 20;
-
- final int numProfiles = profile.getProfileNames().size();
- final int sizeYDropdown = numProfiles * dropdownOptionSize;
- renderBlurredBackground(
- width,
- height, guiLeft + 2, guiTop + sizeY + 23, 100 - 4, sizeYDropdown - 2);
+ if (profileDropdownSelected && !profile.getProfileNames().isEmpty() && scaledResolution.getScaleFactor() < 4) {
+ int dropdownOptionSize = scaledResolution.getScaleFactor() == 3 ? 10 : 20;
+
+ int numProfiles = profile.getProfileNames().size();
+ int sizeYDropdown = numProfiles * dropdownOptionSize;
+ renderBlurredBackground(width, height, guiLeft + 2, guiTop + sizeY + 23, 100 - 4, sizeYDropdown - 2);
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown);
Utils.drawTexturedRect(guiLeft, guiTop + sizeY + 23 - 3, 100, 3, 100 / 200f, 1, 0, 3 / 185f, GL11.GL_NEAREST);
Utils.drawTexturedRect(
@@ -439,7 +431,7 @@ public class GuiProfileViewer extends GuiScreen {
);
for (int yIndex = 0; yIndex < profile.getProfileNames().size(); yIndex++) {
- final String otherProfileId = profile.getProfileNames().get(yIndex);
+ String otherProfileId = profile.getProfileNames().get(yIndex);
Utils.drawStringCenteredScaledMaxWidth(
otherProfileId,
Minecraft.getMinecraft().fontRendererObj,
@@ -525,7 +517,7 @@ public class GuiProfileViewer extends GuiScreen {
switch (page) {
case LOADING:
String str = EnumChatFormatting.YELLOW + "Loading player profiles.";
- final long currentTimeMod = System.currentTimeMillis() % 1000;
+ long currentTimeMod = System.currentTimeMillis() % 1000;
if (currentTimeMod > 333) {
if (currentTimeMod < 666) {
str += ".";
@@ -545,7 +537,7 @@ public class GuiProfileViewer extends GuiScreen {
//This is just here to inform the player what to do
//like typing /api new or telling them to go find a psychotherapist
- final long timeDiff = System.currentTimeMillis() - startTime;
+ long timeDiff = System.currentTimeMillis() - startTime;
if (timeDiff > 20000) {
Utils.drawStringCentered(
@@ -583,11 +575,11 @@ public class GuiProfileViewer extends GuiScreen {
0
);
if (timeDiff > 360000) {
- final long second = (timeDiff / 1000) % 60;
- final long minute = (timeDiff / (1000 * 60)) % 60;
- final long hour = (timeDiff / (1000 * 60 * 60)) % 24;
+ long second = (timeDiff / 1000) % 60;
+ long minute = (timeDiff / (1000 * 60)) % 60;
+ long hour = (timeDiff / (1000 * 60 * 60)) % 24;
- final String time = String.format("%02d:%02d:%02d", hour, minute, second);
+ String time = String.format("%02d:%02d:%02d", hour, minute, second);
Utils.drawStringCentered(
EnumChatFormatting.YELLOW + "You've wasted your time here for: " + time,
Minecraft.getMinecraft().fontRendererObj,
@@ -701,17 +693,17 @@ public class GuiProfileViewer extends GuiScreen {
if (currentPage != ProfileViewerPage.LOADING && currentPage != ProfileViewerPage.INVALID_NAME) {
int ignoredTabs = 0;
- final List<Integer> configList = NotEnoughUpdates.INSTANCE.config.profileViewer.pageLayout;
+ List<Integer> configList = NotEnoughUpdates.INSTANCE.config.profileViewer.pageLayout;
for (int i = 0; i < configList.size(); i++) {
- final ProfileViewerPage iPage = ProfileViewerPage.getById(configList.get(i));
+ ProfileViewerPage iPage = ProfileViewerPage.getById(configList.get(i));
if (iPage == null) continue;
if (iPage.stack == null || (iPage == ProfileViewerPage.BINGO && !showBingoPage)) {
ignoredTabs++;
continue;
}
- final int i2 = i - ignoredTabs;
- final int x = guiLeft + i2 * 28;
- final int y = guiTop - 28;
+ int i2 = i - ignoredTabs;
+ int x = guiLeft + i2 * 28;
+ int y = guiTop - 28;
if (mouseX > x && mouseX < x + 28) {
if (mouseY > y && mouseY < y + 32) {
@@ -728,42 +720,41 @@ public class GuiProfileViewer extends GuiScreen {
}
if (tooltipToDisplay != null) {
- final List<String> grayTooltip = new ArrayList<>(tooltipToDisplay.size());
- for (final String line : tooltipToDisplay) {
+ List<String> grayTooltip = new ArrayList<>(tooltipToDisplay.size());
+ for (String line : tooltipToDisplay) {
grayTooltip.add(EnumChatFormatting.GRAY + line);
}
- Utils.drawHoveringText(grayTooltip, mouseX, mouseY,
- width, height, -1, Minecraft.getMinecraft().fontRendererObj);
+ Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj);
tooltipToDisplay = null;
}
}
- private void renderTabs(final boolean renderPressed) {
+ private void renderTabs(boolean renderPressed) {
int ignoredTabs = 0;
- final List<Integer> configList = NotEnoughUpdates.INSTANCE.config.profileViewer.pageLayout;
+ List<Integer> configList = NotEnoughUpdates.INSTANCE.config.profileViewer.pageLayout;
for (int i = 0; i < configList.size(); i++) {
- final ProfileViewerPage page = ProfileViewerPage.getById(configList.get(i));
+ ProfileViewerPage page = ProfileViewerPage.getById(configList.get(i));
if (page == null) continue;
if (page.stack == null || (page == ProfileViewerPage.BINGO && !showBingoPage)) {
ignoredTabs++;
continue;
}
- final boolean pressed = page == currentPage;
+ boolean pressed = page == currentPage;
if (pressed == renderPressed) {
renderTab(page.stack, i - ignoredTabs, pressed);
}
}
}
- private void renderTab(final ItemStack stack, final int xIndex, final boolean pressed) {
+ private void renderTab(ItemStack stack, int xIndex, boolean pressed) {
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(516, 0.1F);
- final int x = guiLeft + xIndex * 28;
- final int y = guiTop - 28;
+ int x = guiLeft + xIndex * 28;
+ int y = guiTop - 28;
float uMin = 0;
float uMax = 28 / 256f;
@@ -797,20 +788,20 @@ public class GuiProfileViewer extends GuiScreen {
}
@Override
- protected void mouseClicked(final int mouseX, final int mouseY, final int mouseButton) throws IOException {
+ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
if (currentPage != ProfileViewerPage.LOADING && currentPage != ProfileViewerPage.INVALID_NAME) {
int ignoredTabs = 0;
- final List<Integer> configList = NotEnoughUpdates.INSTANCE.config.profileViewer.pageLayout;
+ List<Integer> configList = NotEnoughUpdates.INSTANCE.config.profileViewer.pageLayout;
for (int i = 0; i < configList.size(); i++) {
- final ProfileViewerPage page = ProfileViewerPage.getById(configList.get(i));
+ ProfileViewerPage page = ProfileViewerPage.getById(configList.get(i));
if (page == null) continue;
if (page.stack == null || (page == ProfileViewerPage.BINGO && !showBingoPage)) {
ignoredTabs++;
continue;
}
- final int i2 = i - ignoredTabs;
- final int x = guiLeft + i2 * 28;
- final int y = guiTop - 28;
+ int i2 = i - ignoredTabs;
+ int x = guiLeft + i2 * 28;
+ int y = guiTop - 28;
if (mouseX > x && mouseX < x + 28) {
if (mouseY > y && mouseY < y + 32) {
@@ -847,9 +838,8 @@ public class GuiProfileViewer extends GuiScreen {
profileId != null
) {
if (mouseY > guiTop + sizeY + 3 && mouseY < guiTop + sizeY + 23) {
- final String url =
- "https://sky.shiiyu.moe/stats/" + profile.getHypixelProfile().get("displayname").getAsString() + "/" +
- profileId;
+ String url = "https://sky.shiiyu.moe/stats/" + profile.getHypixelProfile().get("displayname").getAsString() + "/" +
+ profileId;
Utils.openUrl(url);
Utils.playPressSound();
return;
@@ -857,7 +847,7 @@ public class GuiProfileViewer extends GuiScreen {
}
if (mouseX > guiLeft && mouseX < guiLeft + 100 && profile != null && !profile.getProfileNames().isEmpty()) {
- final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
if (mouseY > guiTop + sizeY + 3 && mouseY < guiTop + sizeY + 23) {
if (scaledResolution.getScaleFactor() >= 4) {
profileDropdownSelected = false;
@@ -876,7 +866,7 @@ public class GuiProfileViewer extends GuiScreen {
if (profileNum >= profile.getProfileNames().size()) profileNum = 0;
if (profileNum < 0) profileNum = profile.getProfileNames().size() - 1;
- final String newProfileId = profile.getProfileNames().get(profileNum);
+ String newProfileId = profile.getProfileNames().get(profileNum);
if (profileId != null && !profileId.equals(newProfileId)) {
resetCache();
}
@@ -885,11 +875,11 @@ public class GuiProfileViewer extends GuiScreen {
profileDropdownSelected = !profileDropdownSelected;
}
} else if (scaledResolution.getScaleFactor() < 4 && profileDropdownSelected) {
- final int dropdownOptionSize = scaledResolution.getScaleFactor() == 3 ? 10 : 20;
- final int extraY = mouseY - (guiTop + sizeY + 23);
- final int index = extraY / dropdownOptionSize;
+ int dropdownOptionSize = scaledResolution.getScaleFactor() == 3 ? 10 : 20;
+ int extraY = mouseY - (guiTop + sizeY + 23);
+ int index = extraY / dropdownOptionSize;
if (index >= 0 && index < profile.getProfileNames().size()) {
- final String newProfileId = profile.getProfileNames().get(index);
+ String newProfileId = profile.getProfileNames().get(index);
if (profileId != null && !profileId.equals(newProfileId)) {
resetCache();
}
@@ -908,7 +898,7 @@ public class GuiProfileViewer extends GuiScreen {
}
@Override
- protected void keyTyped(final char typedChar, final int keyCode) throws IOException {
+ protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
if (pages.containsKey(currentPage)) {
@@ -931,7 +921,7 @@ public class GuiProfileViewer extends GuiScreen {
}
@Override
- protected void mouseReleased(final int mouseX, final int mouseY, final int mouseButton) {
+ protected void mouseReleased(int mouseX, int mouseY, int mouseButton) {
super.mouseReleased(mouseX, mouseY, mouseButton);
if (pages.containsKey(currentPage)) {
@@ -940,17 +930,17 @@ public class GuiProfileViewer extends GuiScreen {
}
public void renderXpBar(
- final String skillName,
- final ItemStack stack,
- final int x,
- final int y,
- final int xSize,
- final ProfileViewer.Level levelObj,
- final int mouseX,
- final int mouseY
+ String skillName,
+ ItemStack stack,
+ int x,
+ int y,
+ int xSize,
+ ProfileViewer.Level levelObj,
+ int mouseX,
+ int mouseY
) {
- final float level = levelObj.level;
- final int levelFloored = (int) Math.floor(level);
+ float level = levelObj.level;
+ int levelFloored = (int) Math.floor(level);
Utils.renderAlignedString(skillName, EnumChatFormatting.WHITE.toString() + levelFloored, x + 14, y - 4, xSize - 20);
@@ -966,27 +956,24 @@ public class GuiProfileViewer extends GuiScreen {
if (mouseX > x && mouseX < x + 120) {
if (mouseY > y - 4 && mouseY < y + 13) {
- final String levelStr;
+ String levelStr;
String totalXpStr = null;
if (skillName.contains("Catacombs")) {
totalXpStr = EnumChatFormatting.GRAY + "Total XP: " + EnumChatFormatting.DARK_PURPLE +
- numberFormat.format(levelObj.totalXp) + EnumChatFormatting.DARK_GRAY + " (" +
+ numberFormat.format(levelObj.totalXp) + EnumChatFormatting.DARK_GRAY + " (" +
DECIMAL_FORMAT.format(getPercentage(skillName.toLowerCase(), levelObj)) + "% to 50)";
}
- // Adds overflow level to each level object that is maxed, avoids hotm level as there is no overflow xp for it
+ // Adds overflow level to each level object that is maxed, avoids hotm level as there is no overflow xp for it
if (levelObj.maxed) {
levelStr = levelObj.maxLevel != 7 ?
- EnumChatFormatting.GOLD + "MAXED!" + EnumChatFormatting.GRAY + " (Overflow level: " + String.format(
- "%.2f",
- levelObj.level
- ) + ")" :
- EnumChatFormatting.GOLD + "MAXED!";
+ EnumChatFormatting.GOLD + "MAXED!" + EnumChatFormatting.GRAY + " (Overflow level: " + String.format("%.2f", levelObj.level) + ")" :
+ EnumChatFormatting.GOLD + "MAXED!";
} else {
if (skillName.contains("Class Average")) {
levelStr = "Progress: " + EnumChatFormatting.DARK_PURPLE + String.format("%.1f", (level % 1 * 100)) + "%";
totalXpStr = "Exact Class Average: " + EnumChatFormatting.WHITE + String.format("%.2f", levelObj.level);
} else {
- final int maxXp = (int) levelObj.maxXpForLevel;
+ int maxXp = (int) levelObj.maxXpForLevel;
levelStr =
EnumChatFormatting.DARK_PURPLE +
StringUtils.shortNumberFormat(Math.round((level % 1) * maxXp)) +
@@ -1006,8 +993,8 @@ public class GuiProfileViewer extends GuiScreen {
}
}
- final NBTTagCompound nbt = new NBTTagCompound(); //Adding NBT Data for Custom Resource Packs
- final NBTTagCompound display = new NBTTagCompound();
+ NBTTagCompound nbt = new NBTTagCompound(); //Adding NBT Data for Custom Resource Packs
+ NBTTagCompound display = new NBTTagCompound();
display.setString("Name", skillName);
nbt.setTag("display", display);
stack.setTagCompound(nbt);
@@ -1023,14 +1010,14 @@ public class GuiProfileViewer extends GuiScreen {
return ((BasicPage) pages.get(ProfileViewerPage.BASIC)).entityPlayer;
}
- public void renderGoldBar(final float x, final float y, final float xSize) {
+ public void renderGoldBar(float x, float y, float xSize) {
if (!OpenGlHelper.areShadersSupported()) {
renderBar(x, y, xSize, 1);
return;
}
Minecraft.getMinecraft().getTextureManager().bindTexture(icons);
- final ShaderManager shaderManager = ShaderManager.getInstance();
+ ShaderManager shaderManager = ShaderManager.getInstance();
shaderManager.loadShader("make_gold");
shaderManager.loadData("make_gold", "amount", (startTime - System.currentTimeMillis()) / 10000f);
@@ -1050,11 +1037,11 @@ public class GuiProfileViewer extends GuiScreen {
GL20.glUseProgram(0);
}
- public void renderBar(final float x, final float y, final float xSize, float completed) {
+ public void renderBar(float x, float y, float xSize, float completed) {
Minecraft.getMinecraft().getTextureManager().bindTexture(icons);
completed = Math.round(completed / 0.05f) * 0.05f;
- final float notCompleted = 1 - completed;
+ float notCompleted = 1 - completed;
GlStateManager.color(1, 1, 1, 1);
float width;
@@ -1118,8 +1105,8 @@ public class GuiProfileViewer extends GuiScreen {
* This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to
* apply scales and translations manually.
*/
- private Matrix4f createProjectionMatrix(final int width, final int height) {
- final Matrix4f projMatrix = new Matrix4f();
+ private Matrix4f createProjectionMatrix(int width, int height) {
+ Matrix4f projMatrix = new Matrix4f();
projMatrix.setIdentity();
projMatrix.m00 = 2.0F / (float) width;
projMatrix.m11 = 2.0F / (float) (-height);
@@ -1134,8 +1121,8 @@ public class GuiProfileViewer extends GuiScreen {
private void blurBackground() {
if (!OpenGlHelper.isFramebufferEnabled()) return;
- final int width = Minecraft.getMinecraft().displayWidth;
- final int height = Minecraft.getMinecraft().displayHeight;
+ int width = Minecraft.getMinecraft().displayWidth;
+ int height = Minecraft.getMinecraft().displayHeight;
if (blurOutputHorz == null) {
blurOutputHorz = new Framebuffer(width, height, false);
@@ -1167,7 +1154,7 @@ public class GuiProfileViewer extends GuiScreen {
);
blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0);
blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
- } catch (final Exception ignored) {
+ } catch (Exception ignored) {
}
}
if (blurShaderVert == null) {
@@ -1180,7 +1167,7 @@ public class GuiProfileViewer extends GuiScreen {
);
blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1);
blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
- } catch (final Exception ignored) {
+ } catch (Exception ignored) {
}
}
if (blurShaderHorz != null && blurShaderVert != null) {
@@ -1199,7 +1186,7 @@ public class GuiProfileViewer extends GuiScreen {
}
}
- public float getPercentage(final String skillName, final ProfileViewer.Level level) {
+ public float getPercentage(String skillName, ProfileViewer.Level level) {
if (level.maxed) {
return 100;
}
@@ -1222,13 +1209,13 @@ public class GuiProfileViewer extends GuiScreen {
* Renders a subsection of the blurred framebuffer on to the corresponding section of the screen.
* Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight]
*/
- public void renderBlurredBackground(final int width, final int height, final int x, final int y, final int blurWidth, final int blurHeight) {
+ public void renderBlurredBackground(int width, int height, int x, int y, int blurWidth, int blurHeight) {
if (!OpenGlHelper.isFramebufferEnabled()) return;
- final float uMin = x / (float) width;
- final float uMax = (x + blurWidth) / (float) width;
- final float vMin = (height - y) / (float) height;
- final float vMax = (height - y - blurHeight) / (float) height;
+ float uMin = x / (float) width;
+ float uMax = (x + blurWidth) / (float) width;
+ float vMin = (height - y) / (float) height;
+ float vMax = (height - y - blurHeight) / (float) height;
blurOutputVert.bindFramebufferTexture();
GlStateManager.color(1f, 1f, 1f, 1f);
@@ -1261,22 +1248,22 @@ public class GuiProfileViewer extends GuiScreen {
this(-1, null, null);
}
- ProfileViewerPage(final int id, final Item item, final String name) {
+ ProfileViewerPage(int id, Item item, String name) {
this.id = id;
if (item == null) {
stack = null;
} else {
stack = new ItemStack(item);
- final NBTTagCompound nbt = new NBTTagCompound(); //Adding NBT Data for Custom Resource Packs
- final NBTTagCompound display = new NBTTagCompound();
+ NBTTagCompound nbt = new NBTTagCompound(); //Adding NBT Data for Custom Resource Packs
+ NBTTagCompound display = new NBTTagCompound();
display.setString("Name", name);
nbt.setTag("display", display);
stack.setTagCompound(nbt);
}
}
- public static ProfileViewerPage getById(final int id) {
- for (final ProfileViewerPage page : values()) {
+ public static ProfileViewerPage getById(int id) {
+ for (ProfileViewerPage page : values()) {
if (page.id == id) {
return page;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
index 8aef917c..63c2435a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -19,7 +19,6 @@
package io.github.moulberry.notenoughupdates.profileviewer;
-import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -57,56 +56,47 @@ import java.util.regex.Pattern;
public class ProfileViewer {
- private static final ImmutableMap<String, String> petRarityToNumMap =
- ImmutableMap.<String, String>builder()
- .put("COMMON", "0")
- .put("UNCOMMON", "1")
- .put("RARE", "2")
- .put("EPIC", "3")
- .put("LEGENDARY", "4")
- .put("MYTHIC", "5")
- .build();
-
- private static final ImmutableMap<String, ItemStack> skillToSkillDisplayMap =
- ImmutableMap.<String, ItemStack>builder()
- .put("taming", Utils.createItemStack(Items.spawn_egg, EnumChatFormatting.LIGHT_PURPLE + "Taming"))
- .put("mining", Utils.createItemStack(Items.stone_pickaxe, EnumChatFormatting.GRAY + "Mining"))
- .put(
- "foraging",
- Utils.createItemStack(
- Item.getItemFromBlock(Blocks.sapling),
- EnumChatFormatting.DARK_GREEN + "Foraging"
- )
- )
- .put(
- "enchanting",
- Utils.createItemStack(
- Item.getItemFromBlock(Blocks.enchanting_table),
- EnumChatFormatting.GREEN + "Enchanting"
- )
- )
- .put(
- "carpentry",
- Utils.createItemStack(
- Item.getItemFromBlock(Blocks.crafting_table),
- EnumChatFormatting.DARK_RED + "Carpentry"
- )
- )
- .put("farming", Utils.createItemStack(Items.golden_hoe, EnumChatFormatting.YELLOW + "Farming"))
- .put("combat", Utils.createItemStack(Items.stone_sword, EnumChatFormatting.RED + "Combat"))
- .put("fishing", Utils.createItemStack(Items.fishing_rod, EnumChatFormatting.AQUA + "Fishing"))
- .put("alchemy", Utils.createItemStack(Items.brewing_stand, EnumChatFormatting.BLUE + "Alchemy"))
- .put(
- "runecrafting",
- Utils.createItemStack(Items.magma_cream, EnumChatFormatting.DARK_PURPLE + "Runecrafting")
- )
- .put("social", Utils.createItemStack(Items.emerald, EnumChatFormatting.DARK_GREEN + "Social"))
- .put("zombie", Utils.createItemStack(Items.rotten_flesh, EnumChatFormatting.GOLD + "Rev Slayer"))
- .put("spider", Utils.createItemStack(Items.spider_eye, EnumChatFormatting.GOLD + "Tara Slayer"))
- .put("wolf", Utils.createItemStack(Items.bone, EnumChatFormatting.GOLD + "Sven Slayer"))
- .put("enderman", Utils.createItemStack(Items.ender_pearl, EnumChatFormatting.GOLD + "Ender Slayer"))
- .put("blaze", Utils.createItemStack(Items.blaze_rod, EnumChatFormatting.GOLD + "Blaze Slayer"))
- .build();
+ private static final HashMap<String, String> petRarityToNumMap = new HashMap<String, String>() {
+ {
+ put("COMMON", "0");
+ put("UNCOMMON", "1");
+ put("RARE", "2");
+ put("EPIC", "3");
+ put("LEGENDARY", "4");
+ put("MYTHIC", "5");
+ }
+ };
+ private static final LinkedHashMap<String, ItemStack> skillToSkillDisplayMap =
+ new LinkedHashMap<String, ItemStack>() {
+ {
+ put("taming", Utils.createItemStack(Items.spawn_egg, EnumChatFormatting.LIGHT_PURPLE + "Taming"));
+ put("mining", Utils.createItemStack(Items.stone_pickaxe, EnumChatFormatting.GRAY + "Mining"));
+ put(
+ "foraging",
+ Utils.createItemStack(Item.getItemFromBlock(Blocks.sapling), EnumChatFormatting.DARK_GREEN + "Foraging")
+ );
+ put(
+ "enchanting",
+ Utils.createItemStack(Item.getItemFromBlock(Blocks.enchanting_table), EnumChatFormatting.GREEN + "Enchanting")
+ );
+ put(
+ "carpentry",
+ Utils.createItemStack(Item.getItemFromBlock(Blocks.crafting_table), EnumChatFormatting.DARK_RED + "Carpentry")
+ );
+ put("farming", Utils.createItemStack(Items.golden_hoe, EnumChatFormatting.YELLOW + "Farming"));
+ put("combat", Utils.createItemStack(Items.stone_sword, EnumChatFormatting.RED + "Combat"));
+ put("fishing", Utils.createItemStack(Items.fishing_rod, EnumChatFormatting.AQUA + "Fishing"));
+ put("alchemy", Utils.createItemStack(Items.brewing_stand, EnumChatFormatting.BLUE + "Alchemy"));
+ put("runecrafting", Utils.createItemStack(Items.magma_cream, EnumChatFormatting.DARK_PURPLE + "Runecrafting"));
+ put("social", Utils.createItemStack(Items.emerald, EnumChatFormatting.DARK_GREEN + "Social"));
+ // put("catacombs", Utils.createItemStack(Item.getItemFromBlock(Blocks.deadbush), EnumChatFormatting.GOLD+"Catacombs"));
+ put("zombie", Utils.createItemStack(Items.rotten_flesh, EnumChatFormatting.GOLD + "Rev Slayer"));
+ put("spider", Utils.createItemStack(Items.spider_eye, EnumChatFormatting.GOLD + "Tara Slayer"));
+ put("wolf", Utils.createItemStack(Items.bone, EnumChatFormatting.GOLD + "Sven Slayer"));
+ put("enderman", Utils.createItemStack(Items.ender_pearl, EnumChatFormatting.GOLD + "Ender Slayer"));
+ put("blaze", Utils.createItemStack(Items.blaze_rod, EnumChatFormatting.GOLD + "Blaze Slayer"));
+ }
+ };
private static final ItemStack CAT_FARMING = Utils.createItemStack(
Items.golden_hoe,
EnumChatFormatting.YELLOW + "Farming"
@@ -461,7 +451,7 @@ public class ProfileViewer {
private final HashMap<String, Profile> uuidToProfileMap = new HashMap<>();
private final HashMap<String, String> nameToUuid = new HashMap<>();
- public ProfileViewer(final NEUManager manager) {
+ public ProfileViewer(NEUManager manager) {
this.manager = manager;
}
@@ -478,20 +468,20 @@ public class ProfileViewer {
}
public static Map<String, ItemStack> getSkillToSkillDisplayMap() {
- return skillToSkillDisplayMap;
+ return Collections.unmodifiableMap(skillToSkillDisplayMap);
}
- public static Level getLevel(final JsonArray levelingArray, float xp, final int levelCap, final boolean cumulative) {
- final Level levelObj = new Level();
+ public static Level getLevel(JsonArray levelingArray, float xp, int levelCap, boolean cumulative) {
+ Level levelObj = new Level();
levelObj.totalXp = xp;
levelObj.maxLevel = levelCap;
for (int level = 0; level < levelingArray.size(); level++) {
- final float levelXp = levelingArray.get(level).getAsFloat();
+ float levelXp = levelingArray.get(level).getAsFloat();
if (levelXp > xp) {
if (cumulative) {
- final float previous = level > 0 ? levelingArray.get(level - 1).getAsFloat() : 0;
+ float previous = level > 0 ? levelingArray.get(level - 1).getAsFloat() : 0;
levelObj.maxXpForLevel = (levelXp - previous);
levelObj.level = 1 + level + (xp - levelXp) / levelObj.maxXpForLevel;
} else {
@@ -535,8 +525,8 @@ public class ProfileViewer {
return null;
}
- public void getHypixelProfile(final String name, final Consumer<JsonObject> callback) {
- final String nameF = name.toLowerCase();
+ public void getHypixelProfile(String name, Consumer<JsonObject> callback) {
+ String nameF = name.toLowerCase();
manager.apiUtils
.newHypixelApiRequest("player")
.queryArgument("name", nameF)
@@ -561,12 +551,12 @@ public class ProfileViewer {
);
}
- public void putNameUuid(final String name, final String uuid) {
+ public void putNameUuid(String name, String uuid) {
nameToUuid.put(name, uuid);
}
- public void getPlayerUUID(final String name, final Consumer<String> uuidCallback) {
- final String nameF = name.toLowerCase();
+ public void getPlayerUUID(String name, Consumer<String> uuidCallback) {
+ String nameF = name.toLowerCase();
if (nameToUuid.containsKey(nameF)) {
uuidCallback.accept(nameToUuid.get(nameF));
return;
@@ -579,7 +569,7 @@ public class ProfileViewer {
.thenAccept(jsonObject -> {
if (jsonObject.has("id") && jsonObject.get("id").isJsonPrimitive() &&
((JsonPrimitive) jsonObject.get("id")).isString()) {
- final String uuid = jsonObject.get("id").getAsString();
+ String uuid = jsonObject.get("id").getAsString();
nameToUuid.put(nameF, uuid);
uuidCallback.accept(uuid);
return;
@@ -588,8 +578,8 @@ public class ProfileViewer {
});
}
- public void getProfileByName(final String name, final Consumer<Profile> callback) {
- final String nameF = name.toLowerCase();
+ public void getProfileByName(String name, Consumer<Profile> callback) {
+ String nameF = name.toLowerCase();
if (nameToUuid.containsKey(nameF) && nameToUuid.get(nameF) == null) {
callback.accept(null);
@@ -621,8 +611,8 @@ public class ProfileViewer {
);
}
- public Profile getProfile(final String uuid, final Consumer<Profile> callback) {
- final Profile profile = uuidToProfileMap.computeIfAbsent(uuid, k -> new Profile(uuid));
+ public Profile getProfile(String uuid, Consumer<Profile> callback) {
+ Profile profile = uuidToProfileMap.computeIfAbsent(uuid, k -> new Profile(uuid));
if (profile.skyblockProfiles != null) {
callback.accept(profile);
} else {
@@ -631,7 +621,7 @@ public class ProfileViewer {
return profile;
}
- public Profile getProfileReset(final String uuid, final Consumer<Profile> callback) {
+ public Profile getProfileReset(String uuid, Consumer<Profile> callback) {
if (uuidToProfileMap.containsKey(uuid)) uuidToProfileMap.get(uuid).resetCache();
return getProfile(uuid, callback);
}
@@ -677,7 +667,7 @@ public class ProfileViewer {
private long lastGuildInfoState = 0;
private long lastBingoInfoState = 0;
- public Profile(final String uuid) {
+ public Profile(String uuid) {
this.uuid = uuid;
}
@@ -685,12 +675,12 @@ public class ProfileViewer {
if (playerStatus != null) return playerStatus;
if (updatingPlayerStatusState.get()) return null;
- final long currentTime = System.currentTimeMillis();
+ long currentTime = System.currentTimeMillis();
if (currentTime - lastStatusInfoState < 15 * 1000) return null;
lastStatusInfoState = currentTime;
updatingPlayerStatusState.set(true);
- final HashMap<String, String> args = new HashMap<>();
+ HashMap<String, String> args = new HashMap<>();
args.put("uuid", "" + uuid);
manager.apiUtils
.newHypixelApiRequest("status")
@@ -708,9 +698,8 @@ public class ProfileViewer {
}
public JsonObject getBingoInformation() {
- final long currentTime = System.currentTimeMillis();
- if (bingoInformation != null && currentTime -
- lastBingoInfoState < 15 * 1000) return bingoInformation;
+ long currentTime = System.currentTimeMillis();
+ if (bingoInformation != null && currentTime - lastBingoInfoState < 15 * 1000) return bingoInformation;
if (updatingBingoInfo.get() && bingoInformation != null) return bingoInformation;
if (updatingBingoInfo.get() && bingoInformation == null) return null;
@@ -735,11 +724,11 @@ public class ProfileViewer {
}
public class SoopyNetworthData {
- private final HashMap<String, Long> categoryWorth;
+ private HashMap<String, Long> categoryWorth;
private Long totalWorth;
- private final String[] keys;
+ private String[] keys;
- SoopyNetworthData(final JsonObject nwData) {
+ SoopyNetworthData(JsonObject nwData) {
categoryWorth = new HashMap<>();
if (nwData == null || nwData.isJsonNull()) {
@@ -754,7 +743,7 @@ public class ProfileViewer {
}
totalWorth = nwData.get("total").getAsLong();
- for (final Map.Entry<String, JsonElement> entry : nwData.get("categories").getAsJsonObject().entrySet()) {
+ for (Map.Entry<String, JsonElement> entry : nwData.get("categories").getAsJsonObject().entrySet()) {
if (entry.getValue().isJsonNull()) {
continue;
}
@@ -778,7 +767,7 @@ public class ProfileViewer {
return totalWorth;
}
- public long getCategory(final String name) {
+ public long getCategory(String name) {
if (categoryWorth.containsKey(name)) return categoryWorth.get(name);
return 0;
}
@@ -802,16 +791,16 @@ public class ProfileViewer {
return soopyWeightLeaderboardPosition;
}
- public boolean isProfileMaxSoopyWeight(final ProfileViewer.Profile profile, final String profileName) {
+ public boolean isProfileMaxSoopyWeight(ProfileViewer.Profile profile, String profileName) {
String highestProfileName = "";
double largestProfileWeight = 0;
for (int yIndex = 0; yIndex < profileNames.size(); yIndex++) {
- final String otherProfileId = profileNames.get(yIndex);
- final Map<String, ProfileViewer.Level> skyblockInfo = profile.getSkyblockInfo(otherProfileId);
+ String otherProfileId = profileNames.get(yIndex);
+ Map<String, ProfileViewer.Level> skyblockInfo = profile.getSkyblockInfo(otherProfileId);
if (skyblockInfo == null) continue;
- final SenitherWeight senitherWeight = new SenitherWeight(skyblockInfo);
- final double weightValue = senitherWeight.getTotalWeight().getRaw();
+ SenitherWeight senitherWeight = new SenitherWeight(skyblockInfo);
+ double weightValue = senitherWeight.getTotalWeight().getRaw();
if (weightValue > largestProfileWeight) {
largestProfileWeight = weightValue;
@@ -826,14 +815,14 @@ public class ProfileViewer {
* Returns SoopyNetworthData with total = -1 if error
* Returns null if still loading
*/
- public SoopyNetworthData getSoopyNetworth(String profileName, final Runnable callback) {
+ public SoopyNetworthData getSoopyNetworth(String profileName, Runnable callback) {
if (profileName == null) profileName = latestProfile;
if (soopyNetworth.get(profileName) != null) {
callback.run();
return soopyNetworth.get(profileName);
}
- final JsonArray playerInfo = getSkyblockProfiles(() -> {});
+ JsonArray playerInfo = getSkyblockProfiles(() -> {});
if (playerInfo == null)
return null; //Not sure how to support the callback in these cases
if (updatingSoopyNetworth.get())
@@ -843,7 +832,7 @@ public class ProfileViewer {
soopyNetworthLeaderboardPosition = -2; //loading
manager.apiUtils
.request()
- .url("https://soopy.dev/api/v2/leaderboard/networth/user/" + uuid)
+ .url("https://soopy.dev/api/v2/leaderboard/networth/user/" + this.uuid)
.requestJson()
.handle((jsonObject, throwable) -> {
if (throwable != null) throwable.printStackTrace();
@@ -864,7 +853,7 @@ public class ProfileViewer {
soopyWeightLeaderboardPosition = -2; //loading
manager.apiUtils
.request()
- .url("https://soopy.dev/api/v2/leaderboard/weight/user/" + uuid)
+ .url("https://soopy.dev/api/v2/leaderboard/weight/user/" + this.uuid)
.requestJson()
.handle((jsonObject, throwable) -> {
if (throwable != null) throwable.printStackTrace();
@@ -884,7 +873,7 @@ public class ProfileViewer {
manager.apiUtils
.request()
- .url("https://soopy.dev/api/v2/player_networth/" + uuid)
+ .url("https://soopy.dev/api/v2/player_networth/" + this.uuid)
.method("POST")
.postData("application/json", skyblockProfiles.toString())
.requestJson()
@@ -897,9 +886,9 @@ public class ProfileViewer {
if (!skyblockProfiles.get(i).isJsonObject()) {
return null;
}
- final JsonObject profile = skyblockProfiles.get(i).getAsJsonObject();
+ JsonObject profile = skyblockProfiles.get(i).getAsJsonObject();
- final String cuteName = profile.get("cute_name").getAsString();
+ String cuteName = profile.get("cute_name").getAsString();
soopyNetworth.put(cuteName, new SoopyNetworthData(null));
}
@@ -913,22 +902,19 @@ public class ProfileViewer {
if (!skyblockProfiles.get(i).isJsonObject()) {
return null;
}
- final JsonObject profile = skyblockProfiles.get(i).getAsJsonObject();
+ JsonObject profile = skyblockProfiles.get(i).getAsJsonObject();
- final String cuteName = profile.get("cute_name").getAsString();
- final String profileId = profile.get("profile_id").getAsString();
+ String cuteName = profile.get("cute_name").getAsString();
+ String profileId = profile.get("profile_id").getAsString();
- final SoopyNetworthData soopyNetworthData;
+ SoopyNetworthData networth;
if (jsonObject.getAsJsonObject("data").get(profileId).isJsonNull()) {
- soopyNetworthData = new SoopyNetworthData(null);
+ networth = new SoopyNetworthData(null);
} else {
- soopyNetworthData = new SoopyNetworthData(jsonObject
- .getAsJsonObject("data")
- .get(profileId)
- .getAsJsonObject());
+ networth = new SoopyNetworthData(jsonObject.getAsJsonObject("data").get(profileId).getAsJsonObject());
}
- soopyNetworth.put(cuteName, soopyNetworthData);
+ soopyNetworth.put(cuteName, networth);
}
updatingSoopyNetworth.set(false);
@@ -944,53 +930,73 @@ public class ProfileViewer {
if (getProfileInformation(profileName) == null) return -1;
if (getInventoryInfo(profileName) == null) return -1;
- final JsonObject inventoryInfo = getInventoryInfo(profileName);
- final JsonObject profileInfo = getProfileInformation(profileName);
+ JsonObject inventoryInfo = getInventoryInfo(profileName);
+ JsonObject profileInfo = getProfileInformation(profileName);
- final HashMap<String, Long> mostExpensiveInternal = new HashMap<>();
+ HashMap<String, Long> mostExpensiveInternal = new HashMap<>();
- long playerNetworth = 0;
- for (final Map.Entry<String, JsonElement> entry : inventoryInfo.entrySet()) {
+ long networth = 0;
+ for (Map.Entry<String, JsonElement> entry : inventoryInfo.entrySet()) {
if (entry.getValue().isJsonArray()) {
- for (final JsonElement element : entry.getValue().getAsJsonArray()) {
+ for (JsonElement element : entry.getValue().getAsJsonArray()) {
if (element != null && element.isJsonObject()) {
- final JsonObject item = element.getAsJsonObject();
- final String internalname = item.get("internalname").getAsString();
+ JsonObject item = element.getAsJsonObject();
+ String internalname = item.get("internalname").getAsString();
if (manager.auctionManager.isVanillaItem(internalname)) continue;
- final long auctionPrice = getAuctionPriceHelper(internalname);
+ JsonObject bzInfo = manager.auctionManager.getBazaarInfo(internalname);
+
+ long auctionPrice;
+ if (bzInfo != null && bzInfo.has("curr_sell")) {
+ auctionPrice = (int) bzInfo.get("curr_sell").getAsFloat();
+ } else {
+ auctionPrice = (long) manager.auctionManager.getItemAvgBin(internalname);
+ if (auctionPrice <= 0) {
+ auctionPrice = manager.auctionManager.getLowestBin(internalname);
+ }
+ }
try {
if (item.has("item_contents")) {
- final JsonArray bytesArr = item.get("item_contents").getAsJsonArray();
- final byte[] bytes = new byte[bytesArr.size()];
+ JsonArray bytesArr = item.get("item_contents").getAsJsonArray();
+ byte[] bytes = new byte[bytesArr.size()];
for (int bytesArrI = 0; bytesArrI < bytesArr.size(); bytesArrI++) {
bytes[bytesArrI] = bytesArr.get(bytesArrI).getAsByte();
}
- final NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(
- bytes));
- final NBTTagList items = contents_nbt.getTagList("i", 10);
+ NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
+ NBTTagList items = contents_nbt.getTagList("i", 10);
for (int j = 0; j < items.tagCount(); j++) {
- if (!items.getCompoundTagAt(j).getKeySet().isEmpty()) {
- final NBTTagCompound nbt = items.getCompoundTagAt(j).getCompoundTag("tag");
- final String internalname2 = manager.getInternalnameFromNBT(nbt);
+ if (items.getCompoundTagAt(j).getKeySet().size() > 0) {
+ NBTTagCompound nbt = items.getCompoundTagAt(j).getCompoundTag("tag");
+ String internalname2 = manager.getInternalnameFromNBT(nbt);
if (internalname2 != null) {
if (manager.auctionManager.isVanillaItem(internalname2)) continue;
- final long auctionPrice2 = getAuctionPriceHelper(internalname2);
- final int count2 = items.getCompoundTagAt(j).getByte("Count");
+ JsonObject bzInfo2 = manager.auctionManager.getBazaarInfo(internalname2);
+
+ long auctionPrice2;
+ if (bzInfo2 != null && bzInfo2.has("curr_sell")) {
+ auctionPrice2 = (int) bzInfo2.get("curr_sell").getAsFloat();
+ } else {
+ auctionPrice2 = (long) manager.auctionManager.getItemAvgBin(internalname2);
+ if (auctionPrice2 <= 0) {
+ auctionPrice2 = manager.auctionManager.getLowestBin(internalname2);
+ }
+ }
+
+ int count2 = items.getCompoundTagAt(j).getByte("Count");
mostExpensiveInternal.put(
internalname2,
auctionPrice2 * count2 + mostExpensiveInternal.getOrDefault(internalname2, 0L)
);
- playerNetworth += auctionPrice2 * count2;
+ networth += auctionPrice2 * count2;
}
}
}
}
- } catch (final IOException ignored) {
+ } catch (IOException ignored) {
}
int count = 1;
@@ -1001,68 +1007,56 @@ public class ProfileViewer {
internalname,
auctionPrice * count + mostExpensiveInternal.getOrDefault(internalname, 0L)
);
- playerNetworth += auctionPrice * count;
+ networth += auctionPrice * count;
}
}
}
}
- if (playerNetworth == 0) return -1;
-
- playerNetworth = (int) (playerNetworth * 1.3f);
-
- final JsonObject petsInfo = getPetsInfo(profileName);
- if (petsInfo != null && petsInfo.has("pets") && petsInfo.get("pets").isJsonArray()) {
- final JsonArray pets = petsInfo.get("pets").getAsJsonArray();
- for (final JsonElement element : pets) {
- if (element.isJsonObject()) {
- final JsonObject pet = element.getAsJsonObject();
-
- final String petname = pet.get("type").getAsString();
- final String tier = pet.get("tier").getAsString();
- final String tierNum = petRarityToNumMap.get(tier);
- if (tierNum != null) {
- final String internalname2 = petname + ";" + tierNum;
- final JsonObject info2 = manager.auctionManager.getItemAuctionInfo(internalname2);
- if (info2 == null || !info2.has("price") || !info2.has("count")) continue;
- final int auctionPrice2 = (int) (info2.get("price").getAsFloat() / info2.get("count").getAsFloat());
-
- playerNetworth += auctionPrice2;
+ if (networth == 0) return -1;
+
+ networth = (int) (networth * 1.3f);
+
+ JsonObject petsInfo = getPetsInfo(profileName);
+ if (petsInfo != null && petsInfo.has("pets")) {
+ if (petsInfo.get("pets").isJsonArray()) {
+ JsonArray pets = petsInfo.get("pets").getAsJsonArray();
+ for (JsonElement element : pets) {
+ if (element.isJsonObject()) {
+ JsonObject pet = element.getAsJsonObject();
+
+ String petname = pet.get("type").getAsString();
+ String tier = pet.get("tier").getAsString();
+ String tierNum = petRarityToNumMap.get(tier);
+ if (tierNum != null) {
+ String internalname2 = petname + ";" + tierNum;
+ JsonObject info2 = manager.auctionManager.getItemAuctionInfo(internalname2);
+ if (info2 == null || !info2.has("price") || !info2.has("count")) continue;
+ int auctionPrice2 = (int) (info2.get("price").getAsFloat() / info2.get("count").getAsFloat());
+
+ networth += auctionPrice2;
+ }
}
}
}
}
- final float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), 0);
- final float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
+ float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), 0);
+ float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
- playerNetworth += bankBalance + purseBalance;
+ networth += bankBalance + purseBalance;
- networth.put(profileName, playerNetworth);
- return playerNetworth;
- }
-
- private long getAuctionPriceHelper(final String internalname) {
- final JsonObject bzInfo = manager.auctionManager.getBazaarInfo(internalname);
-
- if (bzInfo != null && bzInfo.has("curr_sell")) {
- return (int) bzInfo.get("curr_sell").getAsFloat();
- } else {
- final long auctionPrice = (long) manager.auctionManager.getItemAvgBin(internalname);
- if (auctionPrice <= 0) {
- return manager.auctionManager.getLowestBin(internalname);
- }
- return auctionPrice;
- }
+ this.networth.put(profileName, networth);
+ return networth;
}
public String getLatestProfile() {
return latestProfile;
}
- public JsonArray getSkyblockProfiles(final Runnable runnable) {
+ public JsonArray getSkyblockProfiles(Runnable runnable) {
if (skyblockProfiles != null) return skyblockProfiles;
- final long currentTime = System.currentTimeMillis();
+ long currentTime = System.currentTimeMillis();
if (currentTime - lastPlayerInfoState < 15 * 1000 && updatingSkyblockProfilesState.get()) return null;
lastPlayerInfoState = currentTime;
@@ -1083,21 +1077,22 @@ public class ProfileViewer {
profileNames.clear();
- for (final JsonElement profileEle : skyblockProfiles) {
- final JsonObject profile = profileEle.getAsJsonObject();
+ for (JsonElement profileEle : skyblockProfiles) {
+ JsonObject profile = profileEle.getAsJsonObject();
if (!profile.has("members")) continue;
- final JsonObject members = profile.get("members").getAsJsonObject();
+ JsonObject members = profile.get("members").getAsJsonObject();
if (members.has(uuid)) {
- final JsonObject member = members.get(uuid).getAsJsonObject();
+ JsonObject member = members.get(uuid).getAsJsonObject();
- if (member.has("coop_invitation") &&
- !member.get("coop_invitation").getAsJsonObject().get("confirmed").getAsBoolean()) {
- continue;
+ if (member.has("coop_invitation")) {
+ if (!member.get("coop_invitation").getAsJsonObject().get("confirmed").getAsBoolean()) {
+ continue;
+ }
}
- final String cuteName = profile.get("cute_name").getAsString();
+ String cuteName = profile.get("cute_name").getAsString();
profileNames.add(cuteName);
if (profile.has("selected") && profile.get("selected").getAsBoolean()) {
lastCuteName = cuteName;
@@ -1113,10 +1108,10 @@ public class ProfileViewer {
return null;
}
- public JsonObject getGuildInformation(final Runnable runnable) {
+ public JsonObject getGuildInformation(Runnable runnable) {
if (guildInformation != null) return guildInformation;
- final long currentTime = System.currentTimeMillis();
+ long currentTime = System.currentTimeMillis();
if (currentTime - lastGuildInfoState < 15 * 1000 && updatingGuildInfoState.get()) return null;
lastGuildInfoState = currentTime;
@@ -1146,7 +1141,7 @@ public class ProfileViewer {
}
public JsonObject getProfileInformation(String profileName) {
- final JsonArray playerInfo = getSkyblockProfiles(() -> {});
+ JsonArray playerInfo = getSkyblockProfiles(() -> {});
if (playerInfo == null) return null;
if (profileName == null) profileName = latestProfile;
if (profileMap.containsKey(profileName)) return profileMap.get(profileName);
@@ -1156,12 +1151,12 @@ public class ProfileViewer {
skyblockProfiles = null;
return null;
}
- final JsonObject profile = skyblockProfiles.get(i).getAsJsonObject();
+ JsonObject profile = skyblockProfiles.get(i).getAsJsonObject();
if (profile.get("cute_name").getAsString().equalsIgnoreCase(profileName)) {
if (!profile.has("members")) return null;
- final JsonObject members = profile.get("members").getAsJsonObject();
+ JsonObject members = profile.get("members").getAsJsonObject();
if (!members.has(uuid)) continue;
- final JsonObject profileInfo = members.get(uuid).getAsJsonObject();
+ JsonObject profileInfo = members.get(uuid).getAsJsonObject();
if (profile.has("banking")) {
profileInfo.add("banking", profile.get("banking").getAsJsonObject());
}
@@ -1177,25 +1172,25 @@ public class ProfileViewer {
}
public List<JsonObject> getCoopProfileInformation(String profileName) {
- final JsonArray playerInfo = getSkyblockProfiles(() -> {});
- if (playerInfo == null) return Collections.emptyList();
+ JsonArray playerInfo = getSkyblockProfiles(() -> {});
+ if (playerInfo == null) return null;
if (profileName == null) profileName = latestProfile;
if (coopProfileMap.containsKey(profileName)) return coopProfileMap.get(profileName);
for (int i = 0; i < skyblockProfiles.size(); i++) {
if (!skyblockProfiles.get(i).isJsonObject()) {
skyblockProfiles = null;
- return Collections.emptyList();
+ return null;
}
- final JsonObject profile = skyblockProfiles.get(i).getAsJsonObject();
+ JsonObject profile = skyblockProfiles.get(i).getAsJsonObject();
if (profile.get("cute_name").getAsString().equalsIgnoreCase(profileName)) {
- if (!profile.has("members")) return Collections.emptyList();
- final JsonObject members = profile.get("members").getAsJsonObject();
- if (!members.has(uuid)) return Collections.emptyList();
- final List<JsonObject> coopList = new ArrayList<>();
- for (final Map.Entry<String, JsonElement> islandMember : members.entrySet()) {
+ if (!profile.has("members")) return null;
+ JsonObject members = profile.get("members").getAsJsonObject();
+ if (!members.has(uuid)) return null;
+ List<JsonObject> coopList = new ArrayList<>();
+ for (Map.Entry<String, JsonElement> islandMember : members.entrySet()) {
if (!islandMember.getKey().equals(uuid)) {
- final JsonObject coopProfileInfo = islandMember.getValue().getAsJsonObject();
+ JsonObject coopProfileInfo = islandMember.getValue().getAsJsonObject();
coopList.add(coopProfileInfo);
}
}
@@ -1204,7 +1199,7 @@ public class ProfileViewer {
}
}
- return Collections.emptyList();
+ return null;
}
public void resetCache() {
@@ -1223,30 +1218,30 @@ public class ProfileViewer {
networth.clear();
}
- public int getCap(final JsonObject leveling, final String skillName) {
- final JsonElement capsElement = Utils.getElement(leveling, "leveling_caps");
+ public int getCap(JsonObject leveling, String skillName) {
+ JsonElement capsElement = Utils.getElement(leveling, "leveling_caps");
return capsElement != null && capsElement.isJsonObject() && capsElement.getAsJsonObject().has(skillName)
? capsElement.getAsJsonObject().get(skillName).getAsInt()
: 50;
}
public Map<String, Level> getSkyblockInfo(String profileName) {
- final JsonObject profileInfo = getProfileInformation(profileName);
+ JsonObject profileInfo = getProfileInformation(profileName);
- if (profileInfo == null) return Collections.emptyMap();
+ if (profileInfo == null) return null;
if (profileName == null) profileName = latestProfile;
- final List<JsonObject> coopProfileInfo = getCoopProfileInformation(profileName);
+ List<JsonObject> coopProfileInfo = getCoopProfileInformation(profileName);
if (skyblockInfoCache.containsKey(profileName)) return skyblockInfoCache.get(profileName);
- final JsonObject leveling = Constants.LEVELING;
+ JsonObject leveling = Constants.LEVELING;
if (leveling == null || !leveling.has("social")) {
Utils.showOutdatedRepoNotification();
- return Collections.emptyMap();
+ return null;
}
- final Map<String, Level> out = new HashMap<>();
+ Map<String, Level> out = new HashMap<>();
- final List<String> skills = Arrays.asList(
+ List<String> skills = Arrays.asList(
"taming",
"mining",
"foraging",
@@ -1260,14 +1255,14 @@ public class ProfileViewer {
"social"
);
float totalSkillXP = 0;
- for (final String skillName : skills) {
+ for (String skillName : skills) {
float skillExperience = Utils.getElementAsFloat(
Utils.getElement(profileInfo, "experience_skill_" + (skillName.equals("social") ? "social2" : skillName)),
0
);
// Get the coop's social skill experience since social is a shared skill
if (skillName.equals("social")) {
- for (final JsonObject coopProfile : coopProfileInfo) {
+ for (JsonObject coopProfile : coopProfileInfo) {
skillExperience += Utils.getElementAsFloat(
Utils.getElement(coopProfile, "experience_skill_social2"),
0
@@ -1283,7 +1278,7 @@ public class ProfileViewer {
levelingArray = Utils.getElement(leveling, "social").getAsJsonArray();
}
- final int maxLevel =
+ int maxLevel =
getCap(leveling, skillName) +
(
skillName.equals("farming")
@@ -1295,7 +1290,7 @@ public class ProfileViewer {
// Skills API disabled?
if (totalSkillXP <= 0) {
- return Collections.emptyMap();
+ return null;
}
out.put(
@@ -1318,9 +1313,9 @@ public class ProfileViewer {
)
);
- final List<String> dungeonClasses = Arrays.asList("healer", "tank", "mage", "archer", "berserk");
- for (final String className : dungeonClasses) {
- final float classExperience = Utils.getElementAsFloat(
+ List<String> dungeonClasses = Arrays.asList("healer", "tank", "mage", "archer", "berserk");
+ for (String className : dungeonClasses) {
+ float classExperience = Utils.getElementAsFloat(
Utils.getElement(profileInfo, "dungeons.player_classes." + className + ".experience"),
0
);
@@ -1335,9 +1330,9 @@ public class ProfileViewer {
);
}
- final List<String> slayers = Arrays.asList("zombie", "spider", "wolf", "enderman", "blaze");
- for (final String slayerName : slayers) {
- final float slayerExperience = Utils.getElementAsFloat(Utils.getElement(
+ List<String> slayers = Arrays.asList("zombie", "spider", "wolf", "enderman", "blaze");
+ for (String slayerName : slayers) {
+ float slayerExperience = Utils.getElementAsFloat(Utils.getElement(
profileInfo,
"slayer_bosses." + slayerName + ".xp"
), 0);
@@ -1353,64 +1348,64 @@ public class ProfileViewer {
}
public JsonObject getInventoryInfo(String profileName) {
- final JsonObject profileInfo = getProfileInformation(profileName);
+ JsonObject profileInfo = getProfileInformation(profileName);
if (profileInfo == null) return null;
if (profileName == null) profileName = latestProfile;
if (inventoryCacheMap.containsKey(profileName)) return inventoryCacheMap.get(profileName);
- final String inv_armor_bytes = Utils.getElementAsString(
+ String inv_armor_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "inv_armor.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final String fishing_bag_bytes = Utils.getElementAsString(
+ String fishing_bag_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "fishing_bag.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final String quiver_bytes = Utils.getElementAsString(
+ String quiver_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "quiver.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final String ender_chest_contents_bytes = Utils.getElementAsString(
+ String ender_chest_contents_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "ender_chest_contents.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
//Todo clean this up
//Fake string is so for I loop works the same
- final String backpack_contents_json_fake = "fake should fix later";
- final JsonObject backpack_contents_json = (JsonObject) Utils.getElement(profileInfo, "backpack_contents");
- final JsonObject backpack_icons = (JsonObject) Utils.getElement(profileInfo, "backpack_icons");
- final String personal_vault_contents_bytes = Utils.getElementAsString(
+ String backpack_contents_json_fake = "fake should fix later";
+ JsonObject backpack_contents_json = (JsonObject) Utils.getElement(profileInfo, "backpack_contents");
+ JsonObject backpack_icons = (JsonObject) Utils.getElement(profileInfo, "backpack_icons");
+ String personal_vault_contents_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "personal_vault_contents.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final String wardrobe_contents_bytes = Utils.getElementAsString(
+ String wardrobe_contents_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "wardrobe_contents.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final String potion_bag_bytes = Utils.getElementAsString(
+ String potion_bag_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "potion_bag.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final String inv_contents_bytes = Utils.getElementAsString(
+ String inv_contents_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "inv_contents.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final String talisman_bag_bytes = Utils.getElementAsString(
+ String talisman_bag_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "talisman_bag.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final String candy_inventory_contents_bytes = Utils.getElementAsString(
+ String candy_inventory_contents_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "candy_inventory_contents.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final String equipment_contents_bytes = Utils.getElementAsString(
+ String equipment_contents_bytes = Utils.getElementAsString(
Utils.getElement(profileInfo, "equippment_contents.data"),
"Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
);
- final JsonObject inventoryInfo = new JsonObject();
+ JsonObject inventoryInfo = new JsonObject();
- final String[] inv_names = new String[]{
+ String[] inv_names = new String[]{
"inv_armor",
"fishing_bag",
"quiver",
@@ -1424,7 +1419,7 @@ public class ProfileViewer {
"candy_inventory_contents",
"equippment_contents",
};
- final String[] inv_bytes = new String[]{
+ String[] inv_bytes = new String[]{
inv_armor_bytes,
fishing_bag_bytes,
quiver_bytes,
@@ -1440,26 +1435,26 @@ public class ProfileViewer {
};
for (int i = 0; i < inv_bytes.length; i++) {
try {
- final String bytes = inv_bytes[i];
+ String bytes = inv_bytes[i];
JsonArray contents = new JsonArray();
if (inv_names[i].equals("backpack_contents")) {
- final JsonObject temp = getBackpackData(backpack_contents_json, backpack_icons);
+ JsonObject temp = getBackpackData(backpack_contents_json, backpack_icons);
contents = (JsonArray) temp.get("contents");
inventoryInfo.add("backpack_sizes", temp.get("backpack_sizes"));
} else {
- final NBTTagCompound inv_contents_nbt = CompressedStreamTools.readCompressed(
+ NBTTagCompound inv_contents_nbt = CompressedStreamTools.readCompressed(
new ByteArrayInputStream(Base64.getDecoder().decode(bytes))
);
- final NBTTagList items = inv_contents_nbt.getTagList("i", 10);
+ NBTTagList items = inv_contents_nbt.getTagList("i", 10);
for (int j = 0; j < items.tagCount(); j++) {
- final JsonObject item = manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
+ JsonObject item = manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
contents.add(item);
}
}
inventoryInfo.add(inv_names[i], contents);
- } catch (final IOException e) {
+ } catch (IOException e) {
inventoryInfo.add(inv_names[i], new JsonArray());
}
}
@@ -1469,9 +1464,9 @@ public class ProfileViewer {
return inventoryInfo;
}
- public JsonObject getBackpackData(final JsonObject backpackContentsJson, final JsonObject backpackIcons) {
+ public JsonObject getBackpackData(JsonObject backpackContentsJson, JsonObject backpackIcons) {
if (backpackContentsJson == null || backpackIcons == null) {
- final JsonObject bundledReturn = new JsonObject();
+ JsonObject bundledReturn = new JsonObject();
bundledReturn.add("contents", new JsonArray());
bundledReturn.add("backpack_sizes", new JsonArray());
@@ -1481,13 +1476,10 @@ public class ProfileViewer {
String[] backpackArray = new String[0];
//Create backpack array which sizes up
- for (final Map.Entry<String, JsonElement> backpackIcon : backpackIcons.entrySet()) {
+ for (Map.Entry<String, JsonElement> backpackIcon : backpackIcons.entrySet()) {
if (backpackIcon.getValue() instanceof JsonObject) {
- final JsonObject backpackData = (JsonObject) backpackContentsJson.get(backpackIcon.getKey());
- final String bytes = Utils.getElementAsString(
- backpackData.get("data"),
- "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="
- );
+ JsonObject backpackData = (JsonObject) backpackContentsJson.get(backpackIcon.getKey());
+ String bytes = Utils.getElementAsString(backpackData.get("data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
backpackArray = growArray(bytes, Integer.parseInt(backpackIcon.getKey()), backpackArray);
}
}
@@ -1495,9 +1487,9 @@ public class ProfileViewer {
//reduce backpack array to filter out not existent backpacks
{
String[] tempBackpackArray = new String[0];
- for (final String s : backpackArray) {
+ for (String s : backpackArray) {
if (s != null) {
- final String[] veryTempBackpackArray = new String[tempBackpackArray.length + 1];
+ String[] veryTempBackpackArray = new String[tempBackpackArray.length + 1];
System.arraycopy(tempBackpackArray, 0, veryTempBackpackArray, 0, tempBackpackArray.length);
veryTempBackpackArray[veryTempBackpackArray.length - 1] = s;
@@ -1507,54 +1499,54 @@ public class ProfileViewer {
backpackArray = tempBackpackArray;
}
- final JsonArray backpackSizes = new JsonArray();
- final JsonArray contents = new JsonArray();
+ JsonArray backpackSizes = new JsonArray();
+ JsonArray contents = new JsonArray();
- for (final String backpack : backpackArray) {
+ for (String backpack : backpackArray) {
try {
- final NBTTagCompound inv_contents_nbt = CompressedStreamTools.readCompressed(
+ NBTTagCompound inv_contents_nbt = CompressedStreamTools.readCompressed(
new ByteArrayInputStream(Base64.getDecoder().decode(backpack))
);
- final NBTTagList items = inv_contents_nbt.getTagList("i", 10);
+ NBTTagList items = inv_contents_nbt.getTagList("i", 10);
backpackSizes.add(new JsonPrimitive(items.tagCount()));
for (int j = 0; j < items.tagCount(); j++) {
- final JsonObject item = manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
+ JsonObject item = manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
contents.add(item);
}
- } catch (final IOException ignored) {
+ } catch (IOException ignored) {
}
}
- final JsonObject bundledReturn = new JsonObject();
+ JsonObject bundledReturn = new JsonObject();
bundledReturn.add("contents", contents);
bundledReturn.add("backpack_sizes", backpackSizes);
return bundledReturn;
}
- public String[] growArray(final String bytes, final int index, final String[] oldArray) {
- final int newSize = Math.max(index + 1, oldArray.length);
+ public String[] growArray(String bytes, int index, String[] oldArray) {
+ int newSize = Math.max(index + 1, oldArray.length);
- final String[] newArray = new String[newSize];
+ String[] newArray = new String[newSize];
System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
newArray[index] = bytes;
return newArray;
}
- public JsonObject getPetsInfo(final String profileName) {
- final JsonObject profileInfo = getProfileInformation(profileName);
+ public JsonObject getPetsInfo(String profileName) {
+ JsonObject profileInfo = getProfileInformation(profileName);
if (profileInfo == null) return null;
if (petsInfoMap.containsKey(profileName)) return petsInfoMap.get(profileName);
- final JsonObject petsInfo = new JsonObject();
- final JsonElement petsElement = profileInfo.get("pets");
+ JsonObject petsInfo = new JsonObject();
+ JsonElement petsElement = profileInfo.get("pets");
if (petsElement != null && petsElement.isJsonArray()) {
JsonObject activePet = null;
- final JsonArray pets = petsElement.getAsJsonArray();
+ JsonArray pets = petsElement.getAsJsonArray();
for (int i = 0; i < pets.size(); i++) {
- final JsonObject pet = pets.get(i).getAsJsonObject();
+ JsonObject pet = pets.get(i).getAsJsonObject();
if (pet.has("active") && pet.get("active").getAsBoolean()) {
activePet = pet;
break;
@@ -1569,46 +1561,46 @@ public class ProfileViewer {
}
public JsonObject getCollectionInfo(String profileName) {
- final JsonObject profileInfo = getProfileInformation(profileName);
+ JsonObject profileInfo = getProfileInformation(profileName);
if (profileInfo == null) return null;
- final JsonObject resourceCollectionInfo = getResourceCollectionInformation();
+ JsonObject resourceCollectionInfo = getResourceCollectionInformation();
if (resourceCollectionInfo == null) return null;
if (profileName == null) profileName = latestProfile;
if (collectionInfoMap.containsKey(profileName)) return collectionInfoMap.get(profileName);
- final List<JsonObject> coopMembers = getCoopProfileInformation(profileName);
- final JsonElement unlocked_coll_tiers_element = Utils.getElement(profileInfo, "unlocked_coll_tiers");
- final JsonElement crafted_generators_element = Utils.getElement(profileInfo, "crafted_generators");
- final JsonObject fakeMember = new JsonObject();
+ List<JsonObject> coopMembers = getCoopProfileInformation(profileName);
+ JsonElement unlocked_coll_tiers_element = Utils.getElement(profileInfo, "unlocked_coll_tiers");
+ JsonElement crafted_generators_element = Utils.getElement(profileInfo, "crafted_generators");
+ JsonObject fakeMember = new JsonObject();
fakeMember.add("crafted_generators", crafted_generators_element);
coopMembers.add(coopMembers.size(), fakeMember);
- final JsonElement collectionInfoElement = Utils.getElement(profileInfo, "collection");
+ JsonElement collectionInfoElement = Utils.getElement(profileInfo, "collection");
if (unlocked_coll_tiers_element == null || collectionInfoElement == null) {
return null;
}
- final JsonObject collectionInfo = new JsonObject();
- final JsonObject collectionTiers = new JsonObject();
- final JsonObject minionTiers = new JsonObject();
+ JsonObject collectionInfo = new JsonObject();
+ JsonObject collectionTiers = new JsonObject();
+ JsonObject minionTiers = new JsonObject();
JsonObject personalAmounts = new JsonObject();
- final JsonObject totalAmounts = new JsonObject();
+ JsonObject totalAmounts = new JsonObject();
if (collectionInfoElement.isJsonObject()) {
personalAmounts = collectionInfoElement.getAsJsonObject();
}
- for (final Map.Entry<String, JsonElement> entry : personalAmounts.entrySet()) {
+ for (Map.Entry<String, JsonElement> entry : personalAmounts.entrySet()) {
totalAmounts.addProperty(entry.getKey(), entry.getValue().getAsLong());
}
- final List<JsonObject> coopProfiles = getCoopProfileInformation(profileName);
+ List<JsonObject> coopProfiles = getCoopProfileInformation(profileName);
if (coopProfiles != null) {
- for (final JsonObject coopProfile : coopProfiles) {
- final JsonElement coopCollectionInfoElement = Utils.getElement(coopProfile, "collection");
+ for (JsonObject coopProfile : coopProfiles) {
+ JsonElement coopCollectionInfoElement = Utils.getElement(coopProfile, "collection");
if (coopCollectionInfoElement != null && coopCollectionInfoElement.isJsonObject()) {
- for (final Map.Entry<String, JsonElement> entry : coopCollectionInfoElement.getAsJsonObject().entrySet()) {
- final float existing = Utils.getElementAsFloat(totalAmounts.get(entry.getKey()), 0);
+ for (Map.Entry<String, JsonElement> entry : coopCollectionInfoElement.getAsJsonObject().entrySet()) {
+ float existing = Utils.getElementAsFloat(totalAmounts.get(entry.getKey()), 0);
totalAmounts.addProperty(entry.getKey(), existing + entry.getValue().getAsLong());
}
}
@@ -1616,36 +1608,34 @@ public class ProfileViewer {
}
if (unlocked_coll_tiers_element.isJsonArray()) {
- final JsonArray unlocked_coll_tiers = unlocked_coll_tiers_element.getAsJsonArray();
+ JsonArray unlocked_coll_tiers = unlocked_coll_tiers_element.getAsJsonArray();
for (int i = 0; i < unlocked_coll_tiers.size(); i++) {
- final String unlocked = unlocked_coll_tiers.get(i).getAsString();
+ String unlocked = unlocked_coll_tiers.get(i).getAsString();
- final Matcher matcher = COLL_TIER_PATTERN.matcher(unlocked);
+ Matcher matcher = COLL_TIER_PATTERN.matcher(unlocked);
if (matcher.find()) {
- final String tier_str = matcher.group(1);
- final int tier = Integer.parseInt(tier_str);
- final String coll = unlocked.substring(0, unlocked.length() - (matcher.group().length()));
+ String tier_str = matcher.group(1);
+ int tier = Integer.parseInt(tier_str);
+ String coll = unlocked.substring(0, unlocked.length() - (matcher.group().length()));
if (!collectionTiers.has(coll) || collectionTiers.get(coll).getAsInt() < tier) {
collectionTiers.addProperty(coll, tier);
}
}
}
}
- for (final JsonObject current_member_info : coopMembers) {
+ for (JsonObject current_member_info : coopMembers) {
if (
!current_member_info.has("crafted_generators") || !current_member_info.get("crafted_generators").isJsonArray()
) continue;
- final JsonArray crafted_generators = Utils
- .getElement(current_member_info, "crafted_generators")
- .getAsJsonArray();
+ JsonArray crafted_generators = Utils.getElement(current_member_info, "crafted_generators").getAsJsonArray();
for (int j = 0; j < crafted_generators.size(); j++) {
- final String unlocked = crafted_generators.get(j).getAsString();
- final Matcher matcher = COLL_TIER_PATTERN.matcher(unlocked);
+ String unlocked = crafted_generators.get(j).getAsString();
+ Matcher matcher = COLL_TIER_PATTERN.matcher(unlocked);
if (matcher.find()) {
- final String tierString = matcher.group(1);
- final int tier = Integer.parseInt(tierString);
- final String coll = unlocked.substring(0, unlocked.length() - (matcher.group().length()));
+ String tierString = matcher.group(1);
+ int tier = Integer.parseInt(tierString);
+ String coll = unlocked.substring(0, unlocked.length() - (matcher.group().length()));
if (!minionTiers.has(coll) || minionTiers.get(coll).getAsInt() < tier) {
minionTiers.addProperty(coll, tier);
}
@@ -1653,24 +1643,24 @@ public class ProfileViewer {
}
}
- final JsonObject maxAmount = new JsonObject();
- final JsonObject updatedCollectionTiers = new JsonObject();
- for (final Map.Entry<String, JsonElement> totalAmountsEntry : totalAmounts.entrySet()) {
- final String collName = totalAmountsEntry.getKey();
- final int collTier = (int) Utils.getElementAsFloat(collectionTiers.get(collName), 0);
+ JsonObject maxAmount = new JsonObject();
+ JsonObject updatedCollectionTiers = new JsonObject();
+ for (Map.Entry<String, JsonElement> totalAmountsEntry : totalAmounts.entrySet()) {
+ String collName = totalAmountsEntry.getKey();
+ int collTier = (int) Utils.getElementAsFloat(collectionTiers.get(collName), 0);
- final int currentAmount = (int) Utils.getElementAsFloat(totalAmounts.get(collName), 0);
+ int currentAmount = (int) Utils.getElementAsFloat(totalAmounts.get(collName), 0);
if (currentAmount > 0) {
- for (final Map.Entry<String, JsonElement> resourceEntry : resourceCollectionInfo.entrySet()) {
- final JsonElement tiersElement = Utils.getElement(resourceEntry.getValue(), "items." + collName + ".tiers");
+ for (Map.Entry<String, JsonElement> resourceEntry : resourceCollectionInfo.entrySet()) {
+ JsonElement tiersElement = Utils.getElement(resourceEntry.getValue(), "items." + collName + ".tiers");
if (tiersElement != null && tiersElement.isJsonArray()) {
- final JsonArray tiers = tiersElement.getAsJsonArray();
+ JsonArray tiers = tiersElement.getAsJsonArray();
int maxTierAcquired = -1;
int maxAmountRequired = -1;
for (int i = 0; i < tiers.size(); i++) {
- final JsonObject tierInfo = tiers.get(i).getAsJsonObject();
- final int tier = tierInfo.get("tier").getAsInt();
- final int amountRequired = tierInfo.get("amountRequired").getAsInt();
+ JsonObject tierInfo = tiers.get(i).getAsJsonObject();
+ int tier = tierInfo.get("tier").getAsInt();
+ int amountRequired = tierInfo.get("amountRequired").getAsInt();
if (currentAmount >= amountRequired) {
maxTierAcquired = tier;
}
@@ -1685,7 +1675,7 @@ public class ProfileViewer {
}
}
- for (final Map.Entry<String, JsonElement> collectionTiersEntry : updatedCollectionTiers.entrySet()) {
+ for (Map.Entry<String, JsonElement> collectionTiersEntry : updatedCollectionTiers.entrySet()) {
collectionTiers.add(collectionTiersEntry.getKey(), collectionTiersEntry.getValue());
}
@@ -1700,42 +1690,39 @@ public class ProfileViewer {
return collectionInfo;
}
- public PlayerStats.Stats getPassiveStats(final String profileName) {
+ public PlayerStats.Stats getPassiveStats(String profileName) {
if (passiveStats.get(profileName) != null) return passiveStats.get(profileName);
- final JsonObject profileInfo = getProfileInformation(profileName);
+ JsonObject profileInfo = getProfileInformation(profileName);
if (profileInfo == null) return null;
- final PlayerStats.Stats passivePlayerStats = PlayerStats.getPassiveBonuses(
- getSkyblockInfo(profileName),
- profileInfo
- );
+ PlayerStats.Stats passiveStats = PlayerStats.getPassiveBonuses(getSkyblockInfo(profileName), profileInfo);
- if (passivePlayerStats != null) {
- passivePlayerStats.add(PlayerStats.getBaseStats());
+ if (passiveStats != null) {
+ passiveStats.add(PlayerStats.getBaseStats());
}
- passiveStats.put(profileName, passivePlayerStats);
+ this.passiveStats.put(profileName, passiveStats);
- return passivePlayerStats;
+ return passiveStats;
}
- public PlayerStats.Stats getStats(final String profileName) {
+ public PlayerStats.Stats getStats(String profileName) {
if (stats.get(profileName) != null) return stats.get(profileName);
- final JsonObject profileInfo = getProfileInformation(profileName);
+ JsonObject profileInfo = getProfileInformation(profileName);
if (profileInfo == null) {
return null;
}
- final PlayerStats.Stats playerStats = PlayerStats.getStats(
+ PlayerStats.Stats stats = PlayerStats.getStats(
getSkyblockInfo(profileName),
getInventoryInfo(profileName),
getCollectionInfo(profileName),
getPetsInfo(profileName),
profileInfo
);
- if (playerStats == null) return null;
- stats.put(profileName, playerStats);
- return playerStats;
+ if (stats == null) return null;
+ this.stats.put(profileName, stats);
+ return stats;
}
public String getUuid() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java
index 004ea372..bd45f3e1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.recipes;
import io.github.moulberry.notenoughupdates.NEUManager;
+import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -114,6 +115,8 @@ public class CraftingOverlay {
if (!Keyboard.getEventKeyState() ||
(Keyboard.getEventKey() != Keyboard.KEY_U && Keyboard.getEventKey() != Keyboard.KEY_R))
return;
+ if (EnchantingSolvers.currentSolver != EnchantingSolvers.SolverType.NONE) return;
+
runIfCraftingOverlayIsPresent(event.gui, (guiChest, chest) -> {
int mouseX = Utils.getMouseX();
int mouseY = Utils.getMouseY();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
index 0105ba1f..6b1bef26 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
@@ -30,6 +30,7 @@ import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent;
import io.github.moulberry.notenoughupdates.recipes.EssenceUpgrades;
import io.github.moulberry.notenoughupdates.recipes.NeuRecipe;
@@ -40,6 +41,7 @@ import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Pattern;
+@NEUAutoSubscribe
public class Constants {
private static class PatternSerializer implements JsonDeserializer<Pattern>, JsonSerializer<Pattern> {
@Override
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index ec7ec404..8ce765aa 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -22,6 +22,7 @@ package io.github.moulberry.notenoughupdates.util;
import com.google.common.reflect.TypeToken;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.listener.ScoreboardLocationChangeListener;
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager;
@@ -65,6 +66,7 @@ import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@NEUAutoSubscribe
public class SBInfo {
private static final SBInfo INSTANCE = new SBInfo();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/TitleUtil.java b/src/main/java/io/github/moulberry/notenoughupdates/util/TitleUtil.java
index 59db7cac..71b4e8dc 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/TitleUtil.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/TitleUtil.java
@@ -20,6 +20,7 @@
package io.github.moulberry.notenoughupdates.util;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
@@ -27,6 +28,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+@NEUAutoSubscribe
public class TitleUtil {
private static final TitleUtil INSTANCE = new TitleUtil();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
index 81eea343..94bfbee8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
@@ -22,6 +22,7 @@ package io.github.moulberry.notenoughupdates.util;
import com.google.common.base.Splitter;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
@@ -34,6 +35,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@NEUAutoSubscribe
public class XPInformation {
private static final XPInformation INSTANCE = new XPInformation();
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt
index e9327ac3..7351a4a0 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt
@@ -21,6 +21,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures
import com.google.gson.JsonElement
import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent
import io.github.moulberry.notenoughupdates.util.NotificationHandler
import io.github.moulberry.notenoughupdates.util.Shimmy
@@ -31,6 +32,7 @@ import net.minecraftforge.client.event.GuiOpenEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
+@NEUAutoSubscribe
object EnforcedConfigValues {
class EnforcedValue {
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt
index 56f84d54..99066e52 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt
@@ -23,7 +23,9 @@ import com.google.gson.JsonObject
import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay.Rarity
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+@NEUAutoSubscribe
object PetLeveling {
data class ExpLadder(
@@ -100,7 +102,7 @@ object PetLeveling {
val petConstants = this.petConstants ?: Constants.PETS ?: return stubExpLadder
var levels = petConstants["pet_levels"]?.asJsonArray?.map { it.asLong }?.toMutableList() ?: return stubExpLadder
val customLeveling = petConstants["custom_pet_leveling"]?.asJsonObject?.get(petIdWithoutRarity)
- val offset = petConstants["pet_rarity_offset"]?.asJsonObject?.get(rarity.name)?.asInt ?: return stubExpLadder
+ var rarityOffsets = petConstants["pet_rarity_offset"]?.asJsonObject
var maxLevel = 100
if (customLeveling is JsonObject) {
val customLevels by lazy { customLeveling["pet_levels"]?.asJsonArray?.map { it.asLong } }
@@ -109,7 +111,10 @@ object PetLeveling {
2 -> levels = customLevels?.toMutableList() ?: return stubExpLadder
}
maxLevel = customLeveling["max_level"]?.asInt ?: maxLevel
+ rarityOffsets = customLeveling["rarity_offset"]?.asJsonObject ?: rarityOffsets
}
+ val offset = rarityOffsets?.get(rarity.name)?.asInt ?: return stubExpLadder
+
return ExpLadder(levels.drop(offset).take(maxLevel - 1))
}
diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json
index d080d7f5..8877aed8 100644
--- a/src/main/resources/mixins.notenoughupdates.json
+++ b/src/main/resources/mixins.notenoughupdates.json
@@ -23,6 +23,7 @@
"MixinGuiIngame",
"MixinGuiInventory",
"MixinGuiScreen",
+ "MixinGuiUtils",
"MixinInventoryBasic",
"MixinInventoryEffectRenderer",
"MixinInventoryPlayer",
@@ -55,6 +56,7 @@
"MixinEntityChargedCreeper",
"MixinGuiEditSign",
"MixinGuiTextField",
+ "MixinLayerDeadmau5Head",
"MixinThreadDownloadImageData",
"MixinThreadDownloadImageDataThread"
]
diff --git a/src/test/kotlin/io/github/moulberry/notenoughupdates/util/PetLevelingTest.kt b/src/test/kotlin/io/github/moulberry/notenoughupdates/util/PetLevelingTest.kt
index d91ca09d..870b7e59 100644
--- a/src/test/kotlin/io/github/moulberry/notenoughupdates/util/PetLevelingTest.kt
+++ b/src/test/kotlin/io/github/moulberry/notenoughupdates/util/PetLevelingTest.kt
@@ -265,6 +265,16 @@ internal class PetLevelingTest {
1886700
],
"max_level": 200
+ },
+ "BINGO": {
+ "rarity_offset": {
+ "COMMON": 0,
+ "UNCOMMON": 0,
+ "RARE": 0,
+ "EPIC": 0,
+ "LEGENDARY": 0,
+ "MYTHIC": 0
+ }
}
},
"pet_types": {
@@ -357,6 +367,14 @@ internal class PetLevelingTest {
}
@Test
+ fun testBingoPetsLevelLikeCommon() {
+ val levelingC = PetLeveling.getPetLevelingForPet0("BINGO", PetInfoOverlay.Rarity.COMMON)
+ val levelingE = PetLeveling.getPetLevelingForPet0("BINGO", PetInfoOverlay.Rarity.EPIC)
+ Assertions.assertEquals(levelingC.getPetLevel(67790664.0), levelingE.getPetLevel(67790664.0))
+ }
+
+
+ @Test
fun testPetLevelGrandmaWolf() {
val leveling = PetLeveling.getPetLevelingForPet0("GRANDMA_WOLF", PetInfoOverlay.Rarity.LEGENDARY)
val level = leveling.getPetLevel(22_500_000.0)