@Override public void setupElements() { typeLabel.setText( StatCollector.translateToLocal("guistrings.validation_type") + ": " + parent.validationType.getName()); int totalHeight = 0; area.clearElements(); for (Button b : typeButtons) { area.addGuiElement(b); } totalHeight += 16 * 3 + 4 + 8; // type buttons height+buffer Label label = null; String propName; Checkbox box; NumberInput input; for (StructureValidationProperty property : parent.validator.getProperties()) { propName = property.getRegName(); if (propName.equals(StructureValidator.PROP_BIOME_LIST) || propName.equals(StructureValidator.PROP_BIOME_WHITE_LIST) || propName.equals(StructureValidator.PROP_DIMENSION_LIST) || propName.equals(StructureValidator.PROP_DIMENSION_WHITE_LIST) || propName.equals(StructureValidator.PROP_BLOCK_LIST)) { continue; // skip the properties handled by blocks, biome, or dimensions setup guis } label = new Label( 8, totalHeight, StatCollector.translateToLocal("structure.validation." + property.getRegName())); area.addGuiElement(label); switch (property.getDataType()) { case StructureValidationProperty.DATA_TYPE_INT: { input = new PropertyNumberInputInteger(200, totalHeight - 1, 32, property, this); area.addGuiElement(input); } break; case StructureValidationProperty.DATA_TYPE_BOOLEAN: { box = new PropertyCheckbox(200, totalHeight - 3, 16, 16, property); area.addGuiElement(box); } break; } totalHeight += 16; } area.setAreaSize(totalHeight); }
public PropertyNumberInputInteger( int topLeftX, int topLeftY, int width, StructureValidationProperty property, IWidgetSelection selector) { super(topLeftX, topLeftY, width, property.getDataInt(), selector); this.prop = property; this.setIntegerValue(); }
@Override public void onValueUpdated(float value) { int val = (int) value; prop.setValue(Integer.valueOf(val)); }
@Override public void onToggled() { prop.setValue(Boolean.valueOf(checked())); }
public PropertyCheckbox( int topLeftX, int topLeftY, int width, int height, StructureValidationProperty property) { super(topLeftX, topLeftY, width, height, ""); this.prop = property; setChecked(prop.getDataBoolean()); }