Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit c8081b2

Browse files
committed
0.8.0 - GrimDisabler AutoChestplate & Binds
1 parent eaa9b95 commit c8081b2

File tree

7 files changed

+96
-14
lines changed

7 files changed

+96
-14
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ My personal RusherHack tweaks plugin
1010
- AutoArmor:
1111
- RepairPriority - Prioritize low durability armor with mending
1212
- GoldenPriority - Prioritize one piece of golden armor for piglins
13-
- PriorityBinds - Key binds for priority setting toggles
13+
- Priority Binds - Key binds for priority setting toggles
1414
- AutoWalk/ElytraFly/RotationLock:
1515
- PauseOnUse - Pause modules while using/eating
1616
- AutoRestart - Automatically restart **packet** fly if your speed drops (Requested by _0lw)
1717
- Armor HUD:
1818
- Durability101 - Durability101 Mod
19+
- Elytra Tweaks:
20+
- GrimDisabler AutoChestplate - Automatically disable AutoArmor ElytraPriority
21+
- GrimDisabler Binds - Key binds for GrimDisabler
1922
- FullBright:
2023
- NightVision - Client side night vision effect (for shaders)
2124

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ minecraft_version=1.20.4
77
parchment_version=2024.04.14
88

99
# Plugin Properties
10-
plugin_version=0.7.0
10+
plugin_version=0.8.0
1111
maven_group=com.shaybox.rusher
1212
archives_base_name=shays-rusher-plugin

src/main/java/com/shaybox/rusher/Main.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Main extends Plugin {
2626
private final EventListener armorPriority = new ArmorPriority();
2727
private final EventListener autoRestart = new AutoRestart();
2828
private final EventListener durability101 = new Durability101();
29+
private final EventListener grimDisabler = new GrimDisabler();
2930
private final EventListener nightVision = new NightVision();
3031
private final EventListener pauseOnUse = new PauseOnUse();
3132

@@ -35,6 +36,7 @@ public void onLoad() {
3536
this.eventBus.subscribe(this.armorPriority);
3637
this.eventBus.subscribe(this.autoRestart);
3738
this.eventBus.subscribe(this.durability101);
39+
this.eventBus.subscribe(this.grimDisabler);
3840
this.eventBus.subscribe(this.nightVision);
3941
this.eventBus.subscribe(this.pauseOnUse);
4042
}
@@ -44,6 +46,7 @@ public void onUnload() {
4446
this.eventBus.unsubscribe(this.armorPriority);
4547
this.eventBus.unsubscribe(this.autoRestart);
4648
this.eventBus.unsubscribe(this.durability101);
49+
this.eventBus.unsubscribe(this.grimDisabler);
4750
this.eventBus.unsubscribe(this.nightVision);
4851
this.eventBus.unsubscribe(this.pauseOnUse);
4952
}

src/main/java/com/shaybox/rusher/tweaks/ArmorPriority.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ private void onUpdate(EventUpdate event) {
9494
Main.handleKey(this.goldenPriorityBind::getValue, this.isGoldenDown, (value) -> this.isGoldenDown = value, this.goldenPriority::getValue, this.goldenPriority::setValue);
9595
}
9696

97-
@Subscribe
9897
@SuppressWarnings("unused")
98+
@Subscribe
9999
private void onPlayerUpdate(EventPlayerUpdate event) {
100100
LocalPlayer player = event.getPlayer();
101101
Inventory inventory = player.getInventory();
@@ -125,7 +125,7 @@ private void onPlayerUpdate(EventPlayerUpdate event) {
125125
player.inventoryMenu.slots.stream()
126126
.filter(slot -> slot.getItem().getItem() instanceof Equipable e && e.getEquipmentSlot() == equipmentSlot)
127127
.filter(slot -> EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MENDING, slot.getItem()) > 0)
128-
.min(Comparator.comparingInt(slot -> slot.getItem().getDamageValue()))
128+
.max(Comparator.comparingInt(slot -> slot.getItem().getDamageValue()))
129129
.ifPresent(slot -> {
130130
Slot armorSlot = player.inventoryMenu.getSlot(armorSlotId);
131131
ItemStack armorStack = armorSlot.getItem();

src/main/java/com/shaybox/rusher/tweaks/Durability101.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.rusherhack.client.api.events.render.EventRender2D;
1515
import org.rusherhack.client.api.feature.hud.HudElement;
1616
import org.rusherhack.client.api.feature.hud.TextHudElement;
17+
import org.rusherhack.client.api.render.IRenderer2D;
1718
import org.rusherhack.client.api.render.font.IFontRenderer;
1819
import org.rusherhack.client.api.system.IHudManager;
1920
import org.rusherhack.client.api.ui.theme.IThemeManager;
@@ -22,6 +23,7 @@
2223
import org.rusherhack.core.event.subscribe.Subscribe;
2324
import org.rusherhack.core.setting.BooleanSetting;
2425
import org.rusherhack.core.setting.EnumSetting;
26+
import org.rusherhack.core.setting.NumberSetting;
2527

2628
import java.text.DecimalFormat;
2729
import java.util.ArrayList;
@@ -48,13 +50,14 @@ public class Durability101 implements EventListener {
4850
/* Custom Settings */
4951
private final BooleanSetting durability101 = new BooleanSetting("Durability101", "Durability101 Mod for Armor HUD", false);
5052
private final BooleanSetting unbreaking = new BooleanSetting("Unbreaking", "Estimates Unbreaking Durability", false);
53+
private final NumberSetting<Integer> yOffset = new NumberSetting<>("Y Offset", "Manual Y Offset", 0, -15, 15);
5154

5255
/* Temporary */
5356
private final TextHudElement watermark = (TextHudElement) hudManager.getFeature("Watermark").orElseThrow();
5457

5558
/* Initialize */
5659
public Durability101() {
57-
this.durability101.addSubSettings(this.unbreaking);
60+
this.durability101.addSubSettings(this.unbreaking, this.yOffset);
5861
this.armor.registerSettings(this.durability101);
5962
}
6063

@@ -81,15 +84,16 @@ private void onRender2D(EventRender2D event) {
8184
double startX = this.armor.getStartX(), startY = this.armor.getStartY();
8285
double width = this.armor.getWidth(), height = this.armor.getHeight();
8386

84-
/* Matrix Stack */
85-
PoseStack matrixStack = event.getMatrixStack();
86-
matrixStack.pushPose();
87-
matrixStack.translate(startX, startY, 0);
88-
matrixStack.scale(scale * 0.5F, scale * 0.5F, 0);
89-
9087
/* Font Renderer */
88+
PoseStack matrixStack = event.getMatrixStack();
89+
IRenderer2D renderer = this.armor.getRenderer();
9190
IFontRenderer fontRenderer = this.armor.getFontRenderer();
92-
fontRenderer.begin(matrixStack);
91+
renderer.begin(matrixStack, fontRenderer);
92+
93+
/* Matrix Stack */
94+
matrixStack.pushPose();
95+
matrixStack.translate(startX, startY + this.yOffset.getValue(), 1);
96+
matrixStack.scale(scale * 0.5F, scale * 0.5F, 1);
9397

9498
/* Player Armor Slots (Clone & Reverse) */
9599
Inventory inventory = player.getInventory();
@@ -144,7 +148,7 @@ private void onRender2D(EventRender2D event) {
144148
fontRenderer.drawString(text, x, y, color, true);
145149
}
146150

147-
fontRenderer.end();
151+
renderer.end();
148152
matrixStack.popPose();
149153
}
150154

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package com.shaybox.rusher.tweaks;
2+
3+
import com.shaybox.rusher.Main;
4+
import net.minecraft.client.Minecraft;
5+
import org.rusherhack.client.api.RusherHackAPI;
6+
import org.rusherhack.client.api.events.client.EventUpdate;
7+
import org.rusherhack.client.api.feature.module.IModule;
8+
import org.rusherhack.client.api.feature.module.ToggleableModule;
9+
import org.rusherhack.client.api.setting.BindSetting;
10+
import org.rusherhack.core.bind.key.IKey;
11+
import org.rusherhack.core.bind.key.NullKey;
12+
import org.rusherhack.core.event.listener.EventListener;
13+
import org.rusherhack.core.event.subscribe.Subscribe;
14+
import org.rusherhack.core.feature.IFeatureManager;
15+
import org.rusherhack.core.setting.BooleanSetting;
16+
17+
public class GrimDisabler implements EventListener {
18+
19+
/* Minecraft */
20+
private final Minecraft minecraft = Minecraft.getInstance();
21+
22+
/* RusherHackAPI Managers & Modules */
23+
private final IFeatureManager<IModule> moduleManager = RusherHackAPI.getModuleManager();
24+
private final ToggleableModule autoArmor = (ToggleableModule) moduleManager.getFeature("AutoArmor").orElseThrow();
25+
private final ToggleableModule elytraTweaks = (ToggleableModule) moduleManager.getFeature("ElytraTweaks").orElseThrow();
26+
27+
/* Custom Settings */
28+
private final BooleanSetting elytraPriority = (BooleanSetting) autoArmor.getSetting("ElytraPriority");
29+
private final BooleanSetting grimDisabler = (BooleanSetting) this.elytraTweaks.getSetting("GrimDisabler");
30+
private final BooleanSetting autoChestplate = new BooleanSetting("AutoChestplate", "Automatically disable AutoArmor ElytraPriority", true);
31+
private final BindSetting grimDisablerBind = new BindSetting("Bind", NullKey.INSTANCE);
32+
33+
/* Previous State */
34+
private boolean isRunning = false;
35+
private boolean isGrimDisablerDown = false;
36+
private boolean lastElytraPriority = this.elytraPriority.getValue();
37+
38+
/* Initialize */
39+
public GrimDisabler() {
40+
this.grimDisabler.addSubSettings(this.autoChestplate, this.grimDisablerBind);
41+
}
42+
43+
@Override
44+
public boolean isListening() {
45+
IKey grimDisablerBind = this.grimDisablerBind.getValue();
46+
47+
return this.grimDisabler.getValue() | this.isGrimDisablerDown || grimDisablerBind.isKeyDown() || this.isRunning;
48+
}
49+
50+
@SuppressWarnings("unused")
51+
@Subscribe
52+
private void onUpdate(EventUpdate event) {
53+
if (this.autoChestplate.getValue()) {
54+
if (this.grimDisabler.getValue()) {
55+
if (!this.isRunning) {
56+
this.lastElytraPriority = this.elytraPriority.getValue();
57+
this.elytraPriority.setValue(false);
58+
this.isRunning = true;
59+
}
60+
} else if (this.isRunning) {
61+
this.elytraPriority.setValue(lastElytraPriority);
62+
this.isRunning = false;
63+
}
64+
}
65+
66+
if (minecraft.screen != null) return;
67+
68+
Main.handleKey(this.grimDisablerBind::getValue, this.isGrimDisablerDown, (value) -> this.isGrimDisablerDown = value, this.grimDisabler::getValue, this.grimDisabler::setValue);
69+
}
70+
71+
}
72+

src/main/java/com/shaybox/rusher/tweaks/NightVision.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public boolean isListening() {
3737
return this.nightVisionSetting.getValue() || this.isApplied;
3838
}
3939

40-
@Subscribe
4140
@SuppressWarnings("unused")
41+
@Subscribe
4242
private void onPlayerUpdate(EventPlayerUpdate event) {
4343
LocalPlayer player = event.getPlayer();
4444
boolean hasNightVision = player.hasEffect(MobEffects.NIGHT_VISION);

0 commit comments

Comments
 (0)