Merge pull request #167 from ThebestkillerTBK/master

SilentDisconnect
This commit is contained in:
SByte
2022-10-21 04:09:22 +07:00
committed by GitHub
5 changed files with 62 additions and 3 deletions

View File

@@ -65,6 +65,7 @@
- PacketFly (Taken from an [unmerged PR](https://github.com/MeteorDevelopment/meteor-client/pull/813)) - PacketFly (Taken from an [unmerged PR](https://github.com/MeteorDevelopment/meteor-client/pull/813))
- Painter - Painter
- Rendering - Rendering
- Silent Disconnect
- SkeletonESP (Ported from [JexClient](https://github.com/DustinRepo/JexClient-main/blob/main/src/main/java/me/dustin/jex/feature/mod/impl/render/Skeletons.java)) - SkeletonESP (Ported from [JexClient](https://github.com/DustinRepo/JexClient-main/blob/main/src/main/java/me/dustin/jex/feature/mod/impl/render/Skeletons.java))
- SoundLocator - SoundLocator
- Server Finder (Ported from [MeteorAdditions](https://github.com/JFronny/MeteorAdditions)) - Server Finder (Ported from [MeteorAdditions](https://github.com/JFronny/MeteorAdditions))

View File

@@ -67,6 +67,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
modules.add(new PacketFly()); modules.add(new PacketFly());
modules.add(new Painter()); modules.add(new Painter());
modules.add(new Rendering()); modules.add(new Rendering());
modules.add(new SilentDisconnect());
modules.add(new SkeletonESP()); modules.add(new SkeletonESP());
modules.add(new SoundLocator()); modules.add(new SoundLocator());
modules.add(new TillAura()); modules.add(new TillAura());
@@ -81,13 +82,14 @@ public class MeteorRejectsAddon extends MeteorAddon {
commands.add(new ClearChatCommand()); commands.add(new ClearChatCommand());
commands.add(new GhostCommand()); commands.add(new GhostCommand());
commands.add(new GiveCommand()); commands.add(new GiveCommand());
commands.add(new SaveSkinCommand());
commands.add(new SeedCommand());
commands.add(new HeadsCommand()); commands.add(new HeadsCommand());
commands.add(new KickCommand()); commands.add(new KickCommand());
// commands.add(new LocateCommand()); I wish it was that simple -_- // commands.add(new LocateCommand()); I wish it was that simple -_-
commands.add(new ServerCommand());
commands.add(new PanicCommand()); commands.add(new PanicCommand());
commands.add(new ReconnectCommand());
commands.add(new ServerCommand());
commands.add(new SaveSkinCommand());
commands.add(new SeedCommand());
commands.add(new SetBlockCommand()); commands.add(new SetBlockCommand());
commands.add(new SetVelocityCommand()); commands.add(new SetVelocityCommand());
commands.add(new TeleportCommand()); commands.add(new TeleportCommand());

View File

@@ -0,0 +1,31 @@
package anticope.rejects.commands;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.misc.AutoReconnect;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ConnectScreen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.network.ServerAddress;
import net.minecraft.command.CommandSource;
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
public class ReconnectCommand extends Command {
public ReconnectCommand() {
super("reconnect", "Reconnects server.");
}
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
mc.world.disconnect();
AutoReconnect autoReconnect = Modules.get().get(AutoReconnect.class);
ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), MinecraftClient.getInstance(),
ServerAddress.parse(autoReconnect.lastServerInfo.address), autoReconnect.lastServerInfo);
return SINGLE_SUCCESS;
});
}
}

View File

@@ -2,15 +2,21 @@ package anticope.rejects.mixin;
import anticope.rejects.events.ChunkPosDataEvent; import anticope.rejects.events.ChunkPosDataEvent;
import anticope.rejects.events.PlayerRespawnEvent; import anticope.rejects.events.PlayerRespawnEvent;
import anticope.rejects.modules.SilentDisconnect;
import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.network.packet.s2c.play.ChunkDataS2CPacket; import net.minecraft.network.packet.s2c.play.ChunkDataS2CPacket;
import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket; import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static meteordevelopment.meteorclient.MeteorClient.mc;
@Mixin(ClientPlayNetworkHandler.class) @Mixin(ClientPlayNetworkHandler.class)
public class ClientPlayNetworkHandlerMixin { public class ClientPlayNetworkHandlerMixin {
@@ -25,4 +31,13 @@ public class ClientPlayNetworkHandlerMixin {
public void onPlayerRespawn(PlayerRespawnS2CPacket packet, CallbackInfo ci) { public void onPlayerRespawn(PlayerRespawnS2CPacket packet, CallbackInfo ci) {
MeteorClient.EVENT_BUS.post(PlayerRespawnEvent.get()); MeteorClient.EVENT_BUS.post(PlayerRespawnEvent.get());
} }
@Inject(method = "onDisconnected", at = @At("HEAD"), cancellable = true)
private void onDisconnected(Text reason, CallbackInfo info) {
if (Modules.get().isActive(SilentDisconnect.class) && mc.world != null && mc.player != null) {
ChatUtils.info(Text.translatable("disconnect.lost").getString() + ":");
ChatUtils.sendMsg(reason);
info.cancel();
}
}
} }

View File

@@ -0,0 +1,10 @@
package anticope.rejects.modules;
import anticope.rejects.MeteorRejectsAddon;
import meteordevelopment.meteorclient.systems.modules.Module;
public class SilentDisconnect extends Module {
public SilentDisconnect() {
super(MeteorRejectsAddon.CATEGORY, "silent-disconnect", "Won't show a disconnect screen when you disconnects.");
}
}