-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # README.md # src/main/java/com/jorianwoltjer/liveoverflowmod/client/Keybinds.java # src/main/java/com/jorianwoltjer/liveoverflowmod/mixin/ClientConnectionMixin.java # src/main/java/com/jorianwoltjer/liveoverflowmod/mixin/ClientPlayerInteractionMixin.java # src/main/resources/liveoverflowmod.mixins.json
- Loading branch information
Showing
34 changed files
with
1,669 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 71 additions & 2 deletions
73
src/main/java/com/jorianwoltjer/liveoverflowmod/client/ClientEntrypoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,81 @@ | ||
package com.jorianwoltjer.liveoverflowmod.client; | ||
|
||
import com.jorianwoltjer.liveoverflowmod.command.*; | ||
import com.jorianwoltjer.liveoverflowmod.hacks.*; | ||
import com.jorianwoltjer.liveoverflowmod.mixin.ClientConnectionInvoker; | ||
import com.mojang.brigadier.CommandDispatcher; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; | ||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; | ||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; | ||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; | ||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; | ||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.network.ClientPlayNetworkHandler; | ||
import net.minecraft.network.packet.Packet; | ||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; | ||
import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket; | ||
import net.minecraft.server.command.ServerCommandSource; | ||
|
||
import java.util.LinkedList; | ||
|
||
public class ClientEntrypoint implements ClientModInitializer { | ||
public static final PassiveMods passiveMods = new PassiveMods(); | ||
public static final WorldGuardBypass worldGuardBypassHack = new WorldGuardBypass(); | ||
public static final Reach reachHack = new Reach(); | ||
public static final ClipReach clipReachHack = new ClipReach(); | ||
public static final PanicMode panicModeHack = new PanicMode(); | ||
public static final FastMiner fastMinerHack = new FastMiner(); | ||
public static final ToggledHack[] toggledHacks = new ToggledHack[] { | ||
passiveMods, | ||
worldGuardBypassHack, | ||
reachHack, | ||
clipReachHack, | ||
panicModeHack, | ||
fastMinerHack | ||
}; | ||
public static final MinecraftClient client = MinecraftClient.getInstance(); | ||
public static ClientPlayNetworkHandler networkHandler; | ||
public static int globalTimer = 0; | ||
public static final LinkedList<Packet<?>> packetQueue = new LinkedList<>(); // Max 5 per tick | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
Keybinds.registerKeybinds(); // Register keybinds | ||
ClientTickEvents.END_CLIENT_TICK.register(Keybinds::checkKeybinds); // Register a callback to be called every tick | ||
// Register functions for hacks | ||
for (ToggledHack hack : toggledHacks) { | ||
KeyBindingHelper.registerKeyBinding(hack.keybind); // Keybinds | ||
ClientTickEvents.END_CLIENT_TICK.register(hack::tick); // Every tick | ||
} | ||
|
||
ClientTickEvents.END_CLIENT_TICK.register(ClientEntrypoint::tickEnd); // End of every tick | ||
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> registerClientCommands(dispatcher)); // Client Commands | ||
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> registerServerCommands(dispatcher)); // Server Commands | ||
|
||
HudRenderCallback.EVENT.register(Gui::render); // Render GUI | ||
} | ||
|
||
public static void tickEnd(MinecraftClient client) { | ||
// Update variables | ||
networkHandler = client.getNetworkHandler(); | ||
globalTimer++; | ||
|
||
// Send packets from queue (max 5) | ||
int movementPacketsLeft = 5; | ||
while (packetQueue.size() > 0 && movementPacketsLeft > 0) { | ||
Packet<?> packet = packetQueue.remove(0); | ||
if (packet instanceof PlayerMoveC2SPacket || packet instanceof VehicleMoveC2SPacket) { | ||
movementPacketsLeft--; | ||
} | ||
((ClientConnectionInvoker) networkHandler.getConnection())._sendImmediately(packet, null); | ||
} | ||
} | ||
|
||
public static void registerClientCommands(CommandDispatcher<FabricClientCommandSource> dispatcher) { | ||
ClipCommand.register(dispatcher); | ||
} | ||
|
||
public static void registerServerCommands(CommandDispatcher<ServerCommandSource> dispatcher) { | ||
GetCodeCommand.register(dispatcher); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/jorianwoltjer/liveoverflowmod/client/Gui.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.jorianwoltjer.liveoverflowmod.client; | ||
|
||
import com.jorianwoltjer.liveoverflowmod.hacks.ToggledHack; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
|
||
import static com.jorianwoltjer.liveoverflowmod.client.ClientEntrypoint.client; | ||
import static com.jorianwoltjer.liveoverflowmod.client.ClientEntrypoint.toggledHacks; | ||
|
||
public class Gui { | ||
|
||
public static void render(MatrixStack matrixStack, float tickDelta) { | ||
// Show all hacks in the bottom right corner | ||
for (int i = 0; i < toggledHacks.length; i++) { | ||
ToggledHack hack = toggledHacks[toggledHacks.length - i - 1]; | ||
String text = String.format("§8[§7%s§8] §r%s§7:§r %s", | ||
hack.keybind.getBoundKeyLocalizedText().getString(), | ||
hack.name, | ||
hack.isEnabled() ? "§aON" : "§cOFF" | ||
); | ||
renderTextShadow(matrixStack, text, i); | ||
} | ||
// Show title | ||
renderTextShadow(matrixStack, "§8[§7LiveOverflowMod §c⬤§8]", toggledHacks.length); | ||
} | ||
|
||
private static void renderTextShadow(MatrixStack matrixStack, String text, float index) { | ||
int x = client.getWindow().getScaledWidth() - client.textRenderer.getWidth(text) - 2; | ||
int y = client.getWindow().getScaledHeight() - 12 - (int)(index * 11); | ||
|
||
client.textRenderer.drawWithShadow(matrixStack, text, x, y, 0xFFFFFF); | ||
} | ||
} |
Oops, something went wrong.