Skip to content

Commit 10788b6

Browse files
committed
long overdue update part 3
1 parent c993e25 commit 10788b6

35 files changed

Lines changed: 786 additions & 295 deletions

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ dependencies {
8585
}
8686

8787
modImplementation "com.terraformersmc:modmenu:0.1.1+mc1.8.9"
88+
89+
/* I want to use @Expressions :p */
90+
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.5.0-rc.2")))
8891
}
8992

9093
processResources {

src/main/java/io/github/axolotlclient/oldanimations/OldAnimations.java

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
public class OldAnimations implements ClientModInitializer {
3434

35+
//TODO: Clean this class up omg
36+
3537
public static final String MODID = "axolotlclient-oldanimations";
3638
public static boolean AXOLOTLCLIENT;
3739

@@ -55,6 +57,12 @@ public class OldAnimations implements ClientModInitializer {
5557
@Getter
5658
private final OptionCategory categoryGUI = OptionCategory.create("GUI");
5759

60+
@Getter
61+
private final OptionCategory categoryDebugOverlay = OptionCategory.create("Debug Overlay");
62+
63+
@Getter
64+
private final OptionCategory categoryTabOverlay = OptionCategory.create("Tab Overlay");
65+
5866
@Getter
5967
private final OptionCategory categoryEnchantmentGlint = OptionCategory.create("Enchantment Glint");
6068

@@ -71,7 +79,13 @@ public class OldAnimations implements ClientModInitializer {
7179
public final BooleanOption secondLayerDamageTint = new BooleanOption("secondLayerDamageTint", true);
7280
public final BooleanOption smoothSneaking = new BooleanOption("smoothSneaking", true);
7381
public final BooleanOption heartFlashing = new BooleanOption("heartFlashing", true);
74-
public final BooleanOption debugOverlay = new BooleanOption("debugOverlay", true);
82+
public final BooleanOption show1_7_10 = new BooleanOption("show1_7_10", true);
83+
public final BooleanOption debugInfo = new BooleanOption("debugInfo", true);
84+
public final BooleanOption disableDebugBackground = new BooleanOption("disableDebugBackground", true);
85+
public final BooleanOption debugCrosshair = new BooleanOption("debugCrosshair", true);
86+
public final BooleanOption debugTextSpacing = new BooleanOption("debugTextSpacing", true);
87+
public final BooleanOption debugTextColorScheme = new BooleanOption("debugTextColorScheme", true);
88+
public final BooleanOption debugTextShadow = new BooleanOption("debugTextShadow", true);
7589

7690
public final BooleanOption thirdPersonSmoothSneaking = new BooleanOption("thirdPersonSmoothSneaking", true);
7791
public final BooleanOption allowMiningCancel = new BooleanOption("allowMiningCancel", true);
@@ -92,6 +106,13 @@ public class OldAnimations implements ClientModInitializer {
92106
public final BooleanOption oldGlintColor = new BooleanOption("oldGlintColor", true);
93107
public final BooleanOption centeredSelectionMenus = new BooleanOption("centeredSelectionMenus", true);
94108

109+
public final BooleanOption tabDimensions = new BooleanOption("tabDimensions", true);
110+
public final BooleanOption disableTabPlayerHeads = new BooleanOption("disableTabPlayerHeads", true);
111+
public final BooleanOption disableTabHeader = new BooleanOption("disableTabHeader", true);
112+
public final BooleanOption disableTabFooter = new BooleanOption("disableTabFooter", true);
113+
114+
public final BooleanOption equipLogic = new BooleanOption("equipLogic", true);
115+
95116
public final BooleanOption oldDamageTick = new BooleanOption("oldDamageTick", true);
96117
public final BooleanOption oldSwingVisual = new BooleanOption("oldSwingVisual", true); /* use and mine particles */
97118
public final BooleanOption oldSwingVisualParticles = new BooleanOption("oldSwingVisualParticles", true); /* use and mine particles */
@@ -125,6 +146,10 @@ public static void runAfterFabricLoad(Runnable task) {
125146
} else tasks.add(task);
126147
}
127148

149+
public static boolean isClientPresent() {
150+
return FabricLoader.getInstance().getModContainer("axolotlclient").isPresent();
151+
}
152+
128153
@Override
129154
public void initClient() {
130155
category.add(getCategoryBlocking());
@@ -147,7 +172,8 @@ public void initClient() {
147172
mirroredProjectiles,
148173
oldItemPickup,
149174
fastItems,
150-
stickRod
175+
stickRod,
176+
equipLogic
151177
);
152178
category.add(getCategoryCombat());
153179
categoryCombat.add(
@@ -156,11 +182,31 @@ public void initClient() {
156182
);
157183
category.add(getCategoryGUI());
158184
categoryGUI.add(
185+
show1_7_10,
159186
heartFlashing,
160-
debugOverlay,
161187
centeredSelectionMenus,
162188
disableTitles
163189
);
190+
categoryGUI.add(getCategoryDebugOverlay());
191+
categoryDebugOverlay.add(
192+
debugInfo,
193+
disableDebugBackground,
194+
debugCrosshair,
195+
debugTextSpacing,
196+
debugTextColorScheme,
197+
debugTextShadow
198+
);
199+
categoryGUI.add(getCategoryTabOverlay());
200+
categoryTabOverlay.add(
201+
tabDimensions,
202+
disableTabHeader,
203+
disableTabFooter
204+
);
205+
if (FabricLoader.getInstance().getModContainer("axolotlclient").isEmpty()) {
206+
categoryTabOverlay.add(
207+
disableTabPlayerHeads
208+
);
209+
}
164210
category.add(getCategoryEnchantmentGlint());
165211
categoryEnchantmentGlint.add(
166212
oldGlint,

src/main/java/io/github/axolotlclient/oldanimations/mixin/DebugHudMixin.java

Lines changed: 0 additions & 161 deletions
This file was deleted.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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 com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
23+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
24+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
25+
import io.github.axolotlclient.oldanimations.OldAnimations;
26+
import io.github.axolotlclient.oldanimations.util.DebugComponents;
27+
import net.minecraft.client.Minecraft;
28+
import net.minecraft.client.gui.GuiElement;
29+
import net.minecraft.client.gui.overlay.DebugOverlay;
30+
import net.minecraft.client.render.TextRenderer;
31+
import org.objectweb.asm.Opcodes;
32+
import org.spongepowered.asm.mixin.Final;
33+
import org.spongepowered.asm.mixin.Mixin;
34+
import org.spongepowered.asm.mixin.Shadow;
35+
import org.spongepowered.asm.mixin.injection.At;
36+
import org.spongepowered.asm.mixin.injection.Inject;
37+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
38+
39+
import java.util.List;
40+
41+
@Mixin(DebugOverlay.class)
42+
public abstract class DebugOverlayMixin {
43+
44+
@Shadow
45+
@Final
46+
private TextRenderer textRenderer;
47+
48+
@ModifyExpressionValue(method = "getGameInfo", at = @At(value = "CONSTANT", args = "stringValue=Minecraft 1.8.9 ("))
49+
private String axolotlclient$spoofDebugVersion(String original) {
50+
/* nostalgiaaaa */
51+
return OldAnimations.isEnabled() && OldAnimations.getInstance().show1_7_10.get() ? "Minecraft 1.7.10 (" : original;
52+
}
53+
54+
@WrapOperation(method = "getGameInfo", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getGameVersion()Ljava/lang/String;"))
55+
private String axolotlclient$spoofDebugVersion2(Minecraft instance, Operation<String> original) {
56+
/* why does it show the game version twice!!?? */
57+
return OldAnimations.isEnabled() && OldAnimations.getInstance().show1_7_10.get() ? "1.7.10" : original.call(instance);
58+
}
59+
60+
@ModifyExpressionValue(method = "drawGameInfo", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/overlay/DebugOverlay;getGameInfo()Ljava/util/List;"))
61+
private List<String> axolotlclient$replaceGameInfo(List<String> original) {
62+
return OldAnimations.isEnabled() && OldAnimations.getInstance().debugInfo.get() ? DebugComponents.getLeft() : original;
63+
}
64+
65+
@Inject(method = "drawGameInfo", at = @At("TAIL"), remap = false)
66+
private void axolotlclient$addBottomLeftColumn(CallbackInfo ci) {
67+
if (OldAnimations.isEnabled() && OldAnimations.getInstance().debugInfo.get()) {
68+
/* renders the bottom left column of debug text, but in the greyish color just like 1.7 */
69+
final int fontHeight = textRenderer.fontHeight - (OldAnimations.getInstance().debugTextSpacing.get() ? 1 : 0);
70+
int top = DebugComponents.getLeft().size() * 10 + 4 /* should be 64, just like 1.7 */;
71+
for (String msg : DebugComponents.getLeftBottom()) {
72+
if (msg == null) continue;
73+
if (!OldAnimations.getInstance().disableDebugBackground.get()) {
74+
GuiElement.fill(1, top - 1, 2 + textRenderer.getWidth(msg) + 1, top + fontHeight - 1, -1873784752);
75+
}
76+
textRenderer.draw(msg, 2, top, 14737632, OldAnimations.getInstance().debugTextShadow.get());
77+
top += fontHeight;
78+
}
79+
}
80+
}
81+
82+
@ModifyExpressionValue(method = "drawSystemInfo", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/overlay/DebugOverlay;getSystemInfo()Ljava/util/List;"))
83+
private List<String> axolotlclient$replaceSystemInfo(List<String> original) {
84+
return OldAnimations.isEnabled() && OldAnimations.getInstance().debugInfo.get() ? DebugComponents.getRight() : original;
85+
}
86+
87+
@WrapOperation(method = {"drawGameInfo", "drawSystemInfo"}, at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/render/TextRenderer;fontHeight:I"))
88+
private int axolotlclient$changeFontHeight(TextRenderer instance, Operation<Integer> original) {
89+
return OldAnimations.isEnabled() && OldAnimations.getInstance().debugTextSpacing.get() ? 10 : original.call(instance);
90+
}
91+
92+
@WrapWithCondition(method = {"drawGameInfo", "drawSystemInfo"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/overlay/DebugOverlay;fill(IIIII)V"))
93+
private boolean axolotlclient$removeBackgroundRectangle(int left, int top, int right, int bottom, int color) {
94+
/* disable rendering the rectangular background, just like 1.7 */
95+
return !OldAnimations.isEnabled() || !OldAnimations.getInstance().disableDebugBackground.get();
96+
}
97+
98+
@WrapOperation(method = "drawSystemInfo", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/TextRenderer;draw(Ljava/lang/String;III)I"))
99+
private int axolotlclient$addTextShadow(TextRenderer instance, String text, int x, int y, int color, Operation<Integer> original) {
100+
/* uses the alternative drawString method which allows text shadows, just like in 1.7 */
101+
return instance.draw(text, x, y, color, OldAnimations.isEnabled() && OldAnimations.getInstance().debugTextShadow.get());
102+
}
103+
104+
@WrapOperation(method = "drawGameInfo", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/TextRenderer;draw(Ljava/lang/String;III)I"))
105+
private int axolotlclient$addTextShadow2(TextRenderer instance, String text, int x, int y, int color, Operation<Integer> original) {
106+
/* same as above redirect, but the text is white, just like in 1.7 */
107+
int textColor = OldAnimations.isEnabled() && OldAnimations.getInstance().debugTextColorScheme.get() ? 16777215 : 0xE0E0E0;
108+
return instance.draw(text, x, y, textColor, OldAnimations.isEnabled() && OldAnimations.getInstance().debugTextShadow.get());
109+
}
110+
}

0 commit comments

Comments
 (0)