aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Update Notes/2.1.1.md6
-rw-r--r--build.gradle.kts85
-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.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java53
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/events/NEUEvent.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/events/SpawnParticleEvent.java97
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java47
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/GenericBlockHighlighter.java69
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/GlowingMushroomHighlighter.java91
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WorldConfig.java43
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/MathUtil.java26
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java4
-rw-r--r--src/main/resources/META-INF/mods.toml2
-rw-r--r--src/main/resources/fabric.mod.json2
23 files changed, 664 insertions, 111 deletions
diff --git a/Update Notes/2.1.1.md b/Update Notes/2.1.1.md
new file mode 100644
index 00000000..ac1d72ed
--- /dev/null
+++ b/Update Notes/2.1.1.md
@@ -0,0 +1,6 @@
+# These are the change notes for NEU 2.1.1
+
+### **Minor Changes:**
+
+ - Added Glowing Mushroom Highlighter - nea89
+
diff --git a/build.gradle.kts b/build.gradle.kts
index 409a8d51..deb740f5 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -18,12 +18,9 @@
*/
-import net.fabricmc.loom.task.RemapJarTask
-import java.io.ByteArrayOutputStream
-import java.nio.file.FileSystems
-import java.nio.file.Files
-import java.nio.charset.StandardCharsets
-import java.util.*
+import neubs.NEUBuildFlags
+import neubs.applyPublishingInformation
+import neubs.setVersionFromEnvironment
plugins {
idea
@@ -31,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 {
@@ -106,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")
@@ -115,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))
}
@@ -162,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 {
@@ -175,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"
)
@@ -201,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 b06f2ab2..9dc00f93 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -60,6 +60,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.Custom
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBlockSounds;
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.DwarvenMinesTextures;
import io.github.moulberry.notenoughupdates.miscfeatures.updater.AutoUpdater;
+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;
@@ -300,6 +301,7 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(PowerStoneStatsDisplay.getInstance());
MinecraftForge.EVENT_BUS.register(BazaarSacksProfit.getInstance());
MinecraftForge.EVENT_BUS.register(navigation);
+ MinecraftForge.EVENT_BUS.register(new GlowingMushroomHighlighter());
if (Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) {
IReloadableResourceManager manager = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java
index e7ce29c3..ed2afd69 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java
@@ -305,7 +305,21 @@ public class RenderUtils {
}
}
- private static void renderBoundingBox(double x, double y, double z, int rgb, float alphaMult, float partialTicks) {
+ public static void renderBoundingBox(
+ BlockPos worldPos,
+ int rgb,
+ float partialTicks
+ ) {
+ Vector3f interpolatedPlayerPosition = getInterpolatedPlayerPosition(partialTicks);
+ renderBoundingBoxInViewSpace(
+ worldPos.getX() - interpolatedPlayerPosition.x,
+ worldPos.getY() - interpolatedPlayerPosition.y,
+ worldPos.getZ() - interpolatedPlayerPosition.z,
+ rgb
+ );
+ }
+
+ private static void renderBoundingBoxInViewSpace(double x, double y, double z, int rgb) {
AxisAlignedBB bb = new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1);
GlStateManager.disableDepth();
@@ -343,33 +357,42 @@ public class RenderUtils {
RenderUtils.renderBeaconBeam(x, y, z, rgb, 1.0f, partialTicks, distSq > 10 * 10);
}
- public static void renderBeaconBeamOrBoundingBox(BlockPos block, int rgb, float alphaMult, float partialTicks) {
- double viewerX;
- double viewerY;
- double viewerZ;
+ public static Vector3f getInterpolatedPlayerPosition(float partialTicks) {
Vector3f aoteInterpPos = CustomItemEffects.INSTANCE.getCurrentPosition();
if (aoteInterpPos != null) {
- viewerX = aoteInterpPos.x;
- viewerY = aoteInterpPos.y;
- viewerZ = aoteInterpPos.z;
+ return new Vector3f(aoteInterpPos);
} else {
Entity viewer = Minecraft.getMinecraft().getRenderViewEntity();
- viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks;
- viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks;
- viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks;
+ Vector3f lastPos = new Vector3f(
+ (float) viewer.lastTickPosX,
+ (float) viewer.lastTickPosY,
+ (float) viewer.lastTickPosZ
+ );
+ Vector3f currentPos = new Vector3f(
+ (float) viewer.posX,
+ (float) viewer.posY,
+ (float) viewer.posZ
+ );
+ Vector3f movement = Vector3f.sub(currentPos, lastPos, currentPos);
+ movement.scale(partialTicks);
+ return Vector3f.add(lastPos, movement, lastPos);
}
+ }
- double x = block.getX() - viewerX;
- double y = block.getY() - viewerY;
- double z = block.getZ() - viewerZ;
+ public static void renderBeaconBeamOrBoundingBox(BlockPos block, int rgb, float alphaMult, float partialTicks) {
+
+ Vector3f interpolatedPlayerPosition = getInterpolatedPlayerPosition(partialTicks);
+ double x = block.getX() - interpolatedPlayerPosition.x;
+ double y = block.getY() - interpolatedPlayerPosition.y;
+ double z = block.getZ() - interpolatedPlayerPosition.z;
double distSq = x * x + y * y + z * z;
if (distSq > 10 * 10) {
RenderUtils.renderBeaconBeam(x, y, z, rgb, 1.0f, partialTicks, true);
} else {
- RenderUtils.renderBoundingBox(x, y, z, rgb, 1.0f, partialTicks);
+ RenderUtils.renderBoundingBoxInViewSpace(x, y, z, rgb);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/events/NEUEvent.java b/src/main/java/io/github/moulberry/notenoughupdates/events/NEUEvent.java
index 178431d0..ed8da0d5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/events/NEUEvent.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/events/NEUEvent.java
@@ -27,4 +27,8 @@ public class NEUEvent extends Event {
MinecraftForge.EVENT_BUS.post(this);
return isCancelable() && isCanceled();
}
+
+ public void cancel() {
+ setCanceled(true);
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/events/SpawnParticleEvent.java b/src/main/java/io/github/moulberry/notenoughupdates/events/SpawnParticleEvent.java
new file mode 100644
index 00000000..818ad0fa
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/events/SpawnParticleEvent.java
@@ -0,0 +1,97 @@
+/*
+ * 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.util.EnumParticleTypes;
+import net.minecraftforge.fml.common.eventhandler.Cancelable;
+
+@Cancelable
+public class SpawnParticleEvent extends NEUEvent {
+
+ // I LOVE code duplication!
+ // I LOVE repeating field names five times to declare a data class!
+ // I LOVE that yummy high fructose corn syrup!
+ // I LOVE the United Nations!
+
+ EnumParticleTypes particleTypes;
+ boolean isLongDistance;
+ double xCoord;
+ double yCoord;
+ double zCoord;
+ double xOffset;
+ double yOffset;
+ double zOffset;
+ int[] params;
+
+ public SpawnParticleEvent(
+ EnumParticleTypes particleTypes,
+ boolean isLongDistance,
+ double xCoord, double yCoord, double zCoord,
+ double xOffset, double yOffset, double zOffset,
+ int[] params
+ ) {
+ this.particleTypes = particleTypes;
+ this.isLongDistance = isLongDistance;
+ this.xCoord = xCoord;
+ this.yCoord = yCoord;
+ this.zCoord = zCoord;
+ this.xOffset = xOffset;
+ this.yOffset = yOffset;
+ this.zOffset = zOffset;
+ this.params = params;
+ }
+
+ public EnumParticleTypes getParticleTypes() {
+ return particleTypes;
+ }
+
+ public boolean isLongDistance() {
+ return isLongDistance;
+ }
+
+ public double getXCoord() {
+ return xCoord;
+ }
+
+ public double getYCoord() {
+ return yCoord;
+ }
+
+ public double getZCoord() {
+ return zCoord;
+ }
+
+ public double getXOffset() {
+ return xOffset;
+ }
+
+ public double getYOffset() {
+ return yOffset;
+ }
+
+ public double getZOffset() {
+ return zOffset;
+ }
+
+ public int[] getParams() {
+ return params;
+ }
+
+}
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 07f19a60..d5a8a53f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java
@@ -22,6 +22,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.util.Line;
import io.github.moulberry.notenoughupdates.core.util.Vec3Comparable;
+import io.github.moulberry.notenoughupdates.events.SpawnParticleEvent;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag;
import io.github.moulberry.notenoughupdates.util.NEUDebugLogger;
@@ -345,15 +346,15 @@ public class CrystalWishingCompassSolver {
* per-area structure missing, or because Hypixel.
* Always within 1 block of X=513 Y=106 Z=551.
*/
- public void onSpawnParticle(
- EnumParticleTypes particleType,
- double x,
- double y,
- double z
- ) {
+ @SubscribeEvent
+ public void onSpawnParticle(SpawnParticleEvent event) {
+ EnumParticleTypes particleType = event.getParticleTypes();
+ double x = event.getXCoord();
+ double y = event.getYCoord();
+ double z = event.getZCoord();
if (!NotEnoughUpdates.INSTANCE.config.mining.wishingCompassSolver ||
particleType != EnumParticleTypes.VILLAGER_HAPPY ||
- !SBInfo.getInstance().getLocation().equals("crystal_hollows")) {
+ !"crystal_hollows".equals(SBInfo.getInstance().getLocation())) {
return;
}
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 13a078a2..242bd443 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
@@ -21,6 +21,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.ChromaColour;
+import io.github.moulberry.notenoughupdates.events.SpawnParticleEvent;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.block.state.IBlockState;
@@ -380,24 +381,24 @@ public class FishingHelper {
return 1 / (d + (1 / (ZERO_PITCH - MAX_PITCH))) * (1 - d / MAX_DISTANCE) + MAX_PITCH;
}
- public boolean onSpawnParticle(
- EnumParticleTypes particleType,
- double x,
- double y,
- double z,
- double xOffset,
- double yOffset,
- double zOffset
- ) {
+ @SubscribeEvent
+ public void onSpawnParticle(SpawnParticleEvent event) {
+ EnumParticleTypes particleType = event.getParticleTypes();
+ double x = event.getXCoord();
+ double y = event.getYCoord();
+ double z = event.getZCoord();
+ double xOffset = event.getXOffset();
+ double yOffset = event.getYOffset();
+ double zOffset = event.getZOffset();
if (!NotEnoughUpdates.INSTANCE.config.fishing.hideOtherPlayerAll &&
!NotEnoughUpdates.INSTANCE.config.fishing.enableCustomParticles &&
!NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning &&
!NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarningR) {
- return false;
+ return;
}
if (hookEntities.isEmpty()) {
- return false;
+ return;
}
if ((particleType == EnumParticleTypes.WATER_WAKE || particleType == EnumParticleTypes.SMOKE_NORMAL) && Math.abs(
@@ -610,22 +611,24 @@ public class FishingHelper {
particleTypeI = NotEnoughUpdates.INSTANCE.config.fishing.yourParticleType;
particleCustomColour = NotEnoughUpdates.INSTANCE.config.fishing.yourParticleColour;
} else if (NotEnoughUpdates.INSTANCE.config.fishing.hideOtherPlayerAll) {
- return true;
+ event.cancel();
+ return;
} else {
particleTypeI = NotEnoughUpdates.INSTANCE.config.fishing.otherParticleType;
particleCustomColour = NotEnoughUpdates.INSTANCE.config.fishing.otherParticleColour;
}
if (!NotEnoughUpdates.INSTANCE.config.fishing.enableCustomParticles) {
- return false;
+