import { faMinus, faPlus } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { useState } from 'react'; import { Accordion, Button, ButtonGroup, Card, Form, } from 'react-bootstrap'; import ExtendableInput from '../modules/Config/ExtendableInput'; export default ({ mc114, idx, onEntryCreation, onEntryDeletion, onConfigChange, }) => { const [state, setState] = useState({ block: '', maxY: 1, minY: 0, chance: 0, size: 1, dimBlacklist: [], }); const setStateWithPropogation = (newState) => { setState(newState); onConfigChange(idx, newState); }; return ( Config Entry {idx !== 0 && ( )}
Stone Block setStateWithPropogation({ ...state, block: evt.target.value })} type="text" /> Maximum Y-Level { const maxY = (state.maxY < state.minY) ? state.minY + 1 : parseInt(evt.target.value, 10); setStateWithPropogation({ ...state, maxY }); }} /> Minimum Y-Level { const minY = (state.minY > state.maxY) ? state.maxY - 1 : parseInt(evt.target.value, 10); setStateWithPropogation({ ...state, minY }); }} /> Chance ( Relative To All Chances {' '} ) setStateWithPropogation( { ...state, chance: parseInt(evt.target.value, 10) }, )} /> Size setStateWithPropogation( { ...state, size: parseInt(evt.target.value, 10) }, )} /> Dimension Blacklist ' : 'Any Dimension ID (e.g. -1, 1)'} onChangeSuper={(dimBlacklist) => setStateWithPropogation( { ...state, dimBlacklist }, )} />
); };