Search in sources :

Example 1 with DisconnectS2CPacket

use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project meteor-rejects by AntiCope.

the class KickCommand method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.then(literal("disconnect").executes(ctx -> {
        mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("Disconnected via .kick command")));
        return SINGLE_SUCCESS;
    }));
    builder.then(literal("pos").executes(ctx -> {
        mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, !mc.player.isOnGround()));
        return SINGLE_SUCCESS;
    }));
    builder.then(literal("hurt").executes(ctx -> {
        mc.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.attack(mc.player, mc.player.isSneaking()));
        return SINGLE_SUCCESS;
    }));
    builder.then(literal("chat").executes(ctx -> {
        mc.player.sendChatMessage("§0§1§");
        return SINGLE_SUCCESS;
    }));
    builder.then(literal("shutdown").executes(ctx -> {
        try {
            shutdown();
        } catch (Exception exception) {
            error("Couldn't disconnect. IOException");
        }
        return SINGLE_SUCCESS;
    }));
    builder.then(literal("crash").executes(ctx -> {
        GlfwUtil.makeJvmCrash();
        return SINGLE_SUCCESS;
    }));
}
Also used : CommandSource(net.minecraft.command.CommandSource) SINGLE_SUCCESS(com.mojang.brigadier.Command.SINGLE_SUCCESS) LiteralText(net.minecraft.text.LiteralText) Command(meteordevelopment.meteorclient.systems.commands.Command) SystemUtils(org.apache.commons.lang3.SystemUtils) PlayerInteractEntityC2SPacket(net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket) GlfwUtil(net.minecraft.client.util.GlfwUtil) PlayerMoveC2SPacket(net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket) DisconnectS2CPacket(net.minecraft.network.packet.s2c.play.DisconnectS2CPacket) LiteralArgumentBuilder(com.mojang.brigadier.builder.LiteralArgumentBuilder) DisconnectS2CPacket(net.minecraft.network.packet.s2c.play.DisconnectS2CPacket) LiteralText(net.minecraft.text.LiteralText)

Example 2 with DisconnectS2CPacket

use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project BleachHack by BleachDrinker420.

the class Ambience method readPacket.

@BleachSubscribe
public void readPacket(EventPacket.Read event) {
    if (event.getPacket() instanceof GameStateChangeS2CPacket && getSetting(0).asToggle().getState()) {
        GameStateChangeS2CPacket packet = (GameStateChangeS2CPacket) event.getPacket();
        if (packet.getReason() == GameStateChangeS2CPacket.RAIN_STARTED) {
            weatherManager.setRain(1f);
        } else if (packet.getReason() == GameStateChangeS2CPacket.RAIN_STOPPED) {
            weatherManager.setRain(0f);
        } else if (packet.getReason() == GameStateChangeS2CPacket.RAIN_GRADIENT_CHANGED) {
            weatherManager.setRain(packet.getValue());
        } else if (packet.getReason() == GameStateChangeS2CPacket.THUNDER_GRADIENT_CHANGED) {
            weatherManager.setThunder(packet.getValue());
        } else {
            return;
        }
        event.setCancelled(true);
    } else if (event.getPacket() instanceof DisconnectS2CPacket && getSetting(0).asToggle().getState()) {
        weatherManager.reset();
    } else if (event.getPacket() instanceof WorldTimeUpdateS2CPacket && getSetting(1).asToggle().getState()) {
        event.setCancelled(true);
    }
}
Also used : WorldTimeUpdateS2CPacket(net.minecraft.network.packet.s2c.play.WorldTimeUpdateS2CPacket) GameStateChangeS2CPacket(net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket) DisconnectS2CPacket(net.minecraft.network.packet.s2c.play.DisconnectS2CPacket) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 3 with DisconnectS2CPacket

use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project meteor-client by MeteorDevelopment.

the class AutoLog method onTick.

@EventHandler
private void onTick(TickEvent.Post event) {
    if (mc.player.getHealth() <= 0) {
        this.toggle();
        return;
    }
    if (mc.player.getHealth() <= health.get()) {
        mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Health was lower than " + health.get() + ".")));
        if (smartToggle.get()) {
            this.toggle();
            enableHealthListener();
        }
    }
    if (smart.get() && mc.player.getHealth() + mc.player.getAbsorptionAmount() - PlayerUtils.possibleHealthReductions() < health.get()) {
        mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Health was going to be lower than " + health.get() + ".")));
        if (toggleOff.get())
            this.toggle();
    }
    for (Entity entity : mc.world.getEntities()) {
        if (entity instanceof PlayerEntity && entity.getUuid() != mc.player.getUuid()) {
            if (onlyTrusted.get() && entity != mc.player && !Friends.get().isFriend((PlayerEntity) entity)) {
                mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] A non-trusted player appeared in your render distance.")));
                if (toggleOff.get())
                    this.toggle();
                break;
            }
            if (mc.player.distanceTo(entity) < 8 && instantDeath.get() && DamageUtils.getSwordDamage((PlayerEntity) entity, true) > mc.player.getHealth() + mc.player.getAbsorptionAmount()) {
                mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Anti-32k measures.")));
                if (toggleOff.get())
                    this.toggle();
                break;
            }
        }
        if (entity instanceof EndCrystalEntity && mc.player.distanceTo(entity) < range.get() && crystalLog.get()) {
            mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] End Crystal appeared within specified range.")));
            if (toggleOff.get())
                this.toggle();
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) DisconnectS2CPacket(net.minecraft.network.packet.s2c.play.DisconnectS2CPacket) LiteralText(net.minecraft.text.LiteralText) PlayerEntity(net.minecraft.entity.player.PlayerEntity) EventHandler(meteordevelopment.orbit.EventHandler)

Example 4 with DisconnectS2CPacket

use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project meteor-client by MeteorDevelopment.

the class InfinityMiner method logOut.

private void logOut() {
    toggle();
    mc.player.networkHandler.sendPacket(new DisconnectS2CPacket(new LiteralText("[Infinity Miner] Inventory is full.")));
}
Also used : DisconnectS2CPacket(net.minecraft.network.packet.s2c.play.DisconnectS2CPacket) LiteralText(net.minecraft.text.LiteralText)

Example 5 with DisconnectS2CPacket

use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project Client by MatHax.

the class AutoLog method onTick.

@EventHandler
private void onTick(TickEvent.Post event) {
    if (mc.player.getHealth() <= 0) {
        toggle();
        return;
    }
    if (totems.get() && InvUtils.find(Items.TOTEM_OF_UNDYING).count() <= totemCount.get()) {
        mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Totems was lower than " + totemCount.get() + ".")));
        toggle();
    }
    if (mc.player.getHealth() <= health.get()) {
        mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Health was lower than " + health.get() + ".")));
        if (smartToggle.get()) {
            toggle();
            enableHealthListener();
        }
    }
    if (smart.get() && mc.player.getHealth() + mc.player.getAbsorptionAmount() - PlayerUtils.possibleHealthReductions() < health.get()) {
        mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Health was going to be lower than " + health.get() + ".")));
        if (toggleOff.get())
            toggle();
    }
    for (Entity entity : mc.world.getEntities()) {
        if (entity instanceof PlayerEntity && entity.getUuid() != mc.player.getUuid()) {
            if (onlyTrusted.get() && entity != mc.player && !Friends.get().isFriend((PlayerEntity) entity)) {
                mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] A non-trusted player appeared in your render distance.")));
                if (toggleOff.get())
                    toggle();
                break;
            }
            if (mc.player.distanceTo(entity) < 8 && instantDeath.get() && DamageUtils.getSwordDamage((PlayerEntity) entity, true) > mc.player.getHealth() + mc.player.getAbsorptionAmount()) {
                mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Anti-32k measures.")));
                if (toggleOff.get())
                    toggle();
                break;
            }
        }
        if (entity instanceof EndCrystalEntity && mc.player.distanceTo(entity) < range.get() && crystalLog.get()) {
            mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] End Crystal appeared within specified range.")));
            if (toggleOff.get())
                toggle();
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) DisconnectS2CPacket(net.minecraft.network.packet.s2c.play.DisconnectS2CPacket) LiteralText(net.minecraft.text.LiteralText) PlayerEntity(net.minecraft.entity.player.PlayerEntity) EventHandler(mathax.client.eventbus.EventHandler)

Aggregations

DisconnectS2CPacket (net.minecraft.network.packet.s2c.play.DisconnectS2CPacket)7 LiteralText (net.minecraft.text.LiteralText)5 Entity (net.minecraft.entity.Entity)2 EndCrystalEntity (net.minecraft.entity.decoration.EndCrystalEntity)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 SINGLE_SUCCESS (com.mojang.brigadier.Command.SINGLE_SUCCESS)1 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)1 EventTarget (dev.hypnotic.event.EventTarget)1 EventReceivePacket (dev.hypnotic.event.events.EventReceivePacket)1 EventRender3D (dev.hypnotic.event.events.EventRender3D)1 Category (dev.hypnotic.module.Category)1 Mod (dev.hypnotic.module.Mod)1 RenderUtils (dev.hypnotic.utils.render.RenderUtils)1 WorldUtils (dev.hypnotic.utils.world.WorldUtils)1 Color (java.awt.Color)1 ArrayDeque (java.util.ArrayDeque)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1