Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit c5c8445

Browse files
authored
Merge pull request #162 from 3arthqu4ke/v1.8.1
V1.8.1
2 parents 7f7fdd2 + e7cd526 commit c5c8445

8 files changed

Lines changed: 209 additions & 40 deletions

File tree

src/main/java/me/earth/earthhack/impl/core/mixins/entity/MixinEntity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ public abstract class MixinEntity implements IEntity, Globals
134134
@Shadow
135135
protected abstract boolean getFlag(int flag);
136136
@Shadow
137-
public abstract boolean hasNoGravity();
138-
@Shadow
139137
public abstract boolean equals(Object p_equals_1_);
140138
@Shadow
141139
protected abstract void setRotation(float yaw, float pitch);

src/main/java/me/earth/earthhack/impl/core/mixins/entity/living/MixinEntityLivingBase.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import me.earth.earthhack.impl.util.minecraft.ICachedDamage;
1919
import me.earth.earthhack.impl.util.minecraft.MotionTracker;
2020
import me.earth.earthhack.impl.util.thread.EnchantmentUtil;
21+
import net.minecraft.client.entity.EntityOtherPlayerMP;
2122
import net.minecraft.client.entity.EntityPlayerSP;
2223
import net.minecraft.entity.Entity;
2324
import net.minecraft.entity.EntityLivingBase;
@@ -95,9 +96,6 @@ public abstract class MixinEntityLivingBase extends MixinEntity
9596
@Shadow
9697
public abstract boolean isServerWorld();
9798

98-
@Shadow public abstract void travel(float strafe, float vertical,
99-
float forward);
100-
10199
@Override
102100
@Invoker(value = "getArmSwingAnimationEnd")
103101
public abstract int armSwingAnimationEnd();
@@ -277,6 +275,17 @@ public boolean isRemoteHook(World world)
277275
return false;
278276
}
279277

278+
@SuppressWarnings("ConstantConditions")
279+
@Inject(method = "knockBack", at = @At("HEAD"), cancellable = true)
280+
private void knockBackHook(Entity entityIn, float strength, double xRatio,
281+
double zRatio, CallbackInfo ci)
282+
{
283+
if (EntityOtherPlayerMP.class.isInstance(this))
284+
{
285+
ci.cancel();
286+
}
287+
}
288+
280289
@Redirect(
281290
method = "onUpdate",
282291
at = @At(

src/main/java/me/earth/earthhack/impl/modules/client/hud/HUD.java

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
import com.mojang.realmsclient.gui.ChatFormatting;
44
import me.earth.earthhack.api.module.Module;
55
import me.earth.earthhack.api.module.util.Category;
6+
import me.earth.earthhack.api.setting.Complexity;
67
import me.earth.earthhack.api.setting.Setting;
7-
import me.earth.earthhack.api.setting.settings.BooleanSetting;
8-
import me.earth.earthhack.api.setting.settings.ColorSetting;
9-
import me.earth.earthhack.api.setting.settings.EnumSetting;
8+
import me.earth.earthhack.api.setting.settings.*;
109
import me.earth.earthhack.impl.Earthhack;
1110
import me.earth.earthhack.impl.managers.Managers;
1211
import me.earth.earthhack.impl.managers.render.TextRenderer;
@@ -15,17 +14,18 @@
1514
import me.earth.earthhack.impl.modules.client.hud.modes.Modules;
1615
import me.earth.earthhack.impl.modules.client.hud.modes.PotionColor;
1716
import me.earth.earthhack.impl.modules.client.hud.modes.Potions;
18-
import me.earth.earthhack.impl.modules.client.hud.util.HUDData;
1917
import me.earth.earthhack.impl.util.client.ModuleUtil;
2018
import me.earth.earthhack.impl.util.math.MathUtil;
2119
import me.earth.earthhack.impl.util.math.rotation.RotationUtil;
2220
import me.earth.earthhack.impl.util.minecraft.DamageUtil;
2321
import me.earth.earthhack.impl.util.network.ServerUtil;
2422
import me.earth.earthhack.impl.util.render.ColorHelper;
2523
import me.earth.earthhack.impl.util.render.ColorUtil;
24+
import me.earth.earthhack.impl.util.text.ChatUtil;
2625
import me.earth.earthhack.impl.util.text.TextColor;
2726
import net.minecraft.block.material.Material;
2827
import net.minecraft.client.Minecraft;
28+
import net.minecraft.client.entity.EntityPlayerSP;
2929
import net.minecraft.client.gui.ScaledResolution;
3030
import net.minecraft.client.renderer.GlStateManager;
3131
import net.minecraft.client.renderer.RenderHelper;
@@ -38,6 +38,9 @@
3838
import org.lwjgl.opengl.GL11;
3939

4040
import java.awt.*;
41+
import java.time.DateTimeException;
42+
import java.time.LocalDateTime;
43+
import java.time.format.DateTimeFormatter;
4144
import java.util.List;
4245
import java.util.*;
4346
import java.util.stream.Collectors;
@@ -76,12 +79,24 @@ public class HUD extends Module {
7679
register(new BooleanSetting("CurrentTps", true));
7780
protected final Setting<Boolean> animations =
7881
register(new BooleanSetting("Animations", true));
82+
protected final Setting<Boolean> serverBrand =
83+
register(new BooleanSetting("ServerBrand", false));
84+
85+
protected final Setting<Boolean> time =
86+
register(new BooleanSetting("Time", false));
87+
protected final Setting<String> timeFormat =
88+
register(new StringSetting("TimeFormat", "hh:mm:ss"));
89+
90+
protected final Setting<Integer> textOffset =
91+
register(new NumberSetting<>("Offset", 2, 0, 10))
92+
.setComplexity(Complexity.Expert);
7993

8094
protected final List<Map.Entry<String, Module>> modules = new ArrayList<>();
8195

8296
protected final Map<Module, ArrayEntry> arrayEntries = new HashMap<>();
8397
protected final Map<Module, ArrayEntry> removeEntries = new HashMap<>();
8498

99+
protected DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm:ss");
85100
protected ScaledResolution resolution = new ScaledResolution(mc);
86101
protected int width;
87102
protected int height;
@@ -120,6 +135,16 @@ public HUD() {
120135
potionColorMap.put(MobEffects.LEVITATION, new Color(206, 255, 255));
121136
potionColorMap.put(MobEffects.LUCK, new Color(51, 153, 0));
122137
potionColorMap.put(MobEffects.UNLUCK, new Color(192, 164, 77));
138+
timeFormat.addObserver(e -> {
139+
if (!e.isCancelled()) {
140+
try {
141+
formatter = DateTimeFormatter.ofPattern(e.getValue());
142+
} catch (IllegalArgumentException iae) {
143+
ChatUtil.sendMessageScheduled(TextColor.RED + "Invalid DateTimeFormat: " + TextColor.WHITE + e.getValue());
144+
formatter = DateTimeFormatter.ofPattern("hh:mm:ss");
145+
}
146+
}
147+
});
123148
}
124149

125150
protected void renderLogo() {
@@ -130,6 +155,13 @@ protected void renderLogo() {
130155

131156
protected void renderModules() {
132157
int offset = 0;
158+
EntityPlayerSP player;
159+
if (serverBrand.getValue() && (player = mc.player) != null) {
160+
String serverBrand = "ServerBrand " + TextColor.GRAY + player.getServerBrand();
161+
renderText(serverBrand, width - 2 - RENDERER.getStringWidth(serverBrand), height - 2 - RENDERER.getStringHeightI() - offset - animationY);
162+
offset += RENDERER.getStringHeightI() + textOffset.getValue();
163+
}
164+
133165
if (potions.getValue() == Potions.Text) {
134166
final ArrayList<Potion> sorted = new ArrayList<>();
135167
for (final Potion potion : Potion.REGISTRY) {
@@ -147,15 +179,17 @@ protected void renderModules() {
147179
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
148180
final int x = width - 2 - RENDERER.getStringWidth(label);
149181
renderPotionText(label, x, height - 2 - RENDERER.getStringHeightI() - offset - animationY, effect.getPotion());
150-
offset += RENDERER.getStringHeightI() + 3;
182+
offset += RENDERER.getStringHeightI() + textOffset.getValue();
151183
}
152184
}
153185
}
186+
154187
if (speed.getValue()) {
155188
String text = "Speed " + TextColor.GRAY + MathUtil.round(Managers.SPEED.getSpeed(), 2) + " km/h";
156189
renderText(text, width - 2 - RENDERER.getStringWidth(text), height - 2 - RENDERER.getStringHeightI() - offset - animationY);
157-
offset += RENDERER.getStringHeightI() + 3;
190+
offset += RENDERER.getStringHeightI() + textOffset.getValue();
158191
}
192+
159193
if (tps.getValue()) {
160194
String tps = "TPS " + TextColor.GRAY + MathUtil.round(Managers.TPS.getTps(), 2);
161195
if (currentTps.getValue())
@@ -164,13 +198,29 @@ protected void renderModules() {
164198
}
165199

166200
renderText(tps, width - 2 - RENDERER.getStringWidth(tps), height - 2 - RENDERER.getStringHeightI() - offset - animationY);
167-
offset += RENDERER.getStringHeightI() + 3;
201+
offset += RENDERER.getStringHeightI() + textOffset.getValue();
168202
}
203+
204+
if (time.getValue()) {
205+
LocalDateTime time = LocalDateTime.now();
206+
String text;
207+
try {
208+
text = "Time " + TextColor.GRAY + formatter.format(time);
209+
} catch (DateTimeException e) {
210+
ModuleUtil.sendMessageWithAquaModule(this, TextColor.RED + "Can not render time: " + e.getMessage(), "time");
211+
text = "Time " + TextColor.GRAY + TextColor.RED + "Invalid";
212+
}
213+
214+
renderText(text, width - 2 - RENDERER.getStringWidth(text), height - 2 - RENDERER.getStringHeightI() - offset - animationY);
215+
offset += RENDERER.getStringHeightI() + textOffset.getValue();
216+
}
217+
169218
if (fps.getValue()) {
170219
String fps = "FPS " + TextColor.GRAY + Minecraft.getDebugFPS();
171220
renderText(fps, width - 2 - RENDERER.getStringWidth(fps), height - 2 - RENDERER.getStringHeightI() - offset - animationY);
172-
offset += RENDERER.getStringHeightI() + 3;
221+
offset += RENDERER.getStringHeightI() + textOffset.getValue();
173222
}
223+
174224
if (ping.getValue()) {
175225
String ping = "Ping " + TextColor.GRAY + ServerUtil.getPing();
176226
renderText(ping, width - 2 - RENDERER.getStringWidth(ping), height - 2 - RENDERER.getStringHeightI() - offset - animationY);
@@ -196,6 +246,7 @@ protected void renderModules() {
196246
boolean move = potions.getValue() == Potions.Move && !mc.player.getActivePotionEffects().isEmpty();
197247
int j = move ? 2 : 0;
198248
int o = move ? 5 : 2;
249+
int moduleOffset = Managers.TEXT.getStringHeightI() + textOffset.getValue();
199250
if (animations.getValue()) {
200251
for (Map.Entry<String, Module> module : modules) {
201252
if (isArrayMember(module.getValue()))
@@ -217,14 +268,14 @@ protected void renderModules() {
217268
LinkedHashMap::new));
218269
}
219270
for (ArrayEntry arrayEntry : arrayEntriesSorted.values()) {
220-
arrayEntry.drawArrayEntry(width - 2, o + j * 10);
271+
arrayEntry.drawArrayEntry(width - 2, o + j * moduleOffset);
221272
j++;
222273
}
223274
getRemoveEntries().forEach((key, value) -> getArrayEntries().remove(key));
224275
getRemoveEntries().clear();
225276
} else {
226277
for (Map.Entry<String, Module> module : modules) {
227-
renderText(module.getKey(), width - 2 - RENDERER.getStringWidth(module.getKey()), o + j * 10);
278+
renderText(module.getKey(), width - 2 - RENDERER.getStringWidth(module.getKey()), o + j * moduleOffset);
228279
j++;
229280
}
230281
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package me.earth.earthhack.impl.modules.client.hud;
2+
3+
import me.earth.earthhack.api.module.data.DefaultData;
4+
5+
public class HUDData extends DefaultData<HUD>
6+
{
7+
public HUDData(HUD hud)
8+
{
9+
super(hud);
10+
register(hud.timeFormat, "All letters 'A' to 'Z' and 'a' to 'z' are reserved as pattern letters.\n\n" +
11+
" Symbol Meaning \n" +
12+
" ------ ------- \n" +
13+
" G era \n" +
14+
" u year \n" +
15+
" y year-of-era \n" +
16+
" D day-of-year \n" +
17+
" M/L month-of-year \n" +
18+
" d day-of-month \n" +
19+
" \n" +
20+
" Q/q quarter-of-year \n" +
21+
" Y week-based-year \n" +
22+
" w week-of-week-based-year \n" +
23+
" W week-of-month \n" +
24+
" E day-of-week \n" +
25+
" e/c localized day-of-week \n" +
26+
" F week-of-month \n" +
27+
" \n" +
28+
" a am-pm-of-day \n" +
29+
" h clock-hour-of-am-pm (1-12)\n" +
30+
" K hour-of-am-pm (0-11) \n" +
31+
" k clock-hour-of-am-pm (1-24)\n" +
32+
" \n" +
33+
" H hour-of-day (0-23) \n" +
34+
" m minute-of-hour \n" +
35+
" s second-of-minute \n" +
36+
" S fraction-of-second \n" +
37+
" A milli-of-day \n" +
38+
" n nano-of-second \n" +
39+
" N nano-of-day \n" +
40+
" \n" +
41+
" V time-zone ID \n" +
42+
" z time-zone name \n" +
43+
" O localized zone-offset \n" +
44+
" X zone-offset 'Z' for zero \n" +
45+
" x zone-offset \n" +
46+
" Z zone-offset \n" +
47+
" \n" +
48+
" p pad next \n" +
49+
" \n" +
50+
" ' escape for text \n" +
51+
" '' single quote \n" +
52+
" [ optional section start\n" +
53+
" ] optional section end\n" +
54+
" # reserved for future use\n" +
55+
" { reserved for future use\n" +
56+
" } reserved for future use");
57+
}
58+
59+
@Override
60+
public int getColor()
61+
{
62+
return 0xff34A1FF;
63+
}
64+
65+
@Override
66+
public String getDescription()
67+
{
68+
return "Displays info like ping, tps or toggled modules on your screen.";
69+
}
70+
71+
}

src/main/java/me/earth/earthhack/impl/modules/client/hud/util/HUDData.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)