Search in sources :

Example 1 with SignEditScreenAccessor

use of mathax.client.mixin.SignEditScreenAccessor 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

EventHandler (mathax.client.eventbus.EventHandler)1 SignEditScreenAccessor (mathax.client.mixin.SignEditScreenAccessor)1 SignBlockEntity (net.minecraft.block.entity.SignBlockEntity)1 SignEditScreen (net.minecraft.client.gui.screen.ingame.SignEditScreen)1 UpdateSignC2SPacket (net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket)1