Skip to content

Commit b276778

Browse files
authored
noob update
1 parent 5a34a39 commit b276778

10 files changed

Lines changed: 3400 additions & 25 deletions

File tree

src/main/java/com/nerds/addon/NerdAddon.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.nerds.addon;
22

3+
import com.mojang.logging.LogUtils;
34
import com.nerds.addon.commands.CommandExample;
45
import com.nerds.addon.hud.HudExample;
5-
import com.nerds.addon.modules.JoinLeaveNotify;
6-
import com.nerds.addon.modules.WindowTitleRenamer;
7-
import com.mojang.logging.LogUtils;
6+
7+
import com.nerds.addon.modules.*;
88
import meteordevelopment.meteorclient.addons.GithubRepo;
99
import meteordevelopment.meteorclient.addons.MeteorAddon;
1010
import meteordevelopment.meteorclient.commands.Commands;
@@ -23,10 +23,12 @@ public class NerdAddon extends MeteorAddon {
2323
public void onInitialize() {
2424
LOG.info("Initializing Nerd Addon");
2525

26-
26+
2727
Modules.get().add(new JoinLeaveNotify());
2828
Modules.get().add(new WindowTitleRenamer());
29-
29+
Modules.get().add(new Loadouts());
30+
Modules.get().add(new AutoEmoji());
31+
Modules.get().add(new FastSwim());
3032

3133
// Commands
3234
Commands.add(new CommandExample());
@@ -49,4 +51,4 @@ public String getPackage() {
4951
public GithubRepo getRepo() {
5052
return new GithubRepo("Frko5000", "nerd-addon");
5153
}
52-
}
54+
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// skidded by ___hj from skid hack
2+
3+
4+
5+
package com.nerds.addon.mixin;
6+
7+
import net.minecraft.text.Text;
8+
import org.jetbrains.annotations.Nullable;
9+
import com.nerds.addon.modules.Loadouts;
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.Unique;
12+
import net.minecraft.client.gui.tooltip.Tooltip;
13+
import org.spongepowered.asm.mixin.injection.At;
14+
import net.minecraft.screen.PlayerScreenHandler;
15+
import net.minecraft.entity.player.PlayerInventory;
16+
import org.spongepowered.asm.mixin.injection.Inject;
17+
import net.minecraft.client.gui.widget.ButtonWidget;
18+
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
19+
import meteordevelopment.meteorclient.systems.modules.Modules;
20+
import net.minecraft.client.gui.screen.ingame.RecipeBookScreen;
21+
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
22+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
23+
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
24+
25+
26+
@Mixin(InventoryScreen.class)
27+
public abstract class InventoryScreenMixin extends RecipeBookScreen<PlayerScreenHandler>
28+
implements RecipeBookProvider {
29+
30+
public InventoryScreenMixin(PlayerScreenHandler handler, RecipeBookWidget<?> recipeBook, PlayerInventory inventory, Text title) {
31+
super(handler, recipeBook, inventory, title);
32+
}
33+
34+
@Unique @Nullable
35+
private Loadouts loadouts = null;
36+
37+
@Unique @Nullable
38+
private ButtonWidget saveLoadoutButton = null;
39+
40+
@Unique @Nullable
41+
private ButtonWidget loadLoadoutButton = null;
42+
43+
@Unique
44+
private void onSaveLoadoutButtonPress(ButtonWidget btn) {
45+
if (loadouts == null) {
46+
Modules modules = Modules.get();
47+
if (modules == null) return;
48+
loadouts = modules.get(Loadouts.class);
49+
if (loadouts == null) return;
50+
}
51+
loadouts.saveLoadout("quicksave");
52+
btn.setMessage(Text.literal("§6§o✨§fSave"));
53+
}
54+
55+
@Unique
56+
private void onLoadLoadoutButtonPress(ButtonWidget btn) {
57+
if (loadouts == null) {
58+
Modules modules = Modules.get();
59+
if (modules == null) return;
60+
loadouts = modules.get(Loadouts.class);
61+
if (loadouts == null) return;
62+
}
63+
loadouts.loadLoadout("quicksave");
64+
btn.setMessage(Text.literal("Load§6§o✨"));
65+
}
66+
67+
@Inject(method = "init", at = @At("TAIL"))
68+
private void mixinInit(CallbackInfo ci) {
69+
if (loadouts == null) {
70+
Modules modules = Modules.get();
71+
if (modules == null) return;
72+
loadouts = modules.get(Loadouts.class);
73+
if (loadouts == null) return;
74+
}
75+
76+
if (!loadouts.quickLoadout.get()) return;
77+
saveLoadoutButton = this.addDrawableChild(
78+
ButtonWidget.builder(
79+
Text.literal("§6§o✨§fSave"),
80+
btn -> onSaveLoadoutButtonPress(btn)
81+
)
82+
.dimensions(this.width / 2 - 42, this.height / 2 + 83, 42, 16)
83+
.tooltip(Tooltip.of(Text.literal("§7§oSave your current inventory to Loadouts.")))
84+
.build()
85+
);
86+
87+
loadLoadoutButton = this.addDrawableChild(
88+
ButtonWidget.builder(
89+
Text.literal("Load§6§o✨"),
90+
btn -> onLoadLoadoutButtonPress(btn)
91+
)
92+
.dimensions(this.width / 2, this.height / 2 + 83, 42, 16)
93+
.tooltip(Tooltip.of(Text.literal("§7§oLoad your quicksave loadout.")))
94+
.build()
95+
);
96+
97+
if (saveLoadoutButton != null) saveLoadoutButton.visible = loadouts.isActive();
98+
if (loadLoadoutButton != null) loadLoadoutButton.visible = loadouts.isActive();
99+
}
100+
101+
@Inject(method = "render", at = @At("TAIL"))
102+
private void mixinRender(CallbackInfo ci) {
103+
if (loadouts == null) {
104+
Modules modules = Modules.get();
105+
if (modules == null) return;
106+
loadouts = modules.get(Loadouts.class);
107+
if (loadouts == null) return;
108+
}
109+
110+
if (!loadouts.quickLoadout.get()) return;
111+
if (saveLoadoutButton != null) saveLoadoutButton.visible = loadouts.isActive();
112+
if (loadLoadoutButton != null) loadLoadoutButton.visible = loadouts.isActive();
113+
}
114+
115+
@Inject(method = "handledScreenTick", at = @At("HEAD"))
116+
private void animateButtons(CallbackInfo ci) {
117+
if (loadouts == null) {
118+
Modules modules = Modules.get();
119+
if (modules == null) return;
120+
loadouts = modules.get(Loadouts.class);
121+
if (loadouts == null) return;
122+
}
123+
124+
if (!loadouts.quickLoadout.get()) return;
125+
if (loadouts.isActive() && !loadouts.isSorted) {
126+
if (saveLoadoutButton != null) saveLoadoutButton.setMessage(Text.literal("§6§o✨§fSave"));
127+
if (loadLoadoutButton != null) loadLoadoutButton.setMessage(Text.literal("Load§6§o✨"));
128+
}
129+
}
130+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// skidded by ___hj from skid hack
2+
3+
package com.nerds.addon.modules;
4+
5+
import com.google.gson.Gson;
6+
import com.google.gson.reflect.TypeToken;
7+
import com.nerds.addon.NerdAddon;
8+
import meteordevelopment.meteorclient.events.game.SendMessageEvent;
9+
import meteordevelopment.meteorclient.systems.modules.Module;
10+
import meteordevelopment.orbit.EventHandler;
11+
import net.minecraft.client.MinecraftClient;
12+
import java.io.InputStreamReader;
13+
import java.io.InputStream;
14+
import java.nio.charset.StandardCharsets;
15+
import java.util.HashMap;
16+
import java.util.Map;
17+
18+
public class AutoEmoji extends Module {
19+
private static final Map<String, String> EMOJIS = new HashMap<>();
20+
21+
public AutoEmoji() {
22+
super(NerdAddon.CATEGORY, "auto-emoji", "adds discord emojis like :sob: and other ones to format in chat");
23+
loadEmojiMappings();
24+
}
25+
26+
private void loadEmojiMappings() {
27+
EMOJIS.clear();
28+
29+
30+
EMOJIS.put(":)", "☺");
31+
EMOJIS.put(":(", "☹");
32+
EMOJIS.put("<3", "❤");
33+
EMOJIS.put(":D", "😀");
34+
EMOJIS.put(";)", "😉");
35+
EMOJIS.put("B)", "😎");
36+
EMOJIS.put(":/", "😕");
37+
EMOJIS.put(":O", "😮");
38+
EMOJIS.put("xD", "😆");
39+
40+
41+
try {
42+
43+
InputStream stream = MinecraftClient.getInstance()
44+
.getResourceManager()
45+
.getResource(net.minecraft.util.Identifier.of("nerd-addon", "emojis.json"))
46+
.get()
47+
.getInputStream();
48+
49+
if (stream != null) {
50+
InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8);
51+
52+
Map<String, String> jsonMappings = new Gson().fromJson(
53+
reader,
54+
new TypeToken<Map<String, String>>(){}.getType()
55+
);
56+
57+
if (jsonMappings != null) {
58+
for (Map.Entry<String, String> entry : jsonMappings.entrySet()) {
59+
String emojiValue = entry.getValue();
60+
61+
if (emojiValue != null) {
62+
emojiValue = emojiValue.replace("\uFE0F", "").replace("\u200D", "");
63+
}
64+
65+
66+
EMOJIS.put(entry.getKey(), emojiValue);
67+
}
68+
}
69+
reader.close();
70+
}
71+
} catch (Exception e) {
72+
warning("Failed to parse or sanitize your custom auto-emoji asset JSON: " + e.getMessage());
73+
}
74+
}
75+
76+
@EventHandler
77+
private void onSendMessage(SendMessageEvent event) {
78+
String message = event.message;
79+
80+
for (Map.Entry<String, String> entry : EMOJIS.entrySet()) {
81+
if (message.contains(entry.getKey())) {
82+
message = message.replace(entry.getKey(), entry.getValue());
83+
}
84+
}
85+
86+
87+
if (message.contains("\uFE0F")) {
88+
message = message.replace("\uFE0F", "");
89+
}
90+
if (message.contains("\u200D")) {
91+
message = message.replace("\u200D", "");
92+
}
93+
94+
95+
if (!message.equals(event.message)) {
96+
event.message = message;
97+
}
98+
}
99+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// skidded by ___hj from skid hack
2+
3+
4+
5+
package com.nerds.addon.modules;
6+
7+
import com.nerds.addon.NerdAddon;
8+
import meteordevelopment.meteorclient.events.world.TickEvent;
9+
import meteordevelopment.meteorclient.settings.DoubleSetting;
10+
import meteordevelopment.meteorclient.settings.Setting;
11+
import meteordevelopment.meteorclient.settings.SettingGroup;
12+
import meteordevelopment.meteorclient.systems.modules.Module;
13+
import meteordevelopment.orbit.EventHandler;
14+
import net.minecraft.util.math.Vec3d;
15+
16+
public class FastSwim extends Module {
17+
18+
private final SettingGroup sgGeneral = settings.getDefaultGroup();
19+
20+
private final Setting<Double> multiplier = sgGeneral.add(new DoubleSetting.Builder()
21+
.name("multiplier")
22+
.description("how much faster you swim")
23+
.defaultValue(2.0)
24+
.min(1.0)
25+
.sliderMax(10.0)
26+
.build()
27+
);
28+
29+
private static final double BASE_SWIM_SPEED = 0.1;
30+
31+
public FastSwim() {
32+
super(NerdAddon.CATEGORY, "fast-swim", "Makes you swim faster");
33+
}
34+
35+
@EventHandler
36+
private void onTick(TickEvent.Pre event) {
37+
if (mc.player == null || mc.world == null) return;
38+
if (!mc.player.isTouchingWater()) return;
39+
if (mc.player.input == null) return;
40+
41+
float forward = ((mc.options.forwardKey.isPressed() ? 1f : 0f) - (mc.options.backKey.isPressed() ? 1f : 0f));
42+
float sideways = ((mc.options.leftKey.isPressed() ? 1f : 0f) - (mc.options.rightKey.isPressed() ? 1f : 0f));
43+
if (forward == 0 && sideways == 0) return;
44+
45+
float yaw = mc.player.getYaw();
46+
double yawRad = Math.toRadians(yaw);
47+
48+
double targetX = (-Math.sin(yawRad) * forward + Math.cos(yawRad) * sideways);
49+
double targetZ = ( Math.cos(yawRad) * forward + Math.sin(yawRad) * sideways);
50+
51+
double len = Math.sqrt(targetX * targetX + targetZ * targetZ);
52+
if (len > 1e-4) {
53+
targetX = (targetX / len) * BASE_SWIM_SPEED * multiplier.get();
54+
targetZ = (targetZ / len) * BASE_SWIM_SPEED * multiplier.get();
55+
}
56+
57+
Vec3d vel = mc.player.getVelocity();
58+
mc.player.setVelocity(targetX, vel.y, targetZ);
59+
}
60+
}

0 commit comments

Comments
 (0)