use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.
the class BlueprintScreen method init.
@Override
protected void init() {
setWindowSize(background.width, background.height + 4 + PLAYER_INVENTORY.height);
setWindowOffset(1, 0);
super.init();
int x = leftPos;
int y = topPos;
resetButton = new IconButton(x + background.width - 62, y + background.height - 24, AllIcons.I_TRASH);
resetButton.withCallback(() -> {
menu.clearContents();
contentsCleared();
menu.sendClearPacket();
});
confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
confirmButton.withCallback(() -> {
minecraft.player.closeContainer();
});
addRenderableWidget(resetButton);
addRenderableWidget(confirmButton);
extraAreas = ImmutableList.of(new Rect2i(x + background.width, y + background.height - 36, 56, 44));
}
use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.
the class LinkedControllerScreen method init.
@Override
protected void init() {
setWindowSize(background.width, background.height + 4 + PLAYER_INVENTORY.height);
setWindowOffset(1, 0);
super.init();
int x = leftPos;
int y = topPos;
resetButton = new IconButton(x + background.width - 62, y + background.height - 24, AllIcons.I_TRASH);
resetButton.withCallback(() -> {
menu.clearContents();
menu.sendClearPacket();
});
confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
confirmButton.withCallback(() -> {
minecraft.player.closeContainer();
});
addRenderableWidget(resetButton);
addRenderableWidget(confirmButton);
extraAreas = ImmutableList.of(new Rect2i(x + background.width + 4, y + background.height - 44, 64, 56));
}
use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.
the class AbstractFilterScreen method init.
@Override
protected void init() {
setWindowSize(Math.max(background.width, PLAYER_INVENTORY.width), background.height + 4 + PLAYER_INVENTORY.height);
super.init();
int x = leftPos;
int y = topPos;
resetButton = new IconButton(x + background.width - 62, y + background.height - 24, AllIcons.I_TRASH);
resetButton.withCallback(() -> {
menu.clearContents();
contentsCleared();
menu.sendClearPacket();
});
confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
confirmButton.withCallback(() -> {
minecraft.player.closeContainer();
});
addRenderableWidget(resetButton);
addRenderableWidget(confirmButton);
extraAreas = ImmutableList.of(new Rect2i(x + background.width, y + background.height - 40, 80, 48));
}
use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.
the class ToolboxScreen method init.
@Override
protected void init() {
setWindowSize(30 + BG.width, BG.height + PLAYER.height - 24);
setWindowOffset(-11, 0);
super.init();
color = menu.contentHolder.getColor();
confirmButton = new IconButton(leftPos + 30 + BG.width - 33, topPos + BG.height - 24, AllIcons.I_CONFIRM);
confirmButton.withCallback(() -> {
minecraft.player.closeContainer();
});
addRenderableWidget(confirmButton);
disposeButton = new IconButton(leftPos + 30 + 81, topPos + 69, AllIcons.I_TOOLBOX);
disposeButton.withCallback(() -> {
AllPackets.channel.sendToServer(new ToolboxDisposeAllPacket(menu.contentHolder.getBlockPos()));
});
disposeButton.setToolTip(Lang.translate("toolbox.depositBox"));
addRenderableWidget(disposeButton);
extraAreas = ImmutableList.of(new Rect2i(leftPos + 30 + BG.width, topPos + BG.height - 15 - 34 - 6, 72, 68));
}
use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.
the class SchematicTableScreen method init.
@Override
protected void init() {
setWindowSize(background.width, background.height + 4 + AllGuiTextures.PLAYER_INVENTORY.height);
setWindowOffset(-11, 8);
super.init();
CreateClient.SCHEMATIC_SENDER.refresh();
List<Component> availableSchematics = CreateClient.SCHEMATIC_SENDER.getAvailableSchematics();
int x = leftPos;
int y = topPos;
schematicsLabel = new Label(x + 49, y + 26, TextComponent.EMPTY).withShadow();
schematicsLabel.text = TextComponent.EMPTY;
if (!availableSchematics.isEmpty()) {
schematicsArea = new SelectionScrollInput(x + 45, y + 21, 139, 18).forOptions(availableSchematics).titled(availableSchematicsTitle.plainCopy()).writingTo(schematicsLabel);
addRenderableWidget(schematicsArea);
addRenderableWidget(schematicsLabel);
}
confirmButton = new IconButton(x + 44, y + 56, AllIcons.I_CONFIRM);
confirmButton.withCallback(() -> {
if (menu.canWrite() && schematicsArea != null) {
ClientSchematicLoader schematicSender = CreateClient.SCHEMATIC_SENDER;
lastChasingProgress = chasingProgress = progress = 0;
List<Component> availableSchematics1 = schematicSender.getAvailableSchematics();
Component schematic = availableSchematics1.get(schematicsArea.getState());
schematicSender.startNewUpload(schematic.getContents());
}
});
folderButton = new IconButton(x + 21, y + 21, AllIcons.I_OPEN_FOLDER);
folderButton.withCallback(() -> {
Util.getPlatform().openFile(Paths.get("schematics/").toFile());
});
folderButton.setToolTip(folder);
refreshButton = new IconButton(x + 207, y + 21, AllIcons.I_REFRESH);
refreshButton.withCallback(() -> {
ClientSchematicLoader schematicSender = CreateClient.SCHEMATIC_SENDER;
schematicSender.refresh();
List<Component> availableSchematics1 = schematicSender.getAvailableSchematics();
removeWidget(schematicsArea);
if (!availableSchematics1.isEmpty()) {
schematicsArea = new SelectionScrollInput(leftPos + 45, topPos + 21, 139, 18).forOptions(availableSchematics1).titled(availableSchematicsTitle.plainCopy()).writingTo(schematicsLabel);
schematicsArea.onChanged();
addRenderableWidget(schematicsArea);
} else {
schematicsArea = null;
schematicsLabel.text = TextComponent.EMPTY;
}
});
refreshButton.setToolTip(refresh);
addRenderableWidget(confirmButton);
addRenderableWidget(folderButton);
addRenderableWidget(refreshButton);
extraAreas = ImmutableList.of(new Rect2i(x + background.width, y + background.height - 40, 48, 48), new Rect2i(refreshButton.x, refreshButton.y, refreshButton.getWidth(), refreshButton.getHeight()));
}
Aggregations