aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-10-07 20:11:04 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-10-07 20:11:04 +0200
commit149c2827f5bcfbe4ff8c18eed8558bf7e58fdfe0 (patch)
treed04e5009d6af4c81c6bcefd5afb077822263ea7c
parentf51a6dd27548474d6152377595bf6dc2c9eac436 (diff)
parent98ec7b09eec00e57632a92a0f9245dc755d386ae (diff)
downloadNotEnoughUpdates-149c2827f5bcfbe4ff8c18eed8558bf7e58fdfe0.tar.gz
NotEnoughUpdates-149c2827f5bcfbe4ff8c18eed8558bf7e58fdfe0.tar.bz2
NotEnoughUpdates-149c2827f5bcfbe4ff8c18eed8558bf7e58fdfe0.zip
Merge branch 'master' into minion_helper_2
# Conflicts: # build.gradle.kts # src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
-rw-r--r--build.gradle.kts82
-rw-r--r--buildSrc/build.gradle.kts26
-rw-r--r--buildSrc/src/main/kotlin/neubs/buildflags.kt56
-rw-r--r--buildSrc/src/main/kotlin/neubs/publishing.kt62
-rw-r--r--buildSrc/src/main/kotlin/neubs/versioning.kt54
-rw-r--r--jitpack.yml4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/MoulConfigGuiForgeInterop.java69
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java51
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java32
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java110
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java200
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java155
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java70
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java82
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java4
-rw-r--r--src/main/resources/META-INF/mods.toml2
-rw-r--r--src/main/resources/fabric.mod.json2
28 files changed, 613 insertions, 543 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 6e88fb3b..deb740f5 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -18,9 +18,9 @@
*/
-import java.io.ByteArrayOutputStream
-import java.nio.charset.StandardCharsets
-import java.util.*
+import neubs.NEUBuildFlags
+import neubs.applyPublishingInformation
+import neubs.setVersionFromEnvironment
plugins {
idea
@@ -28,42 +28,18 @@ plugins {
id("gg.essential.loom") version "0.10.0.+"
id("dev.architectury.architectury-pack200") version "0.1.3"
id("com.github.johnrengelman.shadow") version "7.1.2"
+ id("io.github.juuxel.loom-quiltflower") version "1.7.3"
+ `maven-publish`
}
+apply<NEUBuildFlags>()
+
// Build metadata
group = "io.github.moulberry"
-val baseVersion = "2.1"
-
-
-val buildExtra = mutableListOf<String>()
-val buildVersion = properties["BUILD_VERSION"] as? String
-if (buildVersion != null) buildExtra.add(buildVersion)
-if (properties["CI"] as? String == "true") buildExtra.add("ci")
-
-val stdout = ByteArrayOutputStream()
-val execResult = exec {
- commandLine("git", "describe", "--always", "--first-parent", "--abbrev=7")
- standardOutput = stdout
- isIgnoreExitValue = true
-}
-if (execResult.exitValue == 0) {
- buildExtra.add(String(stdout.toByteArray()).trim())
-}
-
-val gitDiffStdout = ByteArrayOutputStream()
-val gitDiffResult = exec {
- commandLine("git", "status", "--porcelain")
- standardOutput = gitDiffStdout
- isIgnoreExitValue = true
-}
-if (gitDiffStdout.toByteArray().isNotEmpty()) {
- buildExtra.add("dirty")
-}
-
-version = baseVersion + (if (buildExtra.isEmpty()) "" else buildExtra.joinToString(prefix = "+", separator = "."))
+setVersionFromEnvironment("2.1")
// Minecraft configuration:
loom {
@@ -103,6 +79,17 @@ val shadowImplementation by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}
+val shadowApi by configurations.creating {
+ configurations.implementation.get().extendsFrom(this)
+}
+
+val devEnv by configurations.creating {
+ configurations.runtimeClasspath.get().extendsFrom(this)
+ isCanBeResolved = false
+ isCanBeConsumed = false
+ isVisible = false
+}
+
dependencies {
minecraft("com.mojang:minecraft:1.8.9")
mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9")
@@ -112,17 +99,18 @@ dependencies {
isTransitive = false // Dependencies of mixin are already bundled by minecraft
}
annotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT")
- shadowImplementation("info.bliki.wiki:bliki-core:3.1.0")
+ shadowApi("info.bliki.wiki:bliki-core:3.1.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
testAnnotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT")
// modImplementation("io.github.notenoughupdates:MoulConfig:0.0.1")
- modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0")
+ devEnv("me.djtheredstoner:DevAuth-forge-legacy:1.1.0")
}
java {
+ withSourcesJar()
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
}
@@ -159,7 +147,7 @@ val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") {
tasks.shadowJar {
archiveClassifier.set("dep-dev")
- configurations = listOf(shadowImplementation)
+ configurations = listOf(shadowImplementation, shadowApi)
exclude("**/module-info.class", "LICENSE.txt")
dependencies {
exclude {
@@ -172,23 +160,9 @@ tasks.shadowJar {
tasks.assemble.get().dependsOn(remapJar)
-val generateBuildFlags by tasks.creating {
- outputs.upToDateWhen { false }
- val t = layout.buildDirectory.file("buildflags.properties")
- outputs.file(t)
- val props = project.properties.filter { (name, value) -> name.startsWith("neu.buildflags.") }
- doLast {
- val p = Properties()
- p.putAll(props)
- t.get().asFile.writer(StandardCharsets.UTF_8).use {
- p.store(it, "Store build time configuration for NEU")
- }
- }
-}
-
tasks.processResources {
- from(generateBuildFlags)
- filesMatching("mcmod.info") {
+ from(tasks["generateBuildFlags"])
+ filesMatching(listOf("mcmod.info", "fabric.mod.json", "META-INF/mods.toml")) {
expand(
"version" to project.version, "mcversion" to "1.8.9"
)
@@ -198,3 +172,9 @@ tasks.processResources {
sourceSets.main {
output.setResourcesDir(file("$buildDir/classes/java/main"))
}
+
+applyPublishingInformation(
+ "deobf" to tasks.jar,
+ "all" to tasks.remapJar,
+ "sources" to tasks["sourcesJar"],
+)
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
new file mode 100644
index 00000000..5afecadc
--- /dev/null
+++ b/buildSrc/build.gradle.kts
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2022 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-dsl`
+}
+
+repositories {
+ mavenCentral()
+}
diff --git a/buildSrc/src/main/kotlin/neubs/buildflags.kt b/buildSrc/src/main/kotlin/neubs/buildflags.kt
new file mode 100644
index 00000000..6b7ab489
--- /dev/null
+++ b/buildSrc/src/main/kotlin/neubs/buildflags.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2022 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 neubs
+
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.kotlin.dsl.the
+import java.nio.charset.StandardCharsets
+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")
+ }
+ }
+
+ }
+ }
+
+ class Extension(val props: Map<String, String>) {
+ fun bool(name: String) = props["$NEU_BUILDFLAGS_PREFIX$name"] == "true"
+ }
+}
+
+val Project.buildFlags: NEUBuildFlags.Extension
+ get() = the<NEUBuildFlags.Extension>()
diff --git a/buildSrc/src/main/kotlin/neubs/publishing.kt b/buildSrc/src/main/kotlin/neubs/publishing.kt
new file mode 100644
index 00000000..4f9979a1
--- /dev/null
+++ b/buildSrc/src/main/kotlin/neubs/publishing.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2022 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 neubs
+
+import org.gradle.api.Project
+import org.gradle.api.publish.PublishingExtension
+import org.gradle.api.publish.maven.MavenPublication
+import org.gradle.kotlin.dsl.configure
+import org.gradle.kotlin.dsl.create
+import org.gradle.kotlin.dsl.get
+
+fun Project.applyPublishingInformation(
+ vararg artifacts: Pair<String, Any>
+) {
+ this.configure<PublishingExtension> {
+ publications {
+ create<MavenPublication>("maven") {
+ for((name, source) in artifacts) {
+ artifact(source) {
+ classifier = name
+ }
+ }
+ pom {
+ name.set("NotEnoughUpdates")
+ description.set("A feature rich 1.8.9 Minecraft forge mod for Hypixel Skyblock")
+ licenses {
+ license {
+ name.set("GNU Lesser General Public License")
+ url.set("https://github.com/NotEnoughUpdates/NotEnoughUpdates/blob/master/COPYING.LESSER")
+ }
+ }
+ developers {
+ developer {
+ name.set("Moulberry")
+ }
+ developer {
+ name.set("The NotEnoughUpdates Contributors and Maintainers")
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/buildSrc/src/main/kotlin/neubs/versioning.kt b/buildSrc/src/main/kotlin/neubs/versioning.kt
new file mode 100644
index 00000000..254e0012
--- /dev/null
+++ b/buildSrc/src/main/kotlin/neubs/versioning.kt
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2022 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 neubs
+
+import org.gradle.api.Project
+import java.io.ByteArrayOutputStream
+
+fun Project.setVersionFromEnvironment(baseVersion: String) {
+ val buildExtra = mutableListOf<String>()
+ val buildVersion = properties["BUILD_VERSION"] as? String
+ if (buildVersion != null) buildExtra.add(buildVersion)
+ if (System.getenv("CI") == "true") buildExtra.add("ci")
+
+ val stdout = ByteArrayOutputStream()
+ val execResult = exec {
+ commandLine("git", "describe", "--always", "--first-parent", "--abbrev=7")
+ standardOutput = stdout
+ isIgnoreExitValue = true
+ }
+ if (execResult.exitValue == 0) {
+ buildExtra.add(String(stdout.toByteArray()).trim())
+ }
+
+ val gitDiffStdout = ByteArrayOutputStream()
+ val gitDiffResult = exec {
+ commandLine("git", "status", "--porcelain")
+ standardOutput = gitDiffStdout
+ isIgnoreExitValue = true
+ }
+ if (gitDiffStdout.toByteArray().isNotEmpty()) {
+ buildExtra.add("dirty")
+ }
+
+ version = baseVersion + (if (buildExtra.isEmpty()) "" else buildExtra.joinToString(prefix = "+", separator = "."))
+
+}
+
diff --git a/jitpack.yml b/jitpack.yml
new file mode 100644
index 00000000..6166e3d7
--- /dev/null
+++ b/jitpack.yml
@@ -0,0 +1,4 @@
+jdk:
+ - openjdk17
+env:
+ CI: true
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index f67c1f43..301aec26 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -35,8 +35,11 @@ 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.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.BazaarSacksProfit;
+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;
@@ -115,7 +118,9 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Set;
-@Mod(modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION, clientSideOnly = true)
+@Mod(
+ modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION, clientSideOnly = true, useMetadata = true,
+ guiFactory = "io.github.moulberry.notenoughupdates.core.config.MoulConfigGuiForgeInterop")
public class NotEnoughUpdates {
public static final String MODID = "notenoughupdates";
public static final String VERSION = "2.1.0-REL";
@@ -299,7 +304,10 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(new SignCalculator());
MinecraftForge.EVENT_BUS.register(TrophyRewardOverlay.getInstance());
MinecraftForge.EVENT_BUS.register(PowerStoneStatsDisplay.getInstance());
- MinecraftForge.EVENT_BUS.register(BazaarSacksProfit.getInstance());
+ MinecraftForge.EVENT_BUS.register(new AntiCoopAdd());
+ 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);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/MoulConfigGuiForgeInterop.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/MoulConfigGuiForgeInterop.java
new file mode 100644
index 00000000..40887e54
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/MoulConfigGuiForgeInterop.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2022 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.core.config;
+
+import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
+import io.github.moulberry.notenoughupdates.options.NEUConfigEditor;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraftforge.fml.client.IModGuiFactory;
+import org.lwjgl.input.Keyboard;
+
+import java.io.IOException;
+import java.util.Set;
+
+public class MoulConfigGuiForgeInterop implements IModGuiFactory {
+ @Override
+ public void initialize(Minecraft minecraft) {}
+
+ @Override
+ public Class<? extends GuiScreen> mainConfigGuiClass() {
+ return WrappedMoulConfig.class;
+ }
+
+ @Override
+ public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
+ return null;
+ }
+
+ @Override
+ public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement runtimeOptionCategoryElement) {
+ return null;
+ }
+
+ public static class WrappedMoulConfig extends GuiScreenElementWrapper {
+
+ private final GuiScreen parent;
+
+ public WrappedMoulConfig(GuiScreen parent) {
+ super(NEUConfigEditor.editor);
+ this.parent = parent;
+ }
+
+ @Override
+ public void handleKeyboardInput() throws IOException {
+ if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
+ Minecraft.getMinecraft().displayGuiScreen(parent);
+ return;
+ }
+ super.handleKeyboardInput();
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java b/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java
new file mode 100644
index 00000000..13c31b54
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/events/SlotClickEvent.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2022 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.events;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fml.common.eventhandler.Cancelable;
+
+@Cancelable
+public class SlotClickEvent extends NEUEvent {
+ public final GuiContainer guiContainer;
+ public final Slot slot;
+ public final int slotId;
+ public int clickedButton;
+ public int clickType;
+ public boolean usePickblockInstead = false;
+
+ public SlotClickEvent(GuiContainer guiContainer, Slot slot, int slotId, int clickedButton, int clickType) {
+ this.guiContainer = guiContainer;
+ this.slot = slot;
+ this.slotId = slotId;
+ this.clickedButton = clickedButton;
+ this.clickType = clickType;
+ }
+
+ public void usePickblockInstead() {
+ usePickblockInstead = true;
+ }
+
+ @Override
+ public void setCanceled(boolean cancel) {
+ super.setCanceled(cancel);
+ }
+}
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 254c891a..67ac4f4c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
@@ -23,6 +23,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
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;
+import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -33,6 +34,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -68,29 +70,28 @@ public class AbiphoneWarning extends GuiElement {
return shouldPerformCheck() && showWarning;
}
- public boolean onMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) {
- if (!shouldPerformCheck()) return false;
- if (!NotEnoughUpdates.INSTANCE.config.misc.abiphoneWarning) return false;
- if (slotId == -999) return false;
- if (clickedButton == 0) return false;
+ @SubscribeEvent
+ public void onMouseClick(SlotClickEvent event) {
+ if (!shouldPerformCheck()) return;
+ if (!NotEnoughUpdates.INSTANCE.config.misc.abiphoneWarning) return;
+ if (event.slotId == -999) return;
+ if (event.clickedButton == 0) return;
GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
- ItemStack clickedContact = chest.inventorySlots.getSlot(slotId).getStack();
- if (clickedContact == null) return false;
+ ItemStack clickedContact = chest.inventorySlots.getSlot(event.slotId).getStack();
+ if (clickedContact == null) return;
List<String> list = ItemUtils.getLore(clickedContact);
- if (list.isEmpty()) return false;
+ if (list.isEmpty()) return;
String last = list.get(list.size() - 1);
if (last.contains("Right-click to remove contact!")) {
showWarning = true;
contactName = clickedContact.getDisplayName();
- contactSlot = slotId;
- return true;
+ contactSlot = event.slotId;
+ event.setCanceled(true);
}
-
- return false;
}
public void overrideIsMouseOverSlot(Slot slot, int mouseX, int mouseY, CallbackInfoReturnable<Boolean> cir) {
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 25aaaa0a..70ac4489 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AntiCoopAdd.java
@@ -20,43 +20,43 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.event.ClickEvent;
import net.minecraft.event.HoverEvent;
import net.minecraft.init.Items;
-import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class AntiCoopAdd {
- public static boolean onMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) {
- if (!NotEnoughUpdates.INSTANCE.config.misc.coopWarning) return false;
- if (slotId == -999) return false;
- if (!Utils.getOpenChestName().contains("Profile")) return false;
+ @SubscribeEvent
+ public void onMouseClick(SlotClickEvent event) {
+ if (!NotEnoughUpdates.INSTANCE.config.misc.coopWarning) return;
+ if (event.slotId == -999) return;
+ if (!Utils.getOpenChestName().contains("Profile")) return;
- GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
-
- ItemStack stack = chest.inventorySlots.getSlot(slotId).getStack();
- if (stack == null) return false;
- if (stack.getItem() == Items.diamond && stack.getDisplayName() != null && stack.getDisplayName().contains("Co-op Request")) {
+ ItemStack stack = event.slot.getStack();
+ if (stack == null) return;
+ if (stack.getItem() == Items.diamond && stack.getDisplayName() != null && stack.getDisplayName().contains(
+ "Co-op Request")) {
String ign = Utils.getOpenChestName().split("'s Profile")[0];
ChatComponentText storageMessage = new ChatComponentText(
EnumChatFormatting.YELLOW + "[NEU] " + EnumChatFormatting.YELLOW +
"You just clicked on the Co-op add button. If you want to coop add this person, click this chat message");
storageMessage.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/coopadd " + ign));
storageMessage.setChatStyle(storageMessage.getChatStyle().setChatHoverEvent(
- new HoverEvent(HoverEvent.Action.SHOW_TEXT,
- new ChatComponentText(EnumChatFormatting.YELLOW + "Click to add " + ign + " to your coop"))));
+ new HoverEvent(
+ HoverEvent.Action.SHOW_TEXT,
+ new ChatComponentText(EnumChatFormatting.YELLOW + "Click to add " + ign + " to your coop")
+ )));
ChatComponentText storageChatMessage = new ChatComponentText("");
storageChatMessage.appendSibling(storageMessage);
Minecraft.getMinecraft().thePlayer.addChatMessage(storageChatMessage);
- return true;
+ event.setCanceled(true);
}
-
- return false;
}
}
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 3bd674dd..ad9df7af 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
@@ -24,6 +24,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
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;
+import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
@@ -33,6 +34,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -79,75 +81,73 @@ public class AuctionBINWarning extends GuiElement {
return shouldPerformCheck() && showWarning;
}
- public boolean onMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) {
- if (!shouldPerformCheck()) return false;
+ @SubscribeEvent
+ public void onMouseClick(SlotClickEvent event) {
+ if (!shouldPerformCheck()) return;
- if (slotId == 29) {
- GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ if (event.slotId != 29) {
+ return;
+ }
- sellingPrice = -1;
+ sellingPrice = -1;
- ItemStack priceStack = chest.inventorySlots.getSlot(31).getStack();
- if (priceStack != null) {
- String displayName = priceStack.getDisplayName();
- Matcher priceMatcher = ITEM_PRICE_REGEX.matcher(displayName);
+ ItemStack priceStack = event.guiContainer.inventorySlots.getSlot(31).getStack();
+ if (priceStack != null) {
+ String displayName = priceStack.getDisplayName();
+ Matcher priceMatcher = ITEM_PRICE_REGEX.matcher(displayName);
- if (priceMatcher.matches()) {
- try {
- sellingPrice = Long.parseLong(priceMatcher.group(1).replace(",", ""));
- } catch (NumberFormatException ignored) {
- }
+ if (priceMatcher.matches()) {
+ try {
+ sellingPrice = Long.parseLong(priceMatcher.group(1).replace(",", ""));
+ } catch (NumberFormatException ignored) {
}
}
+ }
- ItemStack sellStack = chest.inventorySlots.getSlot(13).getStack();
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(sellStack);
- sellStackAmount = sellStack.stackSize;
+ ItemStack sellStack = event.guiContainer.inventorySlots.getSlot(13).getStack();
+ String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(sellStack);
+ sellStackAmount = sellStack.stackSize;
- if (internalname == null) {
- return false;
- }
+ if (internalname == null) {
+ return;
+ }
- JsonObject itemInfo = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(internalname);
- if (itemInfo == null || !itemInfo.has("displayname")) {
- sellingName = internalname;
- } else {
- sellingName = itemInfo.get("displayname").getAsString();
- }
+ JsonObject itemInfo = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(internalname);
+ if (itemInfo == null || !itemInfo.has("displayname")) {
+ sellingName = internalname;
+ } else {
+ sellingName = itemInfo.get("displayname").getAsString();
+ }
- sellingTooltip = sellStack.getTooltip(
- Minecraft.getMinecraft().thePlayer,
- Minecraft.getMinecraft().gameSettings.advancedItemTooltips
- );
+ sellingTooltip = sellStack.getTooltip(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips
+ );
- lowestPrice = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname);
- if (lowestPrice <= 0) {
- lowestPrice = (int) NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname);
- }
+ lowestPrice = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname);
+ if (lowestPrice <= 0) {
+ lowestPrice = (int) NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname);
+ }
- float undercutFactor = 1 - NotEnoughUpdates.INSTANCE.config.ahTweaks.warningThreshold / 100;
- if (undercutFactor < 0) undercutFactor = 0;
- if (undercutFactor > 1) undercutFactor = 1;
- float overcutFactor = 1 - NotEnoughUpdates.INSTANCE.config.ahTweaks.overcutWarningThreshold / 100;
- if (overcutFactor < 0) overcutFactor = 0;
- if (overcutFactor > 1) overcutFactor = 1;
+ float undercutFactor = 1 - NotEnoughUpdates.INSTANCE.config.ahTweaks.warningThreshold / 100;
+ if (undercutFactor < 0) undercutFactor = 0;
+ if (undercutFactor > 1) undercutFactor = 1;
+ float overcutFactor = 1 - NotEnoughUpdates.INSTANCE.config.ahTweaks.overcutWarningThreshold / 100;
+ if (overcutFactor < 0) overcutFactor = 0;
+ if (overcutFactor > 1) overcutFactor = 1;
- if (lowestPrice == -1) {
- return false;
- }
- if (NotEnoughUpdates.INSTANCE.config.ahTweaks.underCutWarning &&
- (sellingPrice > 0 && lowestPrice > 0 && sellingPrice < sellStackAmount * lowestPrice * undercutFactor)) {
- showWarning = true;
- return true;
- } else if (NotEnoughUpdates.INSTANCE.config.ahTweaks.overCutWarning &&
- (sellingPrice > 0 && lowestPrice > 0 && sellingPrice > sellStackAmount * lowestPrice * (overcutFactor + 1))) {
- showWarning = true;
- return true;
- } else {
- return false;
- }
+ if (lowestPrice == -1) {
+ return;
+ }
+ if (NotEnoughUpdates.INSTANCE.config.ahTweaks.underCutWarning &&
+ (sellingPrice > 0 && lowestPrice > 0 && sellingPrice < sellStackAmount * lowestPrice * undercutFactor)) {
+ showWarning = true;
+ event.setCanceled(true);
+ } else if (NotEnoughUpdates.INSTANCE.config.ahTweaks.overCutWarning &&
+ (sellingPrice > 0 && lowestPrice > 0 && sellingPrice > sellStackAmount * lowestPrice * (overcutFactor + 1))) {
+ showWarning = true;
+ event.setCanceled(true);
}
- return false;
}
public void overrideIsMouseOverSlot(Slot slot, int mouseX, int mouseY, CallbackInfoReturnable<Boolean> cir) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java
deleted file mode 100644
index 9ab85390..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2022 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.miscfeatures;
-
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.core.util.StringUtils;
-import io.github.moulberry.notenoughupdates.miscgui.TrophyRewardOverlay;
-import io.github.moulberry.notenoughupdates.util.ItemUtils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.inventory.Container;
-import net.minecraft.inventory.ContainerChest;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.client.event.GuiOpenEvent;
-import net.minecraftforge.event.entity.player.ItemTooltipEvent;
-import net.minecraftforge.fml.common.eventhandler.EventPriority;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import org.lwjgl.input.Keyboard;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-public class BazaarSacksProfit {
-
- private static BazaarSacksProfit INSTANCE = null;
- private boolean showSellOrderPrice = false;
- private boolean pressedShiftLast = false;
-
- public static BazaarSacksProfit getInstance() {
- if (INSTANCE == null) {
- INSTANCE = new BazaarSacksProfit();
- }
- return INSTANCE;
- }
-
- private final Map<String, Integer> prices = new HashMap<>();
- private final Map<String, String> names = new HashMap<>();
- private final List<String> invalidNames = new ArrayList<>();
- private boolean dirty = true;
-
- @SubscribeEvent
- public void onGuiOpen(GuiOpenEvent event) {
- showSellOrderPrice = false;
- dirty = true;
- }
-
- @SubscribeEvent(priority = EventPriority.LOW)
- public void onItemTooltipLow(ItemTooltipEvent event) {
- if (!NotEnoughUpdates.INSTANCE.config.bazaarTweaks.bazaarSacksProfit) return;
- if (!inBazaar()) return;
-
- ItemStack itemStack = event.itemStack;
- String displayName = itemStack.getDisplayName();
- if (!displayName.equals("§bSell Sacks Now")) return;
-
- boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
- if (!pressedShiftLast && shift) {
- showSellOrderPrice = !showSellOrderPrice;
- }
- pressedShiftLast = shift;
-
- if (dirty) {
- dirty = false;
- prices.clear();
- names.clear();
- invalidNames.clear();
-
- out:
- for (String line : ItemUtils.getLore(itemStack)) {
-
- if (line.equals("§8Loading...")) {
- dirty = true;
- return;
- }
- if (line.contains("§7x ")) {
- String[] split = line.split("§7x ");
- String rawAmount = StringUtils.cleanColour(split[0]).replace(",", "").substring(1);
- int amount = Integer.parseInt(rawAmount);
- String bazaarName = split[1].split(" §7for")[0];
- for (Map.Entry<String, JsonObject> entry : NotEnoughUpdates.INSTANCE.manager
- .getItemInformation()
- .entrySet()) {
- String internalName = entry.getKey();
-
- // Ignoring builder melon, builder clay and builder cactus
- if (NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalName) == null) continue;
-
- JsonObject object = entry.getValue();
- if (object.has("displayname")) {
- String name = object.get("displayname").getAsString();
- if (name.equals(bazaarName)) {
- prices.put(internalName, amount);
- names.put(internalName, bazaarName);
- continue out;
- }
- }
- }
- System.err.println("no bazaar item in repo found for '" + bazaarName + "'");
- invalidNames.add(bazaarName);
- }
- }
- }
-
- event.toolTip.removeIf(line -> line.contains("§7x ") || line.contains("You earn:"));
-
- Map<String, Float> map = new HashMap<>();
- DecimalFormat formatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.ENGLISH);
- formatter.applyPattern("#,##0");
- double totalPrice = 0;
- for (Map.Entry<String, Integer> entry : prices.entrySet()) {
- String internalName = entry.getKey();
- int amount = entry.getValue();
- String name = names.get(internalName);
-
- JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalName);
-
- float price = 0;
- if (bazaarInfo != null) {
-
- if (showSellOrderPrice) {
- if (bazaarInfo.has("curr_buy")) {
- price = bazaarInfo.get("curr_buy").getAsFloat();
- } else {
- System.err.println("curr_sell does not exist for '" + internalName + "'");
- }
- } else {
- if (bazaarInfo.has("curr_sell")) {
- price = bazaarInfo.get("curr_sell").getAsFloat();
- } else {
- System.err.println("curr_sell does not exist for '" + internalName + "'");
- }
- }
- }
- float extraPrice = price * amount;
- String priceFormat = formatter.format(extraPrice);
- totalPrice += extraPrice;
- map.put("§a" + formatter.format(amount) + "§7x §f" + name + " §7for §6" + priceFormat + " coins", extraPrice);
- }
-
- event.toolTip.add(4, "");
- if (showSellOrderPrice) {
- event.toolTip.add(4, "§7Sell order price: §6" + formatter.format(totalPrice));
- } else {
- event.toolTip.add(4, "§7Instant sell price: §6" + formatter.format(totalPrice));
- }
-
- event.toolTip.add(4, "");
- event.toolTip.removeIf(line -> line.equals("§5§o"));
- int index = 4;
- for (String name : invalidNames) {
- index++;
- event.toolTip.add(4, name + " §c[NEU] Missing Repo data!");
- }
- for (String text : TrophyRewardOverlay.sortByValue(map).keySet()) {
- index++;
- event.toolTip.add(4, text);
- }
- event.toolTip.add(index, "");
-
- if (!showSellOrderPrice) {
- event.toolTip.add("§8[Press SHIFT to show sell order price]");
- } else {
- event.toolTip.add("§8[Press SHIFT to show instant sell price]");
- }
- }
-
- public static boolean inBazaar() {
- if (!NotEnoughUpdates.INSTANCE.isOnSkyblock()) return false;
-
- Minecraft minecraft = Minecraft.getMinecraft();
- if (minecraft == null || minecraft.thePlayer == null) return false;
-
- Container inventoryContainer = minecraft.thePlayer.openContainer;
- if (!(inventoryContainer instanceof ContainerChest)) return false;
- ContainerChest containerChest = (ContainerChest) inventoryContainer;
- return containerChest.getLowerChestInventory().getDisplayName().getUnformattedText().startsWith("Bazaar ");
- }
-}
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 e51496e3..ad0b238a 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.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
@@ -37,6 +38,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import javax.imageio.ImageIO;
import java.awt.*;
@@ -563,4 +565,17 @@ public class BetterContainers {
return 0;
}
}
+
+ @SubscribeEvent
+ public void onMouseClick(SlotClickEvent event) {
+ if (!isOverriding()) return;
+ boolean isBlankStack = BetterContainers.isBlankStack(event.slot.slotNumber, event.slot.getStack());
+ if (!(isBlankStack ||
+ BetterContainers.isButtonStack(event.slot.slotNumber, event.slot.getStack()))) return;
+ clickSlot(event.slotId);
+ if (isBlankStack) {
+ event.usePickblockInstead();
+ }
+ }
+
}
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 cf1647b6..f378fdca 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java
@@ -47,6 +47,7 @@ import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
+import java.util.Locale;
import java.util.function.BooleanSupplier;
import java.util.function.LongSupplier;
@@ -506,7 +507,7 @@ public class CrystalWishingCompassSolver {
for (String crystalName : crystals.keySet()) {
Integer crystalState = crystals.get(crystalName);
if (crystalState != null && crystalState > 0) {
- foundCrystals.add(Crystal.valueOf(crystalName.toUpperCase()));
+ foundCrystals.add(Crystal.valueOf(crystalName.toUpperCase(Locale.US).replace("İ", "I")));
}
}
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 a1580d8e..d5cbfdde 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.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
@@ -308,98 +309,88 @@ public class EnchantingSolvers {
return false;
}
- public static boolean onStackClick(ItemStack stack, int windowId, int slotId, int mouseButtonClicked, int mode) {
- if (!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) {
- return false;
+ @SubscribeEvent
+ public void onStackClick(SlotClickEvent event) {
+ if (!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers
+ || !NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ return;
}
- if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
- return false;
+ ItemStack stack = event.slot.getStack();
+ if (stack == null || stack.getDisplayName() == null) {
+ return;
}
+ String displayName = stack.getDisplayName();
+ if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) {
+ return;
+ }
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ ContainerChest container = (ContainerChest) chest.inventorySlots;
+ IInventory lower = container.getLowerChestInventory();
+
+ if (currentSolver == SolverType.CHRONOMATRON) {
+ ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory() - 5);
+ if (timerStack == null) {
+ return;
+ }
- if (stack != null && stack.getDisplayName() != null) {
- String displayName = stack.getDisplayName();
- if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
- GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
- ContainerChest container = (ContainerChest) chest.inventorySlots;
- IInventory lower = container.getLowerChestInventory();
-
- if (currentSolver == SolverType.CHRONOMATRON) {
- ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory() - 5);
- if (timerStack == null) {
- return false;
- }
-
- boolean yepClock = timerStack.getItem() == Items.clock;
- if (timerStack.getItem() == Item.getItemFromBlock(Blocks.glowstone) ||
- (yepClock && (!addToChronomatron || chronomatronOrder.size() < lastChronomatronSize + 1))) {
- return true;
- } else if (yepClock) {
- long currentTime = System.currentTimeMillis();
- if (currentTime - millisLastClick < 150) {
- return true;
- }
+ boolean yepClock = timerStack.getItem() == Items.clock;
+ if (timerStack.getItem() == Item.getItemFromBlock(Blocks.glowstone) ||
+ (yepClock && (!addToChronomatron || chronomatronOrder.size() < lastChronomatronSize + 1))) {
+ event.setCanceled(true);
+ return;
+ }
+ if (yepClock) {
+ long currentTime = System.currentTimeMillis();
+ if (currentTime - millisLastClick < 150) {
+ event.setCanceled(true);
+ return;
+ }
- if (chronomatronReplayIndex < chronomatronOrder.size()) {
- String chronomatronCurrent = chronomatronOrder.get(chronomatronReplayIndex);
- if ((!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.preventMisclicks1 ||
- chronomatronCurrent.equals(displayName) || Keyboard.getEventKey() == Keyboard.KEY_LSHIFT) &&
- stack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane) && slotId != 4 && slotId != 49) {
- chronomatronReplayIndex++;
- Minecraft.getMinecraft().playerController.windowClick(windowId, slotId,
- 2, mode, Minecraft.getMinecraft().thePlayer
- );
- millisLastClick = currentTime;
- }
- /*if (chronomatronCurrent.equals(displayName)) {
- chronomatronReplayIndex++;
- }
- Minecraft.getMinecraft().playerController.windowClick(windowId, slotId,
- 2, mode, Minecraft.getMinecraft().thePlayer);
- millisLastClick = currentTime;*/
- }
- return true;
- }
- } else if (currentSolver == SolverType.ULTRASEQUENCER) {
- ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory() - 5);
- if (timerStack == null) {
- return false;
+ if (chronomatronReplayIndex < chronomatronOrder.size()) {
+ String chronomatronCurrent = chronomatronOrder.get(chronomatronReplayIndex);
+ if ((!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.preventMisclicks1 ||
+ chronomatronCurrent.equals(displayName) || Keyboard.getEventKey() == Keyboard.KEY_LSHIFT) &&
+ stack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane) && event.slotId != 4 &&
+ event.slotId != 49) {
+ chronomatronReplayIndex++;
+ millisLastClick = currentTime;
+ event.usePickblockInstead();
+ return;
}
+ }
+ event.setCanceled(true);
+ return;
+ }
+ }
+ if (currentSolver == SolverType.ULTRASEQUENCER) {
+ ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory() - 5);
+ if (timerStack == null) {
+ return;
+ }
- boolean yepClock = timerStack.getItem() == Items.clock;
- if (yepClock) {
- UltrasequencerItem current = ultraSequencerOrder.get(ultrasequencerReplayIndex);
- if (current == null) {
- return true;
- }
- long currentTime = System.currentTimeMillis();
- if (currentTime - millisLastClick > 150 &&
- (!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.preventMisclicks1 ||
- current.containerIndex == slotId || Keyboard.getEventKey() == Keyboard.KEY_LSHIFT) && (slotId < 45 && slotId > 8)) {
- ultrasequencerReplayIndex++;
- Minecraft.getMinecraft().playerController.windowClick(windowId, slotId,
- 2, mode, Minecraft.getMinecraft().thePlayer
- );
- millisLastClick = currentTime;
- }
- /*if (currentTime - millisLastClick > 150) {
- if (current.containerIndex == slotId) {
- ultrasequencerReplayIndex++;
- }
- Minecraft.getMinecraft().playerController.windowClick(windowId, slotId,
- 2, mode, Minecraft.getMinecraft().thePlayer);
- millisLastClick = currentTime;
- }*/
- return true;
- } else {
- return true;
- }
- } else if (currentSolver == SolverType.SUPERPAIRS) {
- lastSlotClicked = slotId;
+ boolean yepClock = timerStack.getItem() == Items.clock;
+ if (yepClock) {
+ UltrasequencerItem current = ultraSequencerOrder.get(ultrasequencerReplayIndex);
+ long currentTime = System.currentTimeMillis();
+ if (current == null) {
+ event.setCanceled(true);
+ return;
+ }
+ if (currentTime - millisLastClick > 150 &&
+ (!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.preventMisclicks1 ||
+ current.containerIndex == event.slotId || Keyboard.getEventKey() == Keyboard.KEY_LSHIFT) &&
+ (event.slotId < 45 && event.slotId > 8)) {
+ ultrasequencerReplayIndex++;
+ millisLastClick = currentTime;
+ event.usePickblockInstead();
+ return;
}
}
+ event.setCanceled(true);
+ } else if (currentSolver == SolverType.SUPERPAIRS) {
+ lastSlotClicked = event.slotId;
}
- return false;
}
public static void processInventoryContents(boolean fromTick) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java
index 077054a4..89e95e25 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java
@@ -207,6 +207,7 @@ public class Navigation {
if (event.phase != TickEvent.Phase.START) return;
if (Minecraft.getMinecraft().theWorld == null) return;
if (Minecraft.getMinecraft().thePlayer == null) return;
+ if (neu.config.getProfileSpecific() == null) return;
if (Minecraft.getMinecraft().currentScreen instanceof GuiChest && RenderListener.inventoryLoaded) {
GuiChest currentScreen = (GuiChest) Minecraft.getMinecraft().currentScreen;
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 050d23a9..62527317 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
@@ -30,6 +30,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils;
+import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
@@ -862,18 +863,19 @@ public class PetInfoOverlay extends TextOverlay {
"alchemy"
);
- public static void onStackClick(ItemStack stack, int windowId, int slotId, int mouseButtonClicked, int mode) {
- if (mouseButtonClicked != 0 && mouseButtonClicked != 1 && mouseButtonClicked != 2) return;
+ @SubscribeEvent
+ public void onStackClick(SlotClickEvent event) {
+ if (event.clickedButton != 0 && event.clickedButton != 1 && event.clickedButton != 2) return;
- int slotIdMod = (slotId - 10) % 9;
- if (slotId >= 10 && slotId <= 43 && slotIdMod >= 0 && slotIdMod <= 6 &&
+ int slotIdMod = (event.slotId - 10) % 9;
+ if (event.slotId >= 10 && event.slotId <= 43 && slotIdMod >= 0 && slotIdMod <= 6 &&
Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
ContainerChest container = (ContainerChest) chest.inventorySlots;
IInventory lower = container.getLowerChestInventory();
String containerName = lower.getDisplayName().getUnformattedText();
- if (lower.getSizeInventory() >= 54 && windowId == container.windowId) {
+ if (lower.getSizeInventory() >= 54 && event.guiContainer.inventorySlots.windowId == container.windowId) {
int page = 0;
boolean isPets = false;
@@ -895,7 +897,7 @@ public class PetInfoOverlay extends TextOverlay {
boolean isRemoving =
removingStack != null && removingStack.getItem() == Items.dye && removingStack.getItemDamage() == 10;
- int newSelected = (slotId - 10) - (slotId - 10) / 9 * 2 + page * 28;
+ int newSelected = (event.slotId - 10) - (event.slotId - 10) / 9 * 2 + page * 28;
lastPetSelect = System.currentTimeMillis();
@@ -908,9 +910,11 @@ public class PetInfoOverlay extends TextOverlay {
} else {
setCurrentPet(newSelected);
- Pet pet = getPetFromStack(stack.getTagCompound());
- if (pet != null) {
- config.petMap.put(config.selectedPet, pet);
+ if (event.slot.getStack() != null && event.slot.getStack().getTagCompound() != null) {
+ Pet pet = getPetFromStack(event.slot.getStack().getTagCompound());
+ if (pet != null) {
+ config.petMap.put(config.selectedPet, pet);
+ }
}
}
}
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 3955c363..8a487739 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
@@ -24,6 +24,7 @@ import com.google.gson.GsonBuilder;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.config.KeybindHelper;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.Minecraft;
@@ -43,7 +44,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import org.apache.commons.lang3.tuple.Triple;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -58,7 +58,6 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
-import java.util.function.Consumer;
public class SlotLocking {
private static final SlotLocking INSTANCE = new SlotLocking();
@@ -455,22 +454,21 @@ public class SlotLocking {
}
}
- public void onWindowClick(
- Slot slotIn,
- int slotId,
- int clickedButton,
- int clickType,
- Consumer<Triple<Integer, Integer, Integer>> consumer
- ) {
- LockedSlot locked = getLockedSlot(slotIn);
+ @SubscribeEvent
+ public void onWindowClick(SlotClickEvent slotClickEvent) {
+ LockedSlot locked = getLockedSlot(slotClickEvent.slot);
if (locked == null) {
return;
- } else if (locked.locked || (clickType == 2 && SlotLocking.getInstance().isSlotIndexLocked(clickedButton))) {
- consumer.accept(null);
- } else if (NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && clickType == 1 &&
+ }
+ if (locked.locked ||
+ (slotClickEvent.clickType == 2 && SlotLocking.getInstance().isSlotIndexLocked(slotClickEvent.clickedButton))) {
+ slotClickEvent.setCanceled(true);
+ return;
+ }
+ if (NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding
+ && slotClickEvent.clickType == 1 &&
locked.boundTo != -1) {
- GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen;
- Slot boundSlot = container.inventorySlots.getSlotFromInventory(
+ Slot boundSlot = slotClickEvent.guiContainer.inventorySlots.getSlotFromInventory(
Minecraft.getMinecraft().thePlayer.inventory,
locked.boundTo
);
@@ -481,29 +479,41 @@ public class SlotLocking {
LockedSlot boundLocked = getLockedSlot(boundSlot);
- int id = slotIn.getSlotIndex();
- if (id >= 9 && locked.boundTo >= 0 && locked.boundTo < 8) {
- if (!boundLocked.locked) {
- consumer.accept(Triple.of(slotId, locked.boundTo, 2));
- if (boundLocked == DEFAULT_LOCKED_SLOT) {
- LockedSlot[] lockedSlots = getDataForProfile();
- lockedSlots[locked.boundTo] = new LockedSlot();
- lockedSlots[locked.boundTo].boundTo = id;
- } else {
- boundLocked.boundTo = id;
- }
+ int from, to;
+ int id = slotClickEvent.slot.getSlotIndex();
+ if (id >= 9 && 0 <= locked.boundTo && locked.boundTo < 8 && !boundLocked.locked) {
+ from = id;
+ to = locked.boundTo;
+ if (boundLocked == DEFAULT_LOCKED_SLOT) {
+ LockedSlot[] lockedSlots = getDataForProfile();
+ lockedSlots[locked.boundTo] = new LockedSlot();
+ lockedSlots[locked.boundTo].boundTo = id;
+ } else {
+ boundLocked.boundTo = id;
}
- } else if (id >= 0 && id < 8 && locked.boundTo >= 9 && locked.boundTo <= 39) {
+ } else if (0 <= id && id < 8 && locked.boundTo >= 9 && locked.boundTo <= 39) {
if (boundLocked.locked || boundLocked.boundTo != id) {
locked.boundTo = -1;
+ return;
} else {
- int boundTo = boundSlot.slotNumber;
- consumer.accept(Triple.of(boundTo, id, 2));
+ from = boundSlot.slotNumber;
+ to = id;
}
+ } else {
+ return;
}
+ if (from == 39) from = 5;
+ if (from == 38) from = 6;
+ if (from == 37) from = 7;
+ if (from == 36) from = 8;
+ Minecraft.getMinecraft().playerController.windowClick(
+ slotClickEvent.guiContainer.inventorySlots.windowId,
+ from, to, 2, Minecraft.getMinecraft().thePlayer
+ );
+ slotClickEvent.setCanceled(true);
} else if (NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && locked.boundTo != -1 &&
NotEnoughUpdates.INSTANCE.config.slotLocking.bindingAlsoLocks) {
- consumer.accept(null);
+ slotClickEvent.setCanceled(true);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java
index 8a0353d3..16b5015b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java
@@ -1078,7 +1078,7 @@ public class TradeWindow {
!SlotLocking.getInstance().isSlotLocked(slot)) {
Minecraft.getMinecraft().playerController.windowClick(
chest.inventorySlots.windowId,
- slot.slotNumber, 2, 3, Minecraft.getMinecraft().thePlayer
+ slot.slotNumber, 0, 0, Minecraft.getMinecraft().thePlayer
);
}
return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java
index 1b6b5c61..94b1c704 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java
@@ -60,7 +60,7 @@ public class MixinGuiChest {
private static final String TARGET_SBADRAWSTRING = "Lcodes/biscuit/skyblockaddons/asm/hooks/GuiChestHook;" +
"drawString(Lnet/minecraft/client/gui/FontRenderer;Ljava/lang/String;III)I";
- @Redirect(method = "drawGuiContainerForegroundLayer", at = @At(value = "INVOKE", target = TARGET_SBADRAWSTRING, remap = false))
+ @Redirect(method = "drawGuiContainerForegroundLayer", at = @At(value = "INVOKE", target = TARGET_SBADRAWSTRING, remap = false), expect = 0)
public int drawGuiContainerForegroundLayer_SBA_drawString(
FontRenderer fontRenderer,
String text,
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 a24f4c84..81918939 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
@@ -21,14 +21,13 @@ package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.NEUOverlay;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
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.AuctionSortModeWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
-import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
import io.github.moulberry.notenoughupdates.miscgui.GuiCustomEnchant;
import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay;
@@ -60,7 +59,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
@Mixin(GuiContainer.class)
public abstract class MixinGuiContainer extends GuiScreen {
@@ -98,7 +96,8 @@ public abstract class MixinGuiContainer extends GuiScreen {
if (tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")) {
String tagName = tag.getCompoundTag("SkullOwner").getString("Name");
String displayName = Utils.cleanColour(cc.inventorySlots.get(22).getStack().getDisplayName());
- if (displayName.length() - tagName.length() >= 0 && tagName.equals(displayName.substring(displayName.length() - tagName.length()))) {
+ if (displayName.length() - tagName.length() >= 0 && tagName.equals(displayName.substring(
+ displayName.length() - tagName.length()))) {
ci.cancel();
this.zLevel = 100.0F;
@@ -127,7 +126,8 @@ public abstract class MixinGuiContainer extends GuiScreen {
else if (!($this instanceof GuiChest))
BetterContainers.profileViewerStackIndex = -1;
- if (slot.getStack() == null && NotEnoughUpdates.INSTANCE.overlay.searchMode && RenderListener.drawingGuiScreen && NotEnoughUpdates.INSTANCE.isOnSkyblock()) {
+ if (slot.getStack() == null && NotEnoughUpdates.INSTANCE.overlay.searchMode && RenderListener.drawingGuiScreen &&
+ NotEnoughUpdates.INSTANCE.isOnSkyblock()) {
GlStateManager.pushMatrix();
GlStateManager.translate(0, 0, 100 + Minecraft.getMinecraft().getRenderItem().zLevel);
GlStateManager.depthMask(false);
@@ -303,74 +303,20 @@ public abstract class MixinGuiContainer extends GuiScreen {
@Inject(method = "handleMouseClick", at = @At(value = "HEAD"), cancellable = true)
public void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, CallbackInfo ci) {
+ if (slotIn == null) return;
GuiContainer $this = (GuiContainer) (Object) this;
-
- if (AuctionBINWarning.getInstance().onMouseClick(slotIn, slotId, clickedButton, clickType)) {
- ci.cancel();
- return;
- }
-
- if (AbiphoneWarning.getInstance().onMouseClick(slotIn, slotId, clickedButton, clickType)) {
+ SlotClickEvent event = new SlotClickEvent($this, slotIn, slotId, clickedButton, clickType);
+ event.post();
+ if (event.isCanceled()) {
ci.cancel();
return;
}
-
- if (AntiCoopAdd.onMouseClick(slotIn, slotId, clickedButton, clickType)) {
- ci.cancel();
- return;
- }
-
- AtomicBoolean ret = new AtomicBoolean(false);
- SlotLocking.getInstance().onWindowClick(slotIn, slotId, clickedButton, clickType, (tuple) -> {
+ if (event.usePickblockInstead) {
+ $this.mc.playerController.windowClick(
+ $this.inventorySlots.windowId,
+ slotId, 2, 3, $this.mc.thePlayer
+ );
ci.cancel();
-
- if (tuple == null) {
- ret.set(true);
- } else {
- int newSlotId = tuple.getLeft();
- int newClickedButton = tuple.getMiddle();
- int newClickedType = tuple.getRight();
-
- ret.set(true);
- $this.mc.playerController.windowClick(
- $this.inventorySlots.windowId,
- newSlotId,
- newClickedButton,
- newClickedType,
- $this.mc.thePlayer
- );
- }
- });
- if (ret.get()) return;
-
- if (slotIn != null && slotIn.getStack() != null) {
- if (EnchantingSolvers.onStackClick(slotIn.getStack(), $this.inventorySlots.windowId,
- slotId, clickedButton, clickType
- )) {
- ci.cancel();
- } else {
- PetInfoOverlay.onStackClick(slotIn.getStack(), $this.inventorySlots.windowId,
- slotId, clickedButton, clickType
- );
- }
- }
- if (slotIn != null && BetterContainers.isOverriding() && (BetterContainers.isBlankStack(
- slotIn.slotNumber,
- slotIn.getStack()
- ) ||
- BetterContainers.isButtonStack(slotIn.slotNumber, slotIn.getStack()))) {
- BetterContainers.clickSlot(slotIn.getSlotIndex());
-
- if (BetterContainers.isBlankStack(slotIn.slotNumber, slotIn.getStack())) {
- GuiContainer chest = ((GuiContainer) Minecraft.getMinecraft().currentScreen);
- Minecraft.getMinecraft().playerController.windowClick(
- chest.inventorySlots.windowId,
- slotId, 2, 3, Minecraft.getMinecraft().thePlayer
- );
- ci.cancel();
- } else {
- Utils.playPressSound();
- }
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java
index 2ba0b718..954af02d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java
@@ -70,12 +70,4 @@ public class BazaarTweaks {
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean escFullClose = true;
-
- @Expose
- @ConfigOption(
- name = "Bazaar Sacks Profit",
- desc = "Orders the items in your sacks in the bazaar inventory and adding buy order toggle"
- )
- @ConfigEditorBoolean
- public boolean bazaarSacksProfit = true;
}
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 e6e8cb3b..5cd8f6b3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java
@@ -140,7 +140,6 @@ public class EquipmentOverlay {
public static final int PET_OVERLAY_OFFSET_Y = ARMOR_OVERLAY_HEIGHT - 14 /* overlaying pixels */;
//</editor-fold>
- public boolean isRenderingPet;
public boolean shouldRenderPets;
public boolean shouldRenderArmorHud;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
index 4d3b4645..3692602a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
@@ -274,7 +274,7 @@ public class ItemResolutionQuery {
private String resolveFromSkyblock() {
String internalName = getExtraAttributes().getString("id");
if (internalName == null || internalName.isEmpty()) return null;
- return internalName.toUpperCase(Locale.ROOT);
+ return internalName.toUpperCase(Locale.ROOT).replace(':', '-');
}
// </editor-fold>
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
index c6bc7538..8b81d1b4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
@@ -369,9 +369,9 @@ public class ItemUtils {
if (j < (levelPercent / 5)) {
sb.append(EnumChatFormatting.DARK_GREEN);
} else {
- sb.append(EnumChatFormatting.GRAY);
+ sb.append(EnumChatFormatting.WHITE);
}
- sb.append("-");
+ sb.append(EnumChatFormatting.BOLD + "" + EnumChatFormatting.STRIKETHROUGH + " ");
}
newLore.appendTag(new NBTTagString(sb.toString()));
newLore.appendTag(new NBTTagString(
diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml
index 281faf65..412917d1 100644
--- a/src/main/resources/META-INF/mods.toml
+++ b/src/main/resources/META-INF/mods.toml
@@ -5,7 +5,7 @@ license = "LGPL"
[[mods]]
modId="notenoughupdateserrordisplay"
-version="99.99"
+version="${version}"
displayName="NotEnoughUpdates (1.8.9)"
description='''
This mod description is only here to warn you about using the wrong version of Minecraft and Forge.
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index 8dd63bf3..0123ad91 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -1,6 +1,6 @@
{
"id": "notenoughupdates",
- "version": "9999.0",
+ "version": "${version}",
"schemaVersion": 1,
"entrypoints": {
"main": [