use of net.minecraftforge.fml.client.config.GuiCheckBox in project Cavern2 by kegare.
the class GuiSelectOreDict method initGui.
@Override
public void initGui() {
if (oreDictList == null) {
oreDictList = new OreDictList();
}
oreDictList.setDimensions(width, height, 32, height - 28);
boolean hasSwitch = switchEntry != null;
int buttonWidth = hasSwitch ? 70 : 145;
if (doneButton == null) {
doneButton = new GuiButtonExt(0, 0, 0, buttonWidth, 20, I18n.format("gui.done"));
}
doneButton.x = width / 2 + 10;
doneButton.y = height - doneButton.height - 4;
if (switchButton == null) {
switchButton = new GuiButtonExt(3, 0, 0, buttonWidth, 20, hasSwitch ? switchEntry.getTranslatedName() : "");
switchButton.visible = hasSwitch;
}
switchButton.x = doneButton.x;
switchButton.y = doneButton.y;
if (hasSwitch) {
doneButton.x += buttonWidth + 3;
}
if (detailInfo == null) {
detailInfo = new GuiCheckBox(1, 0, 5, I18n.format(Config.LANG_KEY + "detail"), true);
}
detailInfo.setIsChecked(CaveConfigGui.detailInfo);
detailInfo.x = width / 2 + 95;
if (instantFilter == null) {
instantFilter = new GuiCheckBox(2, 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);
buttonList.add(switchButton);
buttonList.add(detailInfo);
buttonList.add(instantFilter);
if (filterTextField == null) {
filterTextField = new GuiTextField(0, fontRenderer, 0, 0, 150, 16);
filterTextField.setMaxStringLength(100);
}
filterTextField.x = width / 2 - filterTextField.width - 5;
filterTextField.y = height - filterTextField.height - 6;
selectedHoverChecker = new HoverChecker(0, 20, 0, 100, 800);
detailHoverChecker = new HoverChecker(detailInfo, 800);
instantHoverChecker = new HoverChecker(instantFilter, 800);
if (switchEntry != null && mc.currentScreen == this) {
switchEntry.getGuiScreen().setWorldAndResolution(mc, width, height);
}
}
use of net.minecraftforge.fml.client.config.GuiCheckBox in project Cavern2 by kegare.
the class GuiVeinsEditor method initGui.
@Override
public void initGui() {
if (veinList == null) {
veinList = new VeinList();
refreshVeins(manager.getCaveVeins());
}
veinList.setDimensions(width, height, 32, height - (editMode ? 170 : 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 = veinList.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 + "veins.block"));
editLabelList.add("");
editLabelList.add(I18n.format(Config.LANG_KEY + "veins.targetBlock"));
editLabelList.add("");
editLabelList.add(I18n.format(Config.LANG_KEY + "veins.weight"));
editLabelList.add(I18n.format(Config.LANG_KEY + "veins.chance"));
editLabelList.add(I18n.format(Config.LANG_KEY + "veins.size"));
editLabelList.add(I18n.format(Config.LANG_KEY + "veins.height"));
editLabelList.add("");
editLabelList.add(I18n.format(Config.LANG_KEY + "veins.biomes"));
for (String key : editLabelList) {
maxLabelWidth = Math.max(maxLabelWidth, fontRenderer.getStringWidth(key));
}
if (blockField == null) {
blockField = new GuiTextField(1, fontRenderer, 0, 0, 0, 15);
blockField.setMaxStringLength(100);
}
int i = maxLabelWidth + 8 + width / 2;
blockField.x = width / 2 - i / 2 + maxLabelWidth + 10;
blockField.y = veinList.bottom + 5;
int fieldWidth = width / 2 + i / 2 - 45 - blockField.x + 40;
blockField.width = fieldWidth / 4 + fieldWidth / 2 - 1;
if (blockMetaField == null) {
blockMetaField = new GuiTextField(2, fontRenderer, 0, 0, 0, blockField.height);
blockMetaField.setMaxStringLength(100);
}
blockMetaField.x = blockField.x + blockField.width + 3;
blockMetaField.y = blockField.y;
blockMetaField.width = fieldWidth / 4 - 1;
if (targetField == null) {
targetField = new GuiTextField(3, fontRenderer, 0, 0, 0, blockField.height);
targetField.setMaxStringLength(100);
}
targetField.x = blockField.x;
targetField.y = blockField.y + blockField.height + 5;
targetField.width = blockField.width;
if (targetMetaField == null) {
targetMetaField = new GuiTextField(4, fontRenderer, 0, 0, 0, blockField.height);
targetMetaField.setMaxStringLength(100);
}
targetMetaField.x = targetField.x + targetField.width + 3;
targetMetaField.y = targetField.y;
targetMetaField.width = blockMetaField.width;
if (weightField == null) {
weightField = new GuiTextField(5, fontRenderer, 0, 0, 0, blockField.height);
weightField.setMaxStringLength(3);
}
weightField.x = targetField.x;
weightField.y = targetField.y + targetField.height + 5;
weightField.width = fieldWidth;
if (chanceField == null) {
chanceField = new GuiTextField(6, fontRenderer, 0, 0, 0, blockField.height);
chanceField.setMaxStringLength(3);
}
chanceField.x = weightField.x;
chanceField.y = weightField.y + weightField.height + 5;
chanceField.width = weightField.width;
if (sizeField == null) {
sizeField = new GuiTextField(7, fontRenderer, 0, 0, 0, blockField.height);
sizeField.setMaxStringLength(3);
}
sizeField.x = chanceField.x;
sizeField.y = chanceField.y + chanceField.height + 5;
sizeField.width = chanceField.width;
if (minHeightField == null) {
minHeightField = new GuiTextField(8, fontRenderer, 0, 0, 0, blockField.height);
minHeightField.setMaxStringLength(3);
}
minHeightField.x = sizeField.x;
minHeightField.y = sizeField.y + sizeField.height + 5;
minHeightField.width = fieldWidth / 2 - 1;
if (maxHeightField == null) {
maxHeightField = new GuiTextField(9, fontRenderer, 0, 0, 0, blockField.height);
maxHeightField.setMaxStringLength(3);
}
maxHeightField.x = minHeightField.x + minHeightField.width + 3;
maxHeightField.y = minHeightField.y;
maxHeightField.width = minHeightField.width;
if (biomesField == null) {
biomesField = new GuiTextField(10, fontRenderer, 0, 0, 0, blockField.height);
biomesField.setMaxStringLength(800);
}
biomesField.x = minHeightField.x;
biomesField.y = minHeightField.y + minHeightField.height + 5;
biomesField.width = sizeField.width;
editFieldList.clear();
if (editMode) {
editFieldList.add(blockField);
editFieldList.add(blockMetaField);
editFieldList.add(targetField);
editFieldList.add(targetMetaField);
editFieldList.add(weightField);
editFieldList.add(chanceField);
editFieldList.add(sizeField);
editFieldList.add(minHeightField);
editFieldList.add(maxHeightField);
editFieldList.add(biomesField);
}
blockHoverChecker = new HoverChecker(blockField.y - 1, blockField.y + blockField.height, blockField.x - maxLabelWidth - 12, blockField.x - 10, 800);
targetHoverChecker = new HoverChecker(targetField.y - 1, targetField.y + targetField.height, targetField.x - maxLabelWidth - 12, targetField.x - 10, 800);
weightHoverChecker = new HoverChecker(weightField.y - 1, weightField.y + weightField.height, weightField.x - maxLabelWidth - 12, weightField.x - 10, 800);
chanceHoverChecker = new HoverChecker(chanceField.y - 1, chanceField.y + chanceField.height, chanceField.x - maxLabelWidth - 12, chanceField.x - 10, 800);
sizeHoverChecker = new HoverChecker(sizeField.y - 1, sizeField.y + sizeField.height, sizeField.x - maxLabelWidth - 12, sizeField.x - 10, 800);
heightHoverChecker = new HoverChecker(minHeightField.y - 1, minHeightField.y + minHeightField.height, minHeightField.x - maxLabelWidth - 12, minHeightField.x - 10, 800);
biomesHoverChecker = new HoverChecker(biomesField.y - 1, biomesField.y + biomesField.height, biomesField.x - maxLabelWidth - 12, biomesField.x - 10, 800);
}
use of net.minecraftforge.fml.client.config.GuiCheckBox in project Cavern2 by kegare.
the class GuiMiningPointsEditor method initGui.
@Override
public void initGui() {
if (pointList == null) {
pointList = new PointList();
}
pointList.setDimensions(width, height, 32, height - (editMode ? 52 : 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 = pointList.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 + "points.point"));
for (String key : editLabelList) {
maxLabelWidth = Math.max(maxLabelWidth, fontRenderer.getStringWidth(key));
}
if (pointField == null) {
pointField = new GuiTextField(5, fontRenderer, 0, 0, 0, 15);
pointField.setMaxStringLength(5);
}
int i = maxLabelWidth + 8 + width / 2;
pointField.x = width / 2 - i / 2 + maxLabelWidth + 10;
pointField.y = pointList.bottom + 7;
int fieldWidth = width / 2 + i / 2 - 45 - pointField.x + 40;
pointField.width = fieldWidth / 4 + fieldWidth / 2 - 1;
editFieldList.clear();
if (editMode) {
editFieldList.add(pointField);
}
pointHoverChecker = new HoverChecker(pointField.y - 1, pointField.y + pointField.height, pointField.x - maxLabelWidth - 12, pointField.x - 10, 800);
}
use of net.minecraftforge.fml.client.config.GuiCheckBox in project Waystones by blay09.
the class GuiEditWaystone method initGui.
@Override
public void initGui() {
super.initGui();
String oldText = tileWaystone.getWaystoneName();
if (textField != null) {
oldText = textField.getText();
}
textField = new GuiTextField(2, fontRenderer, width / 2 - 100, height / 2 - 20, 200, 20);
textField.setMaxStringLength(128);
textField.setText(oldText);
textField.setFocused(true);
btnDone = new GuiButton(0, width / 2, height / 2 + 10, 100, 20, I18n.format("gui.done"));
buttonList.add(btnDone);
chkGlobal = new GuiCheckBox(1, width / 2 - 100, height / 2 + 15, " " + I18n.format("gui.waystones:editWaystone.isGlobal"), tileWaystone.isGlobal());
if (!WaystoneConfig.general.allowEveryoneGlobal && (!Minecraft.getMinecraft().player.capabilities.isCreativeMode)) {
chkGlobal.visible = false;
}
buttonList.add(chkGlobal);
Keyboard.enableRepeatEvents(true);
}
use of net.minecraftforge.fml.client.config.GuiCheckBox 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