Skip to content

Commit b950641

Browse files
committed
reload resources regardless of pack change
1 parent d539b59 commit b950641

File tree

4 files changed

+52
-1
lines changed

4 files changed

+52
-1
lines changed

src/main/java/io/github/axolotlclient/oldanimations/config/OldAnimationsConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public class OldAnimationsConfig {
113113
public final BooleanOption oldTallGrassTexture = new BooleanOption("oldTallGrassTexture", false);
114114
public final BooleanOption oldFogGrayScale = new BooleanOption("oldFogGrayScale", true);
115115
public final BooleanOption oldDamageTintLighting = new BooleanOption("oldDamageTintLighting", true);
116+
public final BooleanOption refreshResourcesRegardless = new BooleanOption("refreshResourcesRegardless", false);
116117

117118
private final Supplier<Boolean>[] suppliers = new Supplier[] {
118119
enabled::get,
@@ -198,6 +199,7 @@ public void initConfig() {
198199
disableSkinCustomizationButton,
199200
oldMultiplayerSettingsPage,
200201
oldDifficultyButtonLogic,
202+
refreshResourcesRegardless,
201203
moveSprintKeybind,
202204
disableTitles
203205
);
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* This program is free software; you can redistribute it and/or
3+
* modify it under the terms of the GNU Lesser General Public
4+
* License as published by the Free Software Foundation; either
5+
* version 3 of the License, or (at your option) any later version.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10+
* Lesser General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU Lesser General Public License
13+
* along with this program; if not, write to the Free Software Foundation,
14+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15+
*
16+
* For more information, see the LICENSE file.
17+
*/
18+
19+
package io.github.axolotlclient.oldanimations.mixin;
20+
21+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
22+
import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig;
23+
import net.minecraft.client.gui.screen.ResourcePackScreen;
24+
import org.objectweb.asm.Opcodes;
25+
import org.spongepowered.asm.mixin.Mixin;
26+
import org.spongepowered.asm.mixin.injection.At;
27+
28+
@Mixin(ResourcePackScreen.class)
29+
public class ResourcePackScreenMixin {
30+
31+
@ModifyExpressionValue(method = "init", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/gui/screen/ResourcePackScreen;changed:Z"))
32+
private boolean axolotlclient$refreshResourcesWhenDone(boolean original) {
33+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.refreshResourcesRegardless.get()) {
34+
return false;
35+
}
36+
return original;
37+
}
38+
39+
@ModifyExpressionValue(method = "buttonClicked", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/gui/screen/ResourcePackScreen;changed:Z"))
40+
private boolean axolotlclient$refreshResourcesWhenDone2(boolean original) {
41+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.refreshResourcesRegardless.get()) {
42+
return true;
43+
}
44+
return original;
45+
}
46+
}

src/main/resources/assets/axolotlclient-oldanimations/lang/en_us.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,7 @@
138138
"oldFogGrayScale": "Old Fog Grayscale Logic",
139139
"oldFogGrayScale.tooltip": "Calculates fog's grayscale effect starting from the player's eyeline and not their feet just like in 1.7.",
140140
"oldDamageTintLighting": "Apply Lighting to Damage Tint",
141-
"oldDamageTintLighting.tooltip": "Allows the damage tint's red hue to be influenced by the surrounding lighting just like in 1.7."
141+
"oldDamageTintLighting.tooltip": "Allows the damage tint's red hue to be influenced by the surrounding lighting just like in 1.7.",
142+
"refreshResourcesRegardless": "Refresh Resources Regardless Of Change",
143+
"refreshResourcesRegardless.tooltip": "Refreshes game resources when the done button is pressed in the resource packs window regardless of whether or not the pack was changed. Behavior taken straight from 1.7."
142144
}

src/main/resources/oldanimations.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"PlayerRendererMixin",
3838
"PlayerTabOverlayMixin",
3939
"ProjectileRendererMixin",
40+
"ResourcePackScreenMixin",
4041
"ServerListEntryWidgetMixin",
4142
"ServerPlayerEntityMixin",
4243
"WorldRendererMixin",

0 commit comments

Comments
 (0)