use of net.minecraft.block.entity.SignBlockEntity in project BleachHack by BleachDrinker420.
the class NoRender method onSignRender.
@BleachSubscribe
public void onSignRender(EventBlockEntityRender.Single.Pre event) {
if (event.getBlockEntity() instanceof SignBlockEntity && isWorldToggled(0)) {
SettingToggle signSetting = getWorldChild(0);
if (signSetting.getChild(0).asMode().getMode() == 0) {
event.setCancelled(true);
} else {
SignBlockEntity sign = new SignBlockEntity(event.getBlockEntity().getPos(), event.getBlockEntity().getCachedState());
sign.setWorld(mc.world);
if (signSetting.getChild(0).asMode().getMode() == 2) {
for (int i = 0; i < 4; i++) {
sign.setTextOnRow(i, signText[i]);
}
}
event.setBlockEntity(sign);
}
}
}
use of net.minecraft.block.entity.SignBlockEntity 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 net.minecraft.block.entity.SignBlockEntity in project EdenClient by HahaOO7.
the class ChestShopMod method checkForShops.
private void checkForShops(ChunkManager cm, ChunkPos chunk) {
if (!cm.isChunkLoaded(chunk.x, chunk.z))
return;
WorldChunk c = cm.getWorldChunk(chunk.x, chunk.z, false);
if (c == null)
return;
shops.remove(chunk);
ChestShopSet cs = new ChestShopSet();
c.getBlockEntities().values().stream().filter(t -> t instanceof SignBlockEntity).map(t -> (SignBlockEntity) t).map(ChestShopEntry::new).filter(ChestShopEntry::isShop).forEach(cs::add);
shops.put(chunk, cs);
}
use of net.minecraft.block.entity.SignBlockEntity 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();
}
use of net.minecraft.block.entity.SignBlockEntity in project tweakermore by Fallen-Breath.
the class SignTextCopier method copySignText.
public static boolean copySignText(KeyAction action, IKeybind key) {
MinecraftClient mc = MinecraftClient.getInstance();
if (mc.world != null && mc.crosshairTarget != null && mc.crosshairTarget.getType() == HitResult.Type.BLOCK) {
BlockPos blockPos = ((BlockHitResult) mc.crosshairTarget).getBlockPos();
BlockState blockState = mc.world.getBlockState(blockPos);
if (blockState.getBlock() instanceof AbstractSignBlock) {
BlockEntity blockEntity = mc.world.getBlockEntity(blockPos);
if (blockEntity instanceof SignBlockEntity) {
String text = Joiner.on("\n").join(Arrays.stream(((SignBlockEntity) blockEntity).text).map(Text::getString).collect(Collectors.toList()));
text = StringUtils.strip(text);
if (!text.isEmpty()) {
mc.keyboard.setClipboard(text);
InfoUtils.printActionbarMessage("tweakermore.config.copySignTextToClipBoard.sign_copied", blockState.getBlock().getName());
} else {
InfoUtils.printActionbarMessage("tweakermore.config.copySignTextToClipBoard.empty_sign", blockState.getBlock().getName());
}
return true;
}
}
}
InfoUtils.printActionbarMessage("tweakermore.config.copySignTextToClipBoard.no_sign");
return false;
}
Aggregations