Search in sources :

Example 1 with SignEditScreen

use of net.minecraft.client.gui.screen.ingame.SignEditScreen in project BleachHack by BleachDrinker420.

the class AutoSign method onOpenScreen.

@BleachSubscribe
public void onOpenScreen(EventOpenScreen event) {
    if (text.length < 3)
        return;
    if (event.getScreen() instanceof SignEditScreen) {
        event.setCancelled(true);
        if (getSetting(0).asToggle().getState()) {
            text = new String[] {};
            while (text.length < 4) {
                IntStream chars = new Random().ints(0, 0x10FFFF);
                int amount = getSetting(0).asToggle().getChild(0).asSlider().getValueInt();
                text = chars.limit(amount * 5).mapToObj(i -> String.valueOf((char) i)).collect(Collectors.joining()).split("(?<=\\G.{" + amount + "})");
            }
        }
        SignBlockEntity sign = ((SignEditScreen) event.getScreen()).sign;
        mc.player.networkHandler.sendPacket(new UpdateSignC2SPacket(sign.getPos(), text[0], text[1], text[2], text[3]));
    }
}
Also used : BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe) SettingSlider(org.bleachhack.setting.module.SettingSlider) IntStream(java.util.stream.IntStream) SignEditScreen(net.minecraft.client.gui.screen.ingame.SignEditScreen) ModuleCategory(org.bleachhack.module.ModuleCategory) UpdateSignC2SPacket(net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket) EventOpenScreen(org.bleachhack.event.events.EventOpenScreen) Random(java.util.Random) Collectors(java.util.stream.Collectors) Module(org.bleachhack.module.Module) SignBlockEntity(net.minecraft.block.entity.SignBlockEntity) SettingToggle(org.bleachhack.setting.module.SettingToggle) EventPacket(org.bleachhack.event.events.EventPacket) Random(java.util.Random) SignBlockEntity(net.minecraft.block.entity.SignBlockEntity) SignEditScreen(net.minecraft.client.gui.screen.ingame.SignEditScreen) UpdateSignC2SPacket(net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket) IntStream(java.util.stream.IntStream) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 2 with SignEditScreen

use of net.minecraft.client.gui.screen.ingame.SignEditScreen in project meteor-client by MeteorDevelopment.

the class AutoSign method onOpenScreen.

@EventHandler
private void onOpenScreen(OpenScreenEvent event) {
    if (!(event.screen instanceof SignEditScreen) || text == null)
        return;
    SignBlockEntity sign = ((SignEditScreenAccessor) event.screen).getSign();
    mc.player.networkHandler.sendPacket(new UpdateSignC2SPacket(sign.getPos(), text[0], text[1], text[2], text[3]));
    event.cancel();
}
Also used : SignBlockEntity(net.minecraft.block.entity.SignBlockEntity) SignEditScreenAccessor(meteordevelopment.meteorclient.mixin.SignEditScreenAccessor) SignEditScreen(net.minecraft.client.gui.screen.ingame.SignEditScreen) UpdateSignC2SPacket(net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket) EventHandler(meteordevelopment.orbit.EventHandler)

Example 3 with SignEditScreen

use of net.minecraft.client.gui.screen.ingame.SignEditScreen in project Client by MatHax.

the class AutoSign method onOpenScreen.

@EventHandler
private void onOpenScreen(OpenScreenEvent event) {
    if (!(event.screen instanceof SignEditScreen))
        return;
    SignBlockEntity sign = ((SignEditScreenAccessor) event.screen).getSign();
    String lineOne = Placeholders.apply(lineone.get().replace("%date%", getDate()));
    String lineTwo = Placeholders.apply(linetwo.get().replace("%date%", getDate()));
    String lineThree = Placeholders.apply(linethree.get().replace("%date%", getDate()));
    String lineFour = Placeholders.apply(linefour.get().replace("%date%", getDate()));
    mc.player.networkHandler.sendPacket(new UpdateSignC2SPacket(sign.getPos(), lineOne, lineTwo, lineThree, lineFour));
    event.cancel();
}
Also used : SignBlockEntity(net.minecraft.block.entity.SignBlockEntity) SignEditScreenAccessor(mathax.client.mixin.SignEditScreenAccessor) SignEditScreen(net.minecraft.client.gui.screen.ingame.SignEditScreen) UpdateSignC2SPacket(net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket) EventHandler(mathax.client.eventbus.EventHandler)

Aggregations

SignBlockEntity (net.minecraft.block.entity.SignBlockEntity)3 SignEditScreen (net.minecraft.client.gui.screen.ingame.SignEditScreen)3 UpdateSignC2SPacket (net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket)3 Random (java.util.Random)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 EventHandler (mathax.client.eventbus.EventHandler)1 SignEditScreenAccessor (mathax.client.mixin.SignEditScreenAccessor)1 SignEditScreenAccessor (meteordevelopment.meteorclient.mixin.SignEditScreenAccessor)1 EventHandler (meteordevelopment.orbit.EventHandler)1 EventOpenScreen (org.bleachhack.event.events.EventOpenScreen)1 EventPacket (org.bleachhack.event.events.EventPacket)1 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)1 Module (org.bleachhack.module.Module)1 ModuleCategory (org.bleachhack.module.ModuleCategory)1 SettingSlider (org.bleachhack.setting.module.SettingSlider)1 SettingToggle (org.bleachhack.setting.module.SettingToggle)1