com.github.vini2003.blade.common.miscellaneous.Position

Here are the examples of the java api com.github.vini2003.blade.common.miscellaneous.Position taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

10 Source : WidgetUtilities.java
with MIT License
from Mixinors

public static void createTransferTab(TabWidgetCollection tab, Position anchor, Direction rotation, BlockEnreplacedyTransferComponent component, BlockPos blockPos, ComponentType<?> type) {
    final Position finalNorth = Position.of(anchor, 7 + 22, 31 + 22);
    final Position finalSouth = Position.of(anchor, 7 + 0, 31 + 44);
    final Position finalUp = Position.of(anchor, 7 + 22, 31 + 0);
    final Position finalDown = Position.of(anchor, 7 + 22, 31 + 44);
    final Position finalWest = Position.of(anchor, 7 + 44, 31 + 22);
    final Position finalEast = Position.of(anchor, 7 + 0, 31 + 22);
    final ImmutableMap<Direction, Position> positions = ImmutableMap.<Direction, Position>builder().put(Direction.NORTH, finalNorth).put(Direction.SOUTH, finalSouth).put(Direction.WEST, finalWest).put(Direction.EAST, finalEast).put(Direction.UP, finalUp).put(Direction.DOWN, finalDown).build();
    for (Direction direction : Direction.values()) {
        TransferTypeSelectorButtonWidget button = new TransferTypeSelectorButtonWidget();
        button.setPosition(positions.get(MirrorUtilities.rotate(direction, rotation)));
        button.setSize(Size.of(18, 18));
        button.setComponent(component);
        button.setType(type);
        button.setRotation(rotation);
        button.setDirection(direction);
        button.setBlockPos(blockPos);
        tab.addWidget(button);
    }
}

9 Source : ComponentEntityScreenHandler.java
with MIT License
from Mixinors

@Override
public void initialize(int width, int height) {
    tabs = new TabWidget();
    tabs.setSize(Size.of(176F, 188F + getTabWidgetExtendedHeight()));
    tabs.setPosition(Position.of(width / 2 - tabs.getWidth() / 2, height / 2 - tabs.getHeight() / 2));
    addWidget(tabs);
    mainTab = (TabWidgetCollection) tabs.addTab(getSymbol());
    mainTab.setPosition(Position.of(tabs, 0, 25F + 7F));
    mainTab.setSize(Size.of(176F, 184F));
    TextWidget replacedle = new TextWidget();
    replacedle.setPosition(Position.of(mainTab, 8, 0));
    replacedle.setText(syncEnreplacedy.getDisplayName());
    replacedle.setColor(4210752);
    mainTab.addWidget(replacedle);
    Position invPos = Position.of(tabs, 7F, 25F + 7F + (184 - 18 - 18 - (18 * 4) - 3 + getTabWidgetExtendedHeight()));
    TextWidget invreplacedle = new TextWidget();
    invreplacedle.setPosition(Position.of(invPos, 0, -10));
    invreplacedle.setText(getPlayer().inventory.getName());
    invreplacedle.setColor(4210752);
    mainTab.addWidget(invreplacedle);
    playerSlots = Slots.addPlayerInventory(invPos, Size.of(18F, 18F), mainTab, getPlayer().inventory);
}

6 Source : ComponentBlockEntityScreenHandler.java
with MIT License
from Mixinors

@Override
public void initialize(int width, int height) {
    tabs = new TabWidget();
    tabs.setSize(getTabsSize(width, height));
    tabs.setPosition(getTabsPosition(width, height));
    addWidget(tabs);
    mainTab = (TabWidgetCollection) tabs.addTab(syncBlockEnreplacedy.getCachedState().getBlock().asItem());
    mainTab.setPosition(Position.of(tabs, 0, 25F + 7F));
    mainTab.setSize(Size.of(176F, 184F));
    TextWidget replacedle = new TextWidget();
    replacedle.setPosition(Position.of(mainTab, 8, 0));
    replacedle.setText(new TranslatableText(syncBlockEnreplacedy.getCachedState().getBlock().asItem().getTranslationKey()));
    replacedle.setColor(4210752);
    mainTab.addWidget(replacedle);
    Position invPos = Position.of(tabs, 7F + (tabs.getWidth() / 2 - ((9 * 18F) / 2) - 7F), 25F + 7F + (184 - 18 - 18 - (18 * 4) - 3 + getTabWidgetExtendedHeight()));
    TextWidget invreplacedle = new TextWidget();
    invreplacedle.setPosition(Position.of(invPos, 0, -10));
    invreplacedle.setText(getPlayer().inventory.getName());
    invreplacedle.setColor(4210752);
    mainTab.addWidget(invreplacedle);
    playerSlots = Slots.addPlayerInventory(invPos, Size.of(18F, 18F), mainTab, getPlayer().inventory);
    Direction rotation = Direction.NORTH;
    Block block = syncBlockEnreplacedy.getCachedState().getBlock();
    if (block instanceof HorizontalFacingBlockWithEnreplacedy) {
        DirectionProperty property = ((HorizontalFacingBlockWithEnreplacedy) block).getDirectionProperty();
        if (property != null)
            rotation = syncBlockEnreplacedy.getCachedState().get(property);
    }
    final Direction finalRotation = rotation;
    BlockEnreplacedyTransferComponent transferComponent = syncBlockEnreplacedy.getComponent(AstromineComponentTypes.BLOCK_ENreplacedY_TRANSFER_COMPONENT);
    transferComponent.get().forEach((type, entry) -> {
        if (syncBlockEnreplacedy.getComponent(type) instanceof NameableComponent) {
            NameableComponent nameableComponent = (NameableComponent) syncBlockEnreplacedy.getComponent(type);
            TabWidgetCollection current = (TabWidgetCollection) tabs.addTab(nameableComponent.getSymbol(), () -> Collections.singletonList(nameableComponent.getName()));
            WidgetUtilities.createTransferTab(current, Position.of(tabs, tabs.getWidth() / 2 - 38, getTabWidgetExtendedHeight() / 2), finalRotation, transferComponent, syncBlockEnreplacedy.getPos(), type);
            TextWidget invTabreplacedle = new TextWidget();
            invTabreplacedle.setPosition(Position.of(invPos, 0, -10));
            invTabreplacedle.setText(getPlayer().inventory.getName());
            invTabreplacedle.setColor(4210752);
            current.addWidget(invTabreplacedle);
            playerSlots.addAll(Slots.addPlayerInventory(invPos, Size.of(18F, 18F), current, getPlayer().inventory));
            TextWidget tabreplacedle = new TextWidget();
            tabreplacedle.setPosition(Position.of(mainTab, 8, 0));
            tabreplacedle.setText(nameableComponent.getName());
            tabreplacedle.setColor(4210752);
            current.addWidget(tabreplacedle);
        }
    });
}