~williewillus/violet-moon

botania: Warn when optifine is present v2 APPLIED

Artemis System: 1
 Warn when optifine is present

 3 files changed, 16 insertions(+), 0 deletions(-)
#989765 linux.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~williewillus/violet-moon/patches/41134/mbox | git am -3
Learn more about email & git

[PATCH botania v2] Warn when optifine is present Export this patch

---
minor spelling mistake
 .../java/vazkii/botania/client/gui/HUDHandler.java | 14 ++++++++++++++
 .../main/resources/assets/botania/lang/en_us.json  |  1 +
 web/changelog.md                                   |  1 +
 3 files changed, 16 insertions(+)

diff --git a/Xplat/src/main/java/vazkii/botania/client/gui/HUDHandler.java b/Xplat/src/main/java/vazkii/botania/client/gui/HUDHandler.java
index 9246d9057..2814144bf 100644
--- a/Xplat/src/main/java/vazkii/botania/client/gui/HUDHandler.java
+++ b/Xplat/src/main/java/vazkii/botania/client/gui/HUDHandler.java
@@ -18,6 +18,7 @@
import net.minecraft.client.gui.screens.ChatScreen;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.util.profiling.ProfilerFiller;
@@ -65,6 +66,18 @@ private HUDHandler() {}

	public static final ResourceLocation manaBar = new ResourceLocation(ResourcesLib.GUI_MANA_HUD);

	public static boolean optifineDetected = false;

	public static void tryOptifineWarning() {
		if (!optifineDetected) {
			try {
				Class.forName("optifine.Installer");
				Minecraft.getInstance().player.sendSystemMessage(Component.translatable("botaniamisc.optifine_warning"));
				optifineDetected = true;
			} catch (ClassNotFoundException ignored) {}
		}
	}

	public static void onDrawScreenPost(PoseStack ms, float partialTicks) {
		Minecraft mc = Minecraft.getInstance();
		if (mc.options.hideGui) {
@@ -102,6 +115,7 @@ public static void onDrawScreenPost(PoseStack ms, float partialTicks) {

			if (PlayerHelper.hasAnyHeldItem(mc.player)) {
				if (PlayerHelper.hasHeldItemClass(mc.player, WandOfTheForestItem.class)) {
					tryOptifineWarning();
					var hud = ClientXplatAbstractions.INSTANCE.findWandHud(mc.level, bpos, state, tile);
					if (hud != null) {
						profiler.push("wandItem");
diff --git a/Xplat/src/main/resources/assets/botania/lang/en_us.json b/Xplat/src/main/resources/assets/botania/lang/en_us.json
index 23d656095..cdf7968c6 100644
--- a/Xplat/src/main/resources/assets/botania/lang/en_us.json
+++ b/Xplat/src/main/resources/assets/botania/lang/en_us.json
@@ -28,6 +28,7 @@
  "botaniamisc.filter2": "Pickup any items",
  "botaniamisc.retainer.retain_all": "Retain original number of items requested",
  "botaniamisc.retainer.retain_missing": "Retain number of missing items",
  "botaniamisc.optifine_warning": "§4[WARNING]§r <Botania>: Optifine detected. Please be aware that Optifine causes a lot of issues with botania, and you might experience issues such as mana not moving between flowers and spreaders, and no information being displayed when you hold a wand and look at a mana pool or spreader. We recommend Sodium as an alternative Optifine's performance improvements.",

  "botaniamisc.creativePool0": "Creative Mana Pool, has infinite Mana",
  "botaniamisc.creativePool1": "Worthy of an Egoist",
diff --git a/web/changelog.md b/web/changelog.md
index 7151d06ad..78f4e5e63 100644
--- a/web/changelog.md
+++ b/web/changelog.md
@@ -25,6 +25,7 @@ and start a new "Upcoming" section.
* Add: All wand HUDs now have backgrounds for better readability, along with some other changes on some HUDs. Their design is not finalized, let us know on discord/reddit/irc/email if you have suggestions for how they can be better!
* Add: Bound flowers now show the type of spreader/pool they're bound to in the tooltip, instead of a generic spreader/pool
* Add: Rannuncarpus can now add blocks onto existing blocks like candles and sea pickles, which accept multiple placements of itself in the same block space
* Add: The game now warns you if you hold a wand of the forest with Optifine installed, as it breaks the entire mod. We recommend Sodium instead if you need a performance boost
* Change: Instead of always cooling down for 5 minutes, thermalilies now have a random cooldown between 20 seconds and 5 minutes. For automation, you can read how long the cooldown is with a comparator
* Change: Entropinnyum's "unethical TNT" detection was changed, it's now more accurate and shouldn't cause any false positives
* Change: Flower pouches now render missing flowers transparently, and render a "1" next to stacks with one item
-- 
2.39.2 (Apple Git-143)
botania/patches/linux.yml: SUCCESS in 17m13s

[Warn when optifine is present][0] v2 from [Artemis System][1]

[0]: https://lists.sr.ht/~williewillus/violet-moon/patches/41134
[1]: mailto:theartemissystem@gmail.com

✓ #989765 SUCCESS botania/patches/linux.yml https://builds.sr.ht/~williewillus/job/989765
lgtm, but check two minor nits below before commiting

Artemis System <theartemissystem@gmail.com> writes: