use of net.minecraft.client.gui.GuiTextField in project BuildCraft by BuildCraft.
the class GuiArchitectTable method initGui.
@Override
public void initGui() {
super.initGui();
nameField = new GuiTextField(0, fontRenderer, guiLeft + 90, guiTop + 62, 156, 12);
nameField.setText(container.tile.name);
nameField.setFocused(true);
}
use of net.minecraft.client.gui.GuiTextField in project BuildCraft by BuildCraft.
the class GuiList method initGui.
@Override
public void initGui() {
super.initGui();
for (int line = 0; line < container.slots.length; line++) {
WidgetListSlot[] arr = container.slots[line];
for (int slot = 0; slot < arr.length; slot++) {
final WidgetListSlot listSlot = arr[slot];
GuiRectangle rectangle = new GuiRectangle(8 + slot * 18, 32 + line * 34, 16, 16);
IGuiArea phantomSlotArea = rectangle.offset(mainGui.rootElement);
mainGui.shownElements.add(listSlot.new GuiElementPhantomSlot(mainGui, phantomSlotArea) {
@Override
protected boolean shouldDrawHighlight() {
if (listSlot.slotIndex == 0) {
return true;
}
return !GuiList.this.container.lines[listSlot.lineIndex].isOneStackMode();
}
@Override
public void drawBackground(float partialTicks) {
if (!shouldDrawHighlight()) {
ICON_HIGHLIGHT.drawAt(this);
}
}
@Nonnull
@Override
public ItemStack getStack() {
if (shouldDrawHighlight()) {
return super.getStack();
} else {
NonNullList<ItemStack> data = GuiList.this.getExamplesList(listSlot.lineIndex, container.lines[listSlot.lineIndex].getSortingType());
if (data.size() >= listSlot.slotIndex) {
return data.get(listSlot.slotIndex - 1);
} else {
return StackUtil.EMPTY;
}
}
}
@Override
public void onMouseClicked(int button) {
super.onMouseClicked(button);
if (contains(gui.mouse)) {
clearExamplesCache(listSlot.lineIndex);
}
}
});
}
}
buttonList.clear();
for (int sy = 0; sy < ListHandler.HEIGHT; sy++) {
int bOff = sy * BUTTON_COUNT;
int bOffX = this.guiLeft + 8 + ListHandler.WIDTH * 18 - BUTTON_COUNT * 11;
int bOffY = this.guiTop + 32 + sy * 34 + 18;
GuiImageButton buttonPrecise = new GuiImageButton(mainGui, bOff + 0, bOffX, bOffY, 11, TEXTURE_BASE, 176, 16, 176, 28);
buttonPrecise.setToolTip(ToolTip.createLocalized("gui.list.nbt"));
buttonPrecise.setBehaviour(IButtonBehaviour.TOGGLE);
mainGui.shownElements.add(buttonPrecise);
GuiImageButton buttonType = new GuiImageButton(mainGui, bOff + 1, bOffX + 11, bOffY, 11, TEXTURE_BASE, 176, 16, 185, 28);
buttonType.setToolTip(ToolTip.createLocalized("gui.list.metadata"));
buttonType.setBehaviour(IButtonBehaviour.TOGGLE);
mainGui.shownElements.add(buttonType);
GuiImageButton buttonMaterial = new GuiImageButton(mainGui, bOff + 2, bOffX + 22, bOffY, 11, TEXTURE_BASE, 176, 16, 194, 28);
buttonMaterial.setToolTip(ToolTip.createLocalized("gui.list.oredict"));
buttonMaterial.setBehaviour(IButtonBehaviour.TOGGLE);
mainGui.shownElements.add(buttonMaterial);
}
for (IGuiElement elem : mainGui.shownElements) {
if (elem instanceof GuiImageButton) {
GuiImageButton b = (GuiImageButton) elem;
int id = Integer.parseInt(b.id);
int lineId = id / BUTTON_COUNT;
int buttonId = id % BUTTON_COUNT;
if (container.lines[lineId].getOption(buttonId)) {
b.activate();
}
b.registerListener(this);
}
}
textField = new GuiTextField(6, this.fontRenderer, guiLeft + 10, guiTop + 10, 156, 12);
textField.setMaxStringLength(32);
textField.setText(BCCoreItems.list.getName(container.getListItemStack()));
textField.setFocused(false);
}
use of net.minecraft.client.gui.GuiTextField in project BuildCraft by BuildCraft.
the class GuiZonePlan method initGui.
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
tool = new GuiBetterButton(0, guiLeft + 27, guiTop + 111, 15, StandardButtonTextureSets.SMALL_BUTTON, "+");
tool.setToolTip(new ToolTip(new ToolTipLine(LocaleUtil.localize("tip.tool.add"))));
buttonList.add(tool);
fsButton = new GuiBetterButton(1, guiLeft + 44, guiTop + 111, 20, StandardButtonTextureSets.SMALL_BUTTON, "FS");
fsButton.setToolTip(new ToolTip(new ToolTipLine(LocaleUtil.localize("tip.tool.fullscreen"))));
buttonList.add(fsButton);
savedButtonList = buttonList;
textField = new GuiTextField(1, this.fontRendererObj, 28, 129, 156, 12);
textField.setMaxStringLength(DefaultProps.MAX_NAME_SIZE);
textField.setText(zonePlan.mapName);
textField.setFocused(true);
}
use of net.minecraft.client.gui.GuiTextField in project Cavern2 by kegare.
the class GuiBiomesEditor method updateScreen.
@Override
public void updateScreen() {
if (editMode) {
for (GuiTextField textField : editFieldList) {
textField.updateCursorCounter();
}
} else {
editButton.enabled = !biomeList.selected.isEmpty();
removeButton.enabled = editButton.enabled;
filterTextField.updateCursorCounter();
}
}
use of net.minecraft.client.gui.GuiTextField in project Cavern2 by kegare.
the class GuiBiomesEditor method initGui.
@Override
public void initGui() {
if (biomeList == null) {
biomeList = new BiomeList();
refreshBiomes(manager.getCaveBiomes().values());
}
biomeList.setDimensions(width, height, 32, height - (editMode ? 95 : 28));
if (doneButton == null) {
doneButton = new GuiButtonExt(0, 0, 0, 65, 20, I18n.format("gui.done"));
}
doneButton.x = width / 2 + 135;
doneButton.y = height - doneButton.height - 4;
if (editButton == null) {
editButton = new GuiButtonExt(1, 0, 0, doneButton.width, doneButton.height, I18n.format("gui.edit"));
editButton.enabled = false;
}
editButton.x = doneButton.x - doneButton.width - 3;
editButton.y = doneButton.y;
editButton.enabled = biomeList.selected != null;
editButton.visible = !editMode;
if (cancelButton == null) {
cancelButton = new GuiButtonExt(2, 0, 0, editButton.width, editButton.height, I18n.format("gui.cancel"));
}
cancelButton.x = editButton.x;
cancelButton.y = editButton.y;
cancelButton.visible = editMode;
if (removeButton == null) {
removeButton = new GuiButtonExt(4, 0, 0, doneButton.width, doneButton.height, I18n.format("gui.remove"));
}
removeButton.x = editButton.x - editButton.width - 3;
removeButton.y = doneButton.y;
removeButton.visible = !editMode;
if (addButton == null) {
addButton = new GuiButtonExt(3, 0, 0, doneButton.width, doneButton.height, I18n.format("gui.add"));
}
addButton.x = removeButton.x - removeButton.width - 3;
addButton.y = doneButton.y;
addButton.visible = !editMode;
if (clearButton == null) {
clearButton = new GuiButtonExt(5, 0, 0, removeButton.width, removeButton.height, I18n.format("gui.clear"));
}
clearButton.x = removeButton.x;
clearButton.y = removeButton.y;
clearButton.visible = false;
if (detailInfo == null) {
detailInfo = new GuiCheckBox(6, 0, 5, I18n.format(Config.LANG_KEY + "detail"), true);
}
detailInfo.setIsChecked(CaveConfigGui.detailInfo);
detailInfo.x = width / 2 + 95;
if (instantFilter == null) {
instantFilter = new GuiCheckBox(7, 0, detailInfo.y + detailInfo.height + 2, I18n.format(Config.LANG_KEY + "instant"), true);
}
instantFilter.setIsChecked(CaveConfigGui.instantFilter);
instantFilter.x = detailInfo.x;
buttonList.clear();
buttonList.add(doneButton);
if (editMode) {
buttonList.add(cancelButton);
} else {
buttonList.add(editButton);
buttonList.add(addButton);
buttonList.add(removeButton);
buttonList.add(clearButton);
}
buttonList.add(detailInfo);
buttonList.add(instantFilter);
if (filterTextField == null) {
filterTextField = new GuiTextField(0, fontRenderer, 0, 0, 122, 16);
filterTextField.setMaxStringLength(500);
}
filterTextField.x = width / 2 - 200;
filterTextField.y = height - filterTextField.height - 6;
detailHoverChecker = new HoverChecker(detailInfo, 800);
instantHoverChecker = new HoverChecker(instantFilter, 800);
editLabelList.clear();
editLabelList.add(I18n.format(Config.LANG_KEY + "biomes.weight"));
editLabelList.add(I18n.format(Config.LANG_KEY + "biomes.terrainBlock"));
editLabelList.add("");
editLabelList.add(I18n.format(Config.LANG_KEY + "biomes.topBlock"));
editLabelList.add("");
for (String key : editLabelList) {
maxLabelWidth = Math.max(maxLabelWidth, fontRenderer.getStringWidth(key));
}
if (weightField == null) {
weightField = new GuiTextField(1, fontRenderer, 0, 0, 0, 15);
weightField.setMaxStringLength(3);
}
int i = maxLabelWidth + 8 + width / 2;
weightField.x = width / 2 - i / 2 + maxLabelWidth + 10;
weightField.y = biomeList.bottom + 7;
weightField.width = width / 2 + i / 2 - 45 - weightField.x + 40;
if (terrainBlockField == null) {
terrainBlockField = new GuiTextField(2, fontRenderer, 0, 0, 0, weightField.height);
terrainBlockField.setMaxStringLength(100);
}
terrainBlockField.x = weightField.x;
terrainBlockField.y = weightField.y + weightField.height + 5;
terrainBlockField.width = weightField.width / 4 + weightField.width / 2 - 1;
if (terrainBlockMetaField == null) {
terrainBlockMetaField = new GuiTextField(3, fontRenderer, 0, 0, 0, terrainBlockField.height);
terrainBlockMetaField.setMaxStringLength(100);
}
terrainBlockMetaField.x = terrainBlockField.x + terrainBlockField.width + 3;
terrainBlockMetaField.y = terrainBlockField.y;
terrainBlockMetaField.width = weightField.width / 4 - 1;
if (topBlockField == null) {
topBlockField = new GuiTextField(4, fontRenderer, 0, 0, 0, terrainBlockField.height);
topBlockField.setMaxStringLength(100);
}
topBlockField.x = terrainBlockField.x;
topBlockField.y = terrainBlockMetaField.y + terrainBlockMetaField.height + 5;
topBlockField.width = terrainBlockField.width;
if (topBlockMetaField == null) {
topBlockMetaField = new GuiTextField(5, fontRenderer, 0, 0, 0, topBlockField.height);
topBlockMetaField.setMaxStringLength(100);
}
topBlockMetaField.x = terrainBlockMetaField.x;
topBlockMetaField.y = topBlockField.y;
topBlockMetaField.width = terrainBlockMetaField.width;
editFieldList.clear();
if (editMode) {
editFieldList.add(weightField);
editFieldList.add(terrainBlockField);
editFieldList.add(terrainBlockMetaField);
editFieldList.add(topBlockField);
editFieldList.add(topBlockMetaField);
}
weightHoverChecker = new HoverChecker(weightField.y - 1, weightField.y + weightField.height, weightField.x - maxLabelWidth - 12, weightField.x - 10, 800);
terrainBlockHoverChecker = new HoverChecker(terrainBlockField.y - 1, terrainBlockField.y + terrainBlockField.height, terrainBlockField.x - maxLabelWidth - 12, terrainBlockField.x - 10, 800);
topBlockHoverChecker = new HoverChecker(topBlockField.y - 1, topBlockField.y + topBlockField.height, topBlockField.x - maxLabelWidth - 12, topBlockField.x - 10, 800);
}
Aggregations