use of org.bleachhack.event.events.EventOpenScreen 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]));
}
}
use of org.bleachhack.event.events.EventOpenScreen in project BleachHack by BleachDrinker420.
the class MixinMinecraftClient method setScreen.
@Inject(method = "setScreen", at = @At("HEAD"), cancellable = true)
private void setScreen(Screen screen, CallbackInfo info) {
EventOpenScreen event = new EventOpenScreen(screen);
BleachHack.eventBus.post(event);
if (event.isCancelled()) {
info.cancel();
}
}
Aggregations