reconnect crash fix & auto sign
This commit is contained in:
committed by
Cloudburst
parent
e7de14cd03
commit
e7c81710a8
@@ -81,6 +81,8 @@
|
||||
- `disableToasts`
|
||||
- Flight
|
||||
- `stopMomentum`
|
||||
- AutoSign
|
||||
- `Random characters` (Ported from [BleachHack](https://github.com/BleachDrinker420/BleachHack))
|
||||
- Module
|
||||
- `Duplicate names`
|
||||
|
||||
|
||||
@@ -2,13 +2,11 @@ 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.client.network.ServerInfo;
|
||||
import net.minecraft.command.CommandSource;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
@@ -21,10 +19,12 @@ public class ReconnectCommand extends Command {
|
||||
@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);
|
||||
ServerInfo info = mc.isInSingleplayer() ? null : mc.getCurrentServerEntry();
|
||||
if (info != null) {
|
||||
mc.world.disconnect();
|
||||
ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), mc,
|
||||
ServerAddress.parse(info.address), info);
|
||||
}
|
||||
return SINGLE_SUCCESS;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package anticope.rejects.mixin.meteor.modules;
|
||||
|
||||
import meteordevelopment.meteorclient.events.game.OpenScreenEvent;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.IntSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Category;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.world.AutoSign;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@Mixin(value = AutoSign.class, remap = false)
|
||||
public class AutoSignMixin extends Module {
|
||||
@Unique
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
@Shadow
|
||||
private String[] text;
|
||||
|
||||
private final Setting<Boolean> random = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("random")
|
||||
.description("Spams trash text to make people lag.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> length = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("random-length")
|
||||
.description("Random character length.")
|
||||
.defaultValue(500)
|
||||
.min(1)
|
||||
.sliderMax(1000)
|
||||
.build()
|
||||
);
|
||||
|
||||
public AutoSignMixin(Category category, String name, String description) {
|
||||
super(category, name, description);
|
||||
}
|
||||
|
||||
@Inject(method = "onOpenScreen",at = @At(value = "INVOKE", target = "Lmeteordevelopment/meteorclient/mixin/AbstractSignEditScreenAccessor;getSign()Lnet/minecraft/block/entity/SignBlockEntity;", shift = At.Shift.BEFORE))
|
||||
private void beforeGetSign(OpenScreenEvent event, CallbackInfo info) {
|
||||
if (random.get()) {
|
||||
text = new String[] {};
|
||||
while (text.length < 4) {
|
||||
IntStream chars = new Random().ints(0, 0x10FFFF);
|
||||
int amount = length.get();
|
||||
text = chars.limit(amount * 5L)
|
||||
.mapToObj(i -> String.valueOf((char) i)).collect(Collectors.joining())
|
||||
.split("(?<=\\G.{" + amount + "})");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@ public class AutoLogin extends Module {
|
||||
private class Listener {
|
||||
@EventHandler
|
||||
private void onGameJoined(GameJoinedEvent event) {
|
||||
if (!isActive()) return;
|
||||
String command = commands.get().getOrDefault("*", commands.get().get(Utils.getWorldName()));
|
||||
if (command != null) {
|
||||
timer.schedule(new TimerTask() {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"FontUtilsMixin",
|
||||
"DefaultSettingsWidgetFactoryMixin",
|
||||
"modules.FlightMixin",
|
||||
"modules.NoRenderAccessor"
|
||||
"modules.NoRenderAccessor",
|
||||
"modules.AutoSignMixin"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user