~williewillus/violet-moon

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH botania v2] Warn when optifine is present

Details
Message ID
<20230514163056.43840-1-theArtemisSystem@gmail.com>
DKIM signature
missing
Download raw message
Patch: +16 -0
---
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] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CSM5KF9J50EQ.2IYZ3NEOYW1ZZ@cirno2>
In-Reply-To
<20230514163056.43840-1-theArtemisSystem@gmail.com> (view parent)
DKIM signature
missing
Download raw message
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]: theartemissystem@gmail.com

✓ #989765 SUCCESS botania/patches/linux.yml https://builds.sr.ht/~williewillus/job/989765
Details
Message ID
<87zg66ipp7.fsf@vincent-lee.net>
In-Reply-To
<20230514163056.43840-1-theArtemisSystem@gmail.com> (view parent)
DKIM signature
missing
Download raw message
lgtm, but check two minor nits below before commiting

Artemis System <theartemissystem@gmail.com> writes:

> ---
> 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;

I would call this `didOptifineDetection`, the way it's named now makes
me think if it's true then optifine is present when it actually means
we've just done the check. Also the variable can be private.

> +
> +	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.",

typo: ... as an alternative [to] Optifine's ...

>  
>    "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
Reply to thread Export thread (mbox)