-
Notifications
You must be signed in to change notification settings - Fork 0
New Features
Expanding mDirt with new Minecraft feature types (like Biomes, Advancements, etc.) lets you grow the appβs capabilities and support more kinds of content.
This guide walks you through the process of adding a new element type to mDirt.
Adding a new element type involves:
- Building the GUI
- Adding application logic
- Creating the generator
- Open lib/ui.ui in Qt Designer.
- Add a new page to the QStackedWidget named
elementEditor
.
Note the page number β you'll use it in code. - In the menu bar, add a new Action under "New Element" titled {Element}.
- Add all necessary input widgets for the element. Name them clearly (e.g. elementNameInput, elementColorPicker, etc.)
- Save the UI file.
- In Qt Designer, go to: Form > View Python Code > Save
- Save to src/ui/ui.py
- Overwrite when prompted
In src/utils/enums.py, under ElementPage
, add your new element.
In src/main.py, define the following methods for your element:
new{Element}
add{Element}
edit{Element}
validate{Element}Details
These can be modeled after how other elements are handled.
In App.__init__
:
- Connect the new menu action using
.triggered.connect(self.new{Element})
- Connect any buttons or signals
- Add Drop Handlers if needed
In App.setupProjectData
:
- Add a new dictionary for your element:
self.{element} = {}
- Add a corresponding
QTreeWidgetItem
to the tree
In App.saveProjectAs
:
- Add:
with open(projectDirectory / '{element}.json', 'w') as file:
json.dump(self.{element}, file, indent=4)
- Also add:
os.makedirs(projectDirectory / '{element}', exist_ok=True)
In App.loadProject
:
- Load the file:
with open(projectDirectory / '{element}.json') as file:
self.{element} = json.load(file)
- Populate the tree:
for item in self.{element}:
# Create QTreeWidgetItem and add to tree
In App.elementClicked
, add a block for your new element
In App.generate
, pass self.{element}
into the generator
π§ This page is incomplete! π§
Made with β€οΈ by Faith & Code Technologies
Need help? Open an issue or visit the FAQs page.
Want to contribute? Check out Contributing
Β© 2025 mDirt β All rights reserved.