Search in sources :

Example 46 with TranslatableText

use of net.minecraft.text.TranslatableText in project sodium-extra-fabric by FlashyReese.

the class SodiumExtraGameOptionPages method animation.

public static OptionPage animation() {
    List<OptionGroup> groups = new ArrayList<>();
    groups.add(OptionGroup.createBuilder().add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("gui.socialInteractions.tab_all")).setTooltip(new TranslatableText("sodium-extra.option.animations_all.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.animationSettings.animation = value, opts -> opts.animationSettings.animation).build()).build());
    groups.add(OptionGroup.createBuilder().add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("block.minecraft.water")).setTooltip(new TranslatableText("sodium-extra.option.animate_water.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.animationSettings.water = value, opts -> opts.animationSettings.water).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("block.minecraft.lava")).setTooltip(new TranslatableText("sodium-extra.option.animate_lava.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.animationSettings.lava = value, opts -> opts.animationSettings.lava).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("block.minecraft.fire")).setTooltip(new TranslatableText("sodium-extra.option.animate_fire.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.animationSettings.fire = value, opts -> opts.animationSettings.fire).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("block.minecraft.nether_portal")).setTooltip(new TranslatableText("sodium-extra.option.animate_portal.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.animationSettings.portal = value, opts -> opts.animationSettings.portal).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.block_animations")).setTooltip(new TranslatableText("sodium-extra.option.block_animations.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.animationSettings.blockAnimations = value, options -> options.animationSettings.blockAnimations).build()).build());
    return new OptionPage(new TranslatableText("sodium-extra.option.animations"), ImmutableList.copyOf(groups));
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) SliderControlExtended(me.flashyreese.mods.sodiumextra.client.gui.options.control.SliderControlExtended) TickBoxControl(me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl) MinecraftOptionsStorage(me.jellysquid.mods.sodium.client.gui.options.storage.MinecraftOptionsStorage) me.jellysquid.mods.sodium.client.gui.options(me.jellysquid.mods.sodium.client.gui.options) SodiumExtraOptionsStorage(me.flashyreese.mods.sodiumextra.client.gui.options.storage.SodiumExtraOptionsStorage) CyclingControl(me.jellysquid.mods.sodium.client.gui.options.control.CyclingControl) TranslatableText(net.minecraft.text.TranslatableText) ArrayList(java.util.ArrayList) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ControlValueFormatterExtended(me.flashyreese.mods.sodiumextra.common.util.ControlValueFormatterExtended) MinecraftClient(net.minecraft.client.MinecraftClient) ControlValueFormatter(me.jellysquid.mods.sodium.client.gui.options.control.ControlValueFormatter) SliderControl(me.jellysquid.mods.sodium.client.gui.options.control.SliderControl) ArrayList(java.util.ArrayList) TickBoxControl(me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl)

Example 47 with TranslatableText

use of net.minecraft.text.TranslatableText in project sodium-extra-fabric by FlashyReese.

the class SodiumExtraGameOptionPages method extra.

public static OptionPage extra() {
    List<OptionGroup> groups = new ArrayList<>();
    groups.add(OptionGroup.createBuilder().add(OptionImpl.createBuilder(boolean.class, vanillaOpts).setName(new TranslatableText("sodium-extra.option.gl_debug_verbosity")).setTooltip(new TranslatableText("sodium-extra.option.gl_debug_verbosity.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.glDebugVerbosity = value ? 1 : 0, options -> options.glDebugVerbosity == 1).build()).add(OptionImpl.createBuilder(boolean.class, SodiumExtraGameOptionPages.sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.use_fast_random")).setTooltip(new TranslatableText("sodium-extra.option.use_fast_random.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.extraSettings.useFastRandom = value, options -> options.extraSettings.useFastRandom).setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.reduce_resolution_on_mac")).setTooltip(new TranslatableText("sodium-extra.option.reduce_resolution_on_mac.tooltip")).setEnabled(MinecraftClient.IS_SYSTEM_MAC).setImpact(OptionImpact.HIGH).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.extraSettings.reduceResolutionOnMac = value, opts -> opts.extraSettings.reduceResolutionOnMac).build()).build());
    groups.add(OptionGroup.createBuilder().add(OptionImpl.createBuilder(SodiumExtraGameOptions.OverlayCorner.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.overlay_corner")).setTooltip(new TranslatableText("sodium-extra.option.overlay_corner.tooltip")).setControl(option -> new CyclingControl<>(option, SodiumExtraGameOptions.OverlayCorner.class)).setBinding((opts, value) -> opts.extraSettings.overlayCorner = value, opts -> opts.extraSettings.overlayCorner).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.show_fps")).setTooltip(new TranslatableText("sodium-extra.option.show_fps.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.extraSettings.showFps = value, opts -> opts.extraSettings.showFps).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.show_fps_extended")).setTooltip(new TranslatableText("sodium-extra.option.show_fps_extended.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.extraSettings.showFPSExtended = value, opts -> opts.extraSettings.showFPSExtended).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.show_coordinates")).setTooltip(new TranslatableText("sodium-extra.option.show_coordinates.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.extraSettings.showCoords = value, opts -> opts.extraSettings.showCoords).build()).add(OptionImpl.createBuilder(int.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.cloud_height")).setTooltip(new TranslatableText("sodium-extra.option.cloud_height.tooltip")).setControl(option -> new SliderControl(option, -64, 319, 1, ControlValueFormatter.number())).setBinding((options, value) -> options.extraSettings.cloudHeight = value, options -> options.extraSettings.cloudHeight).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.toasts")).setTooltip(new TranslatableText("sodium-extra.option.toasts.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.extraSettings.toasts = value, options -> options.extraSettings.toasts).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.instant_sneak")).setTooltip(new TranslatableText("sodium-extra.option.instant_sneak.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.extraSettings.instantSneak = value, options -> options.extraSettings.instantSneak).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.prevent_shaders")).setTooltip(new TranslatableText("sodium-extra.option.prevent_shaders.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.extraSettings.preventShaders = value, options -> options.extraSettings.preventShaders).setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD).build()).build());
    return new OptionPage(new TranslatableText("sodium-extra.option.extras"), ImmutableList.copyOf(groups));
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) SliderControlExtended(me.flashyreese.mods.sodiumextra.client.gui.options.control.SliderControlExtended) TickBoxControl(me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl) MinecraftOptionsStorage(me.jellysquid.mods.sodium.client.gui.options.storage.MinecraftOptionsStorage) me.jellysquid.mods.sodium.client.gui.options(me.jellysquid.mods.sodium.client.gui.options) SodiumExtraOptionsStorage(me.flashyreese.mods.sodiumextra.client.gui.options.storage.SodiumExtraOptionsStorage) CyclingControl(me.jellysquid.mods.sodium.client.gui.options.control.CyclingControl) TranslatableText(net.minecraft.text.TranslatableText) ArrayList(java.util.ArrayList) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ControlValueFormatterExtended(me.flashyreese.mods.sodiumextra.common.util.ControlValueFormatterExtended) MinecraftClient(net.minecraft.client.MinecraftClient) ControlValueFormatter(me.jellysquid.mods.sodium.client.gui.options.control.ControlValueFormatter) SliderControl(me.jellysquid.mods.sodium.client.gui.options.control.SliderControl) ArrayList(java.util.ArrayList) TickBoxControl(me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl) SliderControl(me.jellysquid.mods.sodium.client.gui.options.control.SliderControl)

Example 48 with TranslatableText

use of net.minecraft.text.TranslatableText in project sodium-extra-fabric by FlashyReese.

the class SodiumExtraGameOptionPages method particle.

public static OptionPage particle() {
    List<OptionGroup> groups = new ArrayList<>();
    groups.add(OptionGroup.createBuilder().add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("gui.socialInteractions.tab_all")).setTooltip(new TranslatableText("sodium-extra.option.particles_all.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.particles = value, opts -> opts.particleSettings.particles).build()).build());
    groups.add(OptionGroup.createBuilder().add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("subtitles.entity.generic.splash")).setTooltip(new TranslatableText("sodium-extra.option.rain_splash.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.rainSplash = value, opts -> opts.particleSettings.rainSplash).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("subtitles.entity.generic.explode")).setTooltip(new TranslatableText("sodium-extra.option.explosions.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.explosion = value, opts -> opts.particleSettings.explosion).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("block.minecraft.water")).setTooltip(new TranslatableText("sodium-extra.option.water.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.water = value, opts -> opts.particleSettings.water).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.smoke")).setTooltip(new TranslatableText("sodium-extra.option.smoke.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.smoke = value, opts -> opts.particleSettings.smoke).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("item.minecraft.potion")).setTooltip(new TranslatableText("sodium-extra.option.potions.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.potion = value, opts -> opts.particleSettings.potion).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("block.minecraft.nether_portal")).setTooltip(new TranslatableText("sodium-extra.option.portal.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.portal = value, opts -> opts.particleSettings.portal).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("itemGroup.redstone")).setTooltip(new TranslatableText("sodium-extra.option.redstone.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.redstone = value, opts -> opts.particleSettings.redstone).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.dripping_particles")).setTooltip(new TranslatableText("sodium-extra.option.dripping_particles.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.drip = value, opts -> opts.particleSettings.drip).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("subtitles.entity.firework_rocket.blast")).setTooltip(new TranslatableText("sodium-extra.option.fireworks.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.firework = value, opts -> opts.particleSettings.firework).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("block.minecraft.bubble_column")).setTooltip(new TranslatableText("sodium-extra.option.bubbles.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.bubble = value, opts -> opts.particleSettings.bubble).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("soundCategory.ambient")).setTooltip(new TranslatableText("sodium-extra.option.environment.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.environment = value, opts -> opts.particleSettings.environment).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("entity.minecraft.villager")).setTooltip(new TranslatableText("sodium-extra.option.villagers.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.villagers = value, opts -> opts.particleSettings.villagers).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("block.minecraft.composter")).setTooltip(new TranslatableText("sodium-extra.option.composter.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.composter = value, opts -> opts.particleSettings.composter).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("subtitles.block.generic.break")).setTooltip(new TranslatableText("sodium-extra.option.block_break.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.blockBreak = value, opts -> opts.particleSettings.blockBreak).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("subtitles.block.generic.hit")).setTooltip(new TranslatableText("sodium-extra.option.block_breaking.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.particleSettings.blockBreaking = value, opts -> opts.particleSettings.blockBreaking).build()).build());
    return new OptionPage(new TranslatableText("options.particles"), ImmutableList.copyOf(groups));
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) SliderControlExtended(me.flashyreese.mods.sodiumextra.client.gui.options.control.SliderControlExtended) TickBoxControl(me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl) MinecraftOptionsStorage(me.jellysquid.mods.sodium.client.gui.options.storage.MinecraftOptionsStorage) me.jellysquid.mods.sodium.client.gui.options(me.jellysquid.mods.sodium.client.gui.options) SodiumExtraOptionsStorage(me.flashyreese.mods.sodiumextra.client.gui.options.storage.SodiumExtraOptionsStorage) CyclingControl(me.jellysquid.mods.sodium.client.gui.options.control.CyclingControl) TranslatableText(net.minecraft.text.TranslatableText) ArrayList(java.util.ArrayList) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ControlValueFormatterExtended(me.flashyreese.mods.sodiumextra.common.util.ControlValueFormatterExtended) MinecraftClient(net.minecraft.client.MinecraftClient) ControlValueFormatter(me.jellysquid.mods.sodium.client.gui.options.control.ControlValueFormatter) SliderControl(me.jellysquid.mods.sodium.client.gui.options.control.SliderControl) ArrayList(java.util.ArrayList) TickBoxControl(me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl)

Example 49 with TranslatableText

use of net.minecraft.text.TranslatableText in project tweakermore by Fallen-Breath.

the class ShulkerToolTipEnhancer method appendEnchantmentHints.

public static void appendEnchantmentHints(ItemStack itemStack, Text text) {
    if (TweakerMoreConfigs.SHULKER_TOOLTIP_ENCHANTMENT_HINT.getBooleanValue()) {
        List<Text> enchantmentTexts = Lists.newArrayList();
        ListTag enchantmentTag = itemStack.getItem() instanceof EnchantedBookItem ? EnchantedBookItem.getEnchantmentTag(itemStack) : itemStack.getEnchantments();
        ItemStack.appendEnchantments(enchantmentTexts, enchantmentTag);
        int amount = enchantmentTexts.size();
        if (amount > 0) {
            TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
            Text extraText = new LiteralText(" | ").formatted(Formatting.DARK_GRAY);
            int idx;
            for (idx = 0; idx < amount; idx++) {
                if (idx > 0 && textRenderer.getStringWidth(extraText.getString() + enchantmentTexts.get(idx).getString()) > MAX_TEXT_LENGTH) {
                    break;
                }
                extraText.append(enchantmentTexts.get(idx));
                if (idx < amount - 1) {
                    extraText.append(new LiteralText(", ").formatted(Formatting.GRAY));
                }
            }
            if (idx < amount) {
                extraText.append(new TranslatableText("tweakermore.config.shulkerTooltipEnchantmentHint.more", amount - idx).formatted(Formatting.GRAY));
            }
            text.append(extraText);
        }
    }
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) EnchantedBookItem(net.minecraft.item.EnchantedBookItem) LiteralText(net.minecraft.text.LiteralText) TranslatableText(net.minecraft.text.TranslatableText) Text(net.minecraft.text.Text) ListTag(net.minecraft.nbt.ListTag) TextRenderer(net.minecraft.client.font.TextRenderer) LiteralText(net.minecraft.text.LiteralText)

Example 50 with TranslatableText

use of net.minecraft.text.TranslatableText in project ArmorStandEditor by Patbox.

the class EditorGuis method createIcon.

private static void createIcon(ServerPlayerEntity player, SimpleGui gui, int index, Item item, String text, EditorActions action) {
    if (!Permissions.check(player, "armorstandeditor" + action.permission, ConfigManager.getConfig().configData.toggleAllPermissionOnByDefault)) {
        return;
    }
    ItemStack itemStack = item.getDefaultStack();
    itemStack.setCustomName(new TranslatableText("armorstandeditor.gui.name." + text).setStyle(Style.EMPTY.withItalic(false)));
    itemStack.addHideFlag(ItemStack.TooltipSection.ENCHANTMENTS);
    itemStack.addHideFlag(ItemStack.TooltipSection.MODIFIERS);
    if (((SPEInterface) player).getArmorStandEditorAction() == action) {
        itemStack.addEnchantment(Enchantments.POWER, 1);
    }
    gui.setSlot(index, itemStack, (index2, type, actionType) -> {
        ((SPEInterface) player).setArmorStandEditorAction(action);
    });
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) SPEInterface(eu.pb4.armorstandeditor.helpers.SPEInterface) ItemStack(net.minecraft.item.ItemStack)

Aggregations

TranslatableText (net.minecraft.text.TranslatableText)161 LiteralText (net.minecraft.text.LiteralText)30 Text (net.minecraft.text.Text)19 ItemStack (net.minecraft.item.ItemStack)16 ArrayList (java.util.ArrayList)15 ButtonWidget (net.minecraft.client.gui.widget.ButtonWidget)14 List (java.util.List)12 MinecraftClient (net.minecraft.client.MinecraftClient)12 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)12 SPEInterface (eu.pb4.armorstandeditor.helpers.SPEInterface)9 LivingEntity (net.minecraft.entity.LivingEntity)9 PlayerEntity (net.minecraft.entity.player.PlayerEntity)8 ListTag (net.minecraft.nbt.ListTag)8 Formatting (net.minecraft.util.Formatting)8 BlockPos (net.minecraft.util.math.BlockPos)8 Environment (net.fabricmc.api.Environment)7 AbstractButtonWidget (net.minecraft.client.gui.widget.AbstractButtonWidget)7 Entity (net.minecraft.entity.Entity)7 Collection (java.util.Collection)6 ArmorStandPreset (eu.pb4.armorstandeditor.config.ArmorStandPreset)5