Skip to content
This repository was archived by the owner on Oct 22, 2022. It is now read-only.

Commit edd3bb0

Browse files
committed
misc
1 parent dda16e1 commit edd3bb0

8 files changed

Lines changed: 103 additions & 112 deletions

File tree

src/main/java/me/travis/wurstplusthree/RPC.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,22 @@
77

88
public class RPC {
99

10-
private static String discordID = "838078740344471623"; //change to whatever u want
11-
private static DiscordRichPresence discordRichPresence = new DiscordRichPresence();
12-
private static DiscordRPC discordRPC = DiscordRPC.INSTANCE;
13-
14-
private static String clientVersion = WurstplusThree.MODVER;
10+
private static final DiscordRichPresence discordRichPresence = new DiscordRichPresence();
11+
private static final DiscordRPC discordRPC = DiscordRPC.INSTANCE;
1512

1613
public static void startRPC() {
1714
DiscordEventHandlers eventHandlers = new DiscordEventHandlers();
1815
eventHandlers.disconnected = ((var1, var2) -> System.out.println("Discord RPC disconnected, var1: " + var1 + ", var2: " + var2));
1916

17+
String discordID = "838078740344471623";
2018
discordRPC.Discord_Initialize(discordID, eventHandlers, true, null);
2119

2220
discordRichPresence.startTimestamp = System.currentTimeMillis() / 1000L;
23-
discordRichPresence.details = clientVersion;
21+
discordRichPresence.details = WurstplusThree.MODVER;
2422
discordRichPresence.largeImageKey = "logo";
25-
discordRichPresence.largeImageText = "With the_fellas";
23+
discordRichPresence.largeImageText = "with the_fellas";
2624
discordRichPresence.smallImageKey = "small";
27-
discordRichPresence.smallImageText = "discord.gg/VGMVaMN6ka";
25+
discordRichPresence.smallImageText = "discord.gg/wurst";
2826
discordRichPresence.state = null;
2927
discordRPC.Discord_UpdatePresence(discordRichPresence);
3028
}

src/main/java/me/travis/wurstplusthree/command/commands/ClipBind.java renamed to src/main/java/me/travis/wurstplusthree/command/commands/ClipBindCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
* - shit code from my old client
1414
*/
1515

16-
public class ClipBind extends Command {
16+
public class ClipBindCommand extends Command {
1717
static List<Integer> keys = new ArrayList<>();
1818

19-
public ClipBind() {
19+
public ClipBindCommand() {
2020
super("clipbind", "bindclip");
2121
}
2222

src/main/java/me/travis/wurstplusthree/command/commands/Debug.java

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package me.travis.wurstplusthree.command.commands;
2+
3+
import com.mojang.realmsclient.gui.ChatFormatting;
4+
import me.travis.wurstplusthree.WurstplusThree;
5+
import me.travis.wurstplusthree.command.Command;
6+
import me.travis.wurstplusthree.event.events.TestEvent;
7+
import me.travis.wurstplusthree.event.processor.CommitEvent;
8+
import me.travis.wurstplusthree.event.processor.EventPriority;
9+
import me.travis.wurstplusthree.hack.hacks.client.Hud;
10+
import me.travis.wurstplusthree.util.ClientMessage;
11+
import me.travis.wurstplusthree.util.logview.Threads;
12+
13+
/**
14+
* @author Madmegsox1
15+
* @since 02/06/2021
16+
*/
17+
18+
public class DebugCommand extends Command {
19+
20+
public static DebugCommand INSTANCE;
21+
public boolean capes;
22+
23+
public DebugCommand(){
24+
super("debug");
25+
INSTANCE = this;
26+
capes = true;
27+
}
28+
29+
30+
@Override
31+
public void execute(String[] message) {
32+
switch (message[0]) {
33+
case "logview":
34+
Threads log = new Threads();
35+
log.start();
36+
break;
37+
case "ram":
38+
Runtime runtime = Runtime.getRuntime();
39+
long maxMemory = runtime.maxMemory();
40+
long allocatedMemory = runtime.totalMemory();
41+
long freeMemory = runtime.freeMemory();
42+
ClientMessage.sendMessage(
43+
"\n - MAX MEMORY: " + ChatFormatting.AQUA + maxMemory / 1024 / 1024 + " Mb" + ChatFormatting.RESET +
44+
"\n - ALLOCATED MEMORY: " + ChatFormatting.AQUA + allocatedMemory / 1024 / 1024 + " Mb" + ChatFormatting.RESET +
45+
"\n - FREE MEMORY: " + ChatFormatting.AQUA + freeMemory / 1024 / 1024 + " Mb" + ChatFormatting.RESET +
46+
"\n - TOTAL FREE MEMORY: " + ChatFormatting.AQUA + ((freeMemory + (maxMemory - allocatedMemory)) / 1024 / 1024) + " Mb" + ChatFormatting.RESET);
47+
break;
48+
case "eventdelay":
49+
WurstplusThree.EVENT_PROCESSOR.addEventListener(this);
50+
TestEvent event = new TestEvent();
51+
WurstplusThree.EVENT_PROCESSOR.postEvent(event);
52+
WurstplusThree.EVENT_PROCESSOR.removeEventListener(this);
53+
break;
54+
case "hud":
55+
Hud.INSTANCE.debugHud = message[1].equals("true");
56+
break;
57+
case "capes":
58+
capes = message[1].equals("true");
59+
ClientMessage.sendMessage("Capes Toggled");
60+
break;
61+
default:
62+
ClientMessage.sendErrorMessage(message[0] + " inst supported!");
63+
break;
64+
}
65+
}
66+
67+
@CommitEvent(priority = EventPriority.HIGH)
68+
public void highEvent(TestEvent event){
69+
ClientMessage.sendMessage("\n - HIGH PRIORITY: " + ChatFormatting.AQUA + (System.nanoTime() - event.startTime ) + ChatFormatting.RESET + " ns");
70+
}
71+
72+
@CommitEvent(priority = EventPriority.NONE)
73+
public void normalEvent(TestEvent event){
74+
ClientMessage.sendMessage("\n - NORMAL PRIORITY: " + ChatFormatting.AQUA + (System.nanoTime() - event.startTime) + ChatFormatting.RESET + " ns");
75+
}
76+
77+
@CommitEvent(priority = EventPriority.LOW)
78+
public void lowEvent(TestEvent event){
79+
ClientMessage.sendMessage("\n - LOW PRIORITY: " + ChatFormatting.AQUA + (System.nanoTime() - event.startTime) + ChatFormatting.RESET + " ns");
80+
}
81+
}

src/main/java/me/travis/wurstplusthree/command/commands/IrcChat.java renamed to src/main/java/me/travis/wurstplusthree/command/commands/IrcChatCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
* @since 30/05/2021
1010
*/
1111

12-
public class IrcChat extends Command {
12+
public class IrcChatCommand extends Command {
1313

14-
public IrcChat(){
14+
public IrcChatCommand(){
1515
super("irc");
1616
}
1717
@Override

src/main/java/me/travis/wurstplusthree/hack/hacks/misc/AutoClip.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package me.travis.wurstplusthree.hack.hacks.misc;
22

33
import me.travis.wurstplusthree.WurstplusThree;
4-
import me.travis.wurstplusthree.command.commands.ClipBind;
4+
import me.travis.wurstplusthree.command.commands.ClipBindCommand;
55
import me.travis.wurstplusthree.event.events.PacketEvent;
66
import me.travis.wurstplusthree.event.processor.CommitEvent;
77
import me.travis.wurstplusthree.hack.Hack;
@@ -50,7 +50,7 @@ public void onEnable() {
5050
@Override
5151
public void onUpdate() {
5252
if(test.getValue()){
53-
KeyUtil.clip(ClipBind.getKeys());
53+
KeyUtil.clip(ClipBindCommand.getKeys());
5454
test.setValue(false);
5555
}
5656
if(shouldClip){
@@ -99,7 +99,7 @@ private void Clip() {
9999
delayCount = 0;
100100
ClientMessage.sendMessage("Clipping " + target);
101101
target = "";
102-
KeyUtil.clip(ClipBind.getKeys());
102+
KeyUtil.clip(ClipBindCommand.getKeys());
103103
this.shouldClip = false;
104104
}
105105
}

src/main/java/me/travis/wurstplusthree/mixin/mixins/MixinAbstractClientPlayer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package me.travis.wurstplusthree.mixin.mixins;
22

33
import me.travis.wurstplusthree.WurstplusThree;
4-
import me.travis.wurstplusthree.command.commands.Debug;
4+
import me.travis.wurstplusthree.command.commands.DebugCommand;
55
import me.travis.wurstplusthree.util.SkinStorageManipulationer;
66
import net.minecraft.client.entity.AbstractClientPlayer;
77
import net.minecraft.client.network.NetworkPlayerInfo;
@@ -29,7 +29,7 @@ public abstract class MixinAbstractClientPlayer {
2929
@Inject(method = "getLocationCape", at = @At("HEAD"), cancellable = true)
3030
public void getLocationCape(CallbackInfoReturnable<ResourceLocation> callbackInfoReturnable) {
3131
UUID uuid = Objects.requireNonNull(getPlayerInfo()).getGameProfile().getId();
32-
if(!Debug.INSTANCE.capes)return;
32+
if(!DebugCommand.INSTANCE.capes)return;
3333

3434
if (WurstplusThree.CAPE_MANAGER.isOg(uuid)) {
3535
// callbackInfoReturnable.setReturnValue(new ResourceLocation("textures/cape-old.png"));

src/main/java/me/travis/wurstplusthree/util/CrystalUtil.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,12 @@ public static boolean rayTraceSolidCheck(Vec3d start, Vec3d end, boolean shouldI
147147
return false;
148148
}
149149

150-
public static float getDamageFromDifficulty(float damage, EnumDifficulty difficulty) {
151-
switch (difficulty) {
152-
case PEACEFUL: {
153-
return 0.0f;
154-
}
155-
case EASY: {
156-
return damage * 0.5f;
157-
}
158-
case NORMAL: {
159-
return damage;
160-
}
161-
case HARD:
162-
default: {
163-
return damage * 1.5f;
164-
}
150+
public static float getDamageFromDifficulty(float damage) {
151+
switch (mc.world.getDifficulty()) {
152+
case PEACEFUL: return 0;
153+
case EASY: return Math.min(damage / 2 + 1, damage);
154+
case HARD: return damage * 3 / 2;
155+
default: return damage;
165156
}
166157
}
167158

@@ -215,7 +206,7 @@ public static float getExplosionDamage(Entity targetEntity, Vec3d explosionPosit
215206
float damage = (float) (int) ((densityAdjust * densityAdjust + densityAdjust) / 2.0 * 7.0 * explosionPower + 1.0);
216207

217208
if (targetEntity instanceof EntityLivingBase)
218-
damage = getBlastReduction((EntityLivingBase) targetEntity, CrystalUtil.getDamageFromDifficulty(damage, mc.world.getDifficulty()),
209+
damage = getBlastReduction((EntityLivingBase) targetEntity, CrystalUtil.getDamageFromDifficulty(damage),
219210
new Explosion(mc.world, null, explosionPosition.x, explosionPosition.y, explosionPosition.z,
220211
explosionPower / 2.0f, false, true));
221212

0 commit comments

Comments
 (0)