Search in sources :

Example 1 with TextValueBox

use of com.simibubi.create.foundation.tileEntity.behaviour.ValueBox.TextValueBox in project Create by Creators-of-Create.

the class ScrollValueRenderer method addBox.

protected static void addBox(ClientLevel world, BlockPos pos, Direction face, ScrollValueBehaviour behaviour, boolean highlight) {
    AABB bb = new AABB(Vec3.ZERO, Vec3.ZERO).inflate(.5f).contract(0, 0, -.5f).move(0, 0, -.125f);
    Component label = behaviour.label;
    ValueBox box;
    if (behaviour instanceof ScrollOptionBehaviour) {
        box = new IconValueBox(label, ((ScrollOptionBehaviour<?>) behaviour).getIconForSelected(), bb, pos);
    } else {
        box = new TextValueBox(label, bb, pos, new TextComponent(behaviour.formatValue()));
        if (behaviour.unit != null)
            box.subLabel(new TextComponent("(").append(behaviour.unit.apply(behaviour.scrollableValue)).append(")"));
    }
    box.scrollTooltip(new TextComponent("[").append(Lang.translate("action.scroll")).append("]"));
    box.offsetLabel(behaviour.textShift.add(20, -10, 0)).withColors(0x5A5D5A, 0xB5B7B6).passive(!highlight);
    CreateClient.OUTLINER.showValueBox(pos, box.transform(behaviour.slotPositioning)).lineWidth(1 / 64f).highlightFace(face);
}
Also used : TextComponent(net.minecraft.network.chat.TextComponent) IconValueBox(com.simibubi.create.foundation.tileEntity.behaviour.ValueBox.IconValueBox) ValueBox(com.simibubi.create.foundation.tileEntity.behaviour.ValueBox) TextValueBox(com.simibubi.create.foundation.tileEntity.behaviour.ValueBox.TextValueBox) IconValueBox(com.simibubi.create.foundation.tileEntity.behaviour.ValueBox.IconValueBox) TextValueBox(com.simibubi.create.foundation.tileEntity.behaviour.ValueBox.TextValueBox) Component(net.minecraft.network.chat.Component) TextComponent(net.minecraft.network.chat.TextComponent) AABB(net.minecraft.world.phys.AABB)

Aggregations

ValueBox (com.simibubi.create.foundation.tileEntity.behaviour.ValueBox)1 IconValueBox (com.simibubi.create.foundation.tileEntity.behaviour.ValueBox.IconValueBox)1 TextValueBox (com.simibubi.create.foundation.tileEntity.behaviour.ValueBox.TextValueBox)1 Component (net.minecraft.network.chat.Component)1 TextComponent (net.minecraft.network.chat.TextComponent)1 AABB (net.minecraft.world.phys.AABB)1