Skip to content

Commit

Permalink
a commit made in pure spite
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeRNG committed Dec 21, 2023
1 parent 7fa70c3 commit b69c5dd
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 72 deletions.
15 changes: 14 additions & 1 deletion src/main/java/dev/dfonline/codeclient/CodeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import dev.dfonline.codeclient.dev.overlay.ChestPeeker;
import dev.dfonline.codeclient.location.Dev;
import dev.dfonline.codeclient.location.Location;
import dev.dfonline.codeclient.location.Plot;
import dev.dfonline.codeclient.location.Spawn;
import dev.dfonline.codeclient.switcher.StateSwitcher;
import dev.dfonline.codeclient.websocket.SocketHandler;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
Expand All @@ -31,8 +33,10 @@
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket;
import net.minecraft.network.packet.s2c.play.CloseScreenS2CPacket;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFW;
import org.slf4j.Logger;
Expand Down Expand Up @@ -80,7 +84,7 @@ public static <T extends PacketListener> boolean handlePacket(Packet<T> packet)

String name = packet.getClass().getName().replace("net.minecraft.network.packet.s2c.play.","");
// if(!List.of("PlayerListS2CPacket","WorldTimeUpdateS2CPacket","GameMessageS2CPacket","KeepAliveS2CPacket", "ChunkDataS2CPacket", "UnloadChunkS2CPacket","TeamS2CPacket", "ChunkRenderDistanceCenterS2CPacket", "MessageHeaderS2CPacket", "LightUpdateS2CPacket", "OverlayMessageS2CPacket").contains(name)) LOGGER.info(name);
if((MC.currentScreen instanceof GameMenuScreen || MC.currentScreen instanceof ChatScreen) && packet instanceof CloseScreenS2CPacket) {
if((MC.currentScreen instanceof GameMenuScreen || MC.currentScreen instanceof ChatScreen || MC.currentScreen instanceof StateSwitcher) && packet instanceof CloseScreenS2CPacket) {
return true;
}
return false;
Expand Down Expand Up @@ -110,6 +114,9 @@ public static <T extends PacketListener> boolean onSendPacket(Packet<T> packet)
if(BuildClip.onPacket(packet)) return true;
Event.onSendPacket(packet);
String name = packet.getClass().getName().replace("net.minecraft.network.packet.c2s.play.","");
if(packet instanceof CommandExecutionC2SPacket commandExecutionC2SPacket) {
LOGGER.info(commandExecutionC2SPacket.command());
}
// LOGGER.info(name);
return false;
}
Expand All @@ -131,6 +138,12 @@ public static void onTick() {
if(editBind.wasPressed()) {
MC.setScreen(new DevInventoryScreen(MC.player));
}
if(dev.getSize() == null) {
var pos = new BlockPos(dev.getX() - 1,49,dev.getZ());
if(CodeClient.MC.world.getBlockState(pos.south(50)).isOf(Blocks.STONE)) dev.setSize(Plot.Size.BASIC);
if(CodeClient.MC.world.getBlockState(pos.south(100)).isOf(Blocks.STONE)) dev.setSize(Plot.Size.LARGE);
if(CodeClient.MC.world.getBlockState(pos.south(300)).isOf(Blocks.STONE)) dev.setSize(Plot.Size.MASSIVE);
}
}
if(CodeClient.location instanceof Spawn spawn && spawn.consumeHasJustJoined()) {
if(autoJoin == AutoJoin.PLOT) {
Expand Down
27 changes: 21 additions & 6 deletions src/main/java/dev/dfonline/codeclient/action/impl/GoTo.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class GoTo extends Action {
private ItemStack locationItem;
private boolean active;
private int buffer = 0;
private int lastTickPackets = 1;
private int thisTickPackets = 0;
boolean doNotSuppress = false;

public GoTo(Vec3d target, Callback callback) {
super(callback);
Expand Down Expand Up @@ -55,8 +58,18 @@ public boolean onReceivePacket(Packet<?> packet) {
return false;
}

@Override
public boolean onSendPacket(Packet<?> packet) {
if(packet instanceof PlayerPositionLookS2CPacket pos) {
if(doNotSuppress) doNotSuppress = false;
else return true;
}
return super.onSendPacket(packet);
}

@Override
public void onTick() {
thisTickPackets = 0;
if(CodeClient.MC.player == null || CodeClient.MC.getNetworkHandler() == null) {
callback();
return;
Expand All @@ -70,6 +83,7 @@ public void onTick() {
}
if(locationItem != null) return;
hackTowards();
lastTickPackets=thisTickPackets;
}

private void locationItemTeleport() {
Expand Down Expand Up @@ -111,13 +125,14 @@ private void hackTowards() {
double distance = offset.length();
Vec3d jump = distance > maxLength ? pos.add(offset.normalize().multiply(maxLength)) : target;
if(distance > 10) {
CodeClient.MC.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(false));
CodeClient.MC.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(false));
CodeClient.MC.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(false));
CodeClient.MC.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(false));
CodeClient.MC.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(false));
CodeClient.MC.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(false));
for (int i = 0; i < Math.min(lastTickPackets + 5,50); i++) {
thisTickPackets++;
this.doNotSuppress = true;
CodeClient.MC.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(false));
}
}
thisTickPackets++;
this.doNotSuppress = true;
CodeClient.MC.player.setPos(jump.x, jump.y, jump.z);
}
}
2 changes: 1 addition & 1 deletion src/main/java/dev/dfonline/codeclient/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public YetAnotherConfigLib getLibConfig() {
.build())
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Custom Block Breaking"))
.description(OptionDescription.of(Text.literal("Keep codeblocks safe from accidental breaking."),Text.literal("They will have the survival breaking animation."),Text.literal("Breaking multiple will temporarily increase the speed.")))
.description(OptionDescription.of(Text.literal("Keep codeblocks safe from accidental breaking."),Text.literal("They will have the survival breaking animation."),Text.literal("They will take 5 ticks to break (0.25 seconds)")))
.binding(
false,
() -> CustomBlockBreaking,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ public static void breakBlock(BlockPos pos) {
* The insanity previously mentioned.
*/
public static float calculateBlockDelta(BlockPos pos) {
AtomicReference<Float> speed = new AtomicReference<>(0F);
oldBlocks.getBlocks().forEach(recentBlock -> {
float age = (float) recentBlock.howLongAgo() / 1000;
float recency = Math.max(10.0F - age,0);
float score = recency / 100;
speed.updateAndGet(v -> (v + score));
});
return Math.max(speed.get(), 0.1F);
return 0.2F;
// AtomicReference<Float> speed = new AtomicReference<>(0F);
// oldBlocks.getBlocks().forEach(recentBlock -> {
// float age = (float) recentBlock.howLongAgo() / 1000;
// float recency = Math.max(10.0F - age,0);
// float score = recency / 100;
// speed.updateAndGet(v -> (v + score));
// });
// return Math.max(speed.get(), 0.1F);
}

private static class RecentBlocks {
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/main/resources/CodeClient.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"entity.player.MPlayerEntity",
"network.MClientCommonPlayNetworkHandler",
"network.MClientConnection",
"render.MChunkRendererRegion",
"render.MDebugRenderer",
"render.hud.MDrawContext",
"render.hud.MInGameHud",
Expand Down

0 comments on commit b69c5dd

Please sign in to comment.