This post is a work in progress, and will be updated as I continue to develop the MCBasic language.
Introduction
MCBasic is a programming language designed specifically for creating Minecraft datapacks. It aims to provide a more structured and user-friendly way to write Minecraft commands, making it easier for players to create complex datapacks without needing to master the intricacies of Minecraft’s command syntax.
Features
- Structured Syntax: MCBasic uses a structured syntax that is easier to read and write compared to raw Minecraft commands.
- Variables and Functions: MCBasic supports variables and functions, allowing for more modular and reusable code.
- Control Structures: MCBasic includes control structures like loops and conditionals, enabling more complex logic in datapacks.
- Built-in Functions: MCBasic provides a standard library of functions that will be extended over time, making it easier to perform common tasks without needing to write everything from scratch.
- Error Handling: MCBasic includes error handling features to help developers catch and fix issues in their code. Runtime errors are sent to the chat for players with the
mcblog
tag when functions fail to execute. - Compatibility: MCBasic is designed to be compatible with version 1.21.5, but support for cross-version compatibility is planned for future releases.
- IDE Support: MCBasic can be used with any text editor, but official support is only available for IntelliJ IDEA-based IDEs. You can use the MCBasic plugin for IntelliJ IDEA
Getting Started
To get started with MCBasic, you will need to install the MCBasic compiler and set up your development environment. The compiler will convert MCBasic code into fully functional Minecraft datapacks that can be loaded into your Minecraft world.
Example Code
Here is a simple example of MCBasic code that creates a function to give a player a diamond sword:
|
|
This code defines a function giveItem
that takes a player name, an item name, and a count as parameters. It then executes a Minecraft command to give the specified item to the player. The load
function calls giveItem
to give “Player1” a diamond sword.
Future Plans
- Standard Library: The standard library will be expanded to include more built-in functions for common tasks, such as manipulating player data, managing inventories, and handling events.
- Cross-Version Compatibility: Future versions of MCBasic will aim to support multiple Minecraft versions, allowing developers to write code that works across different game updates. How long this will take depends on how many breaking changes Mojang introduces in future updates. Lowest possible version will be at least 1.20.2 since MCBasic relies heavily on function macros, which were introduced in 1.20.2.
- Community Contributions: MCBasic will be open for community contributions, allowing developers to submit their own functions and improvements to the language.
- Documentation and Tutorials: Comprehensive documentation and tutorials will be provided to help new users get started with MCBasic and understand its features.
Conclusion
MCBasic is an exciting new language for Minecraft datapacks that aims to simplify the process of creating complex commands and logic. With its structured syntax, built-in functions, and error handling features, MCBasic provides a powerful tool for Minecraft developers. As the language continues to evolve, it will become an even more valuable resource for the Minecraft community.
How to Contribute
If you’re interested in contributing to the MCBasic project, you can find the source code on GitHub. Contributions are welcome, whether it’s adding new features, improving documentation, or fixing bugs. Please follow the contribution guidelines in the repository to get started.
Feedback and Support
We welcome feedback and support from the community. If you have any questions, suggestions, or issues with MCBasic, please open an issue on the GitHub repository or join the discussion in the community forums. Your input will help shape the future of MCBasic and make it a better tool for Minecraft developers.
License
MCBasic is released under the GNU General Public License v3.0 . This means you can use, modify, and distribute the code freely, as long as you include the original license in your copies or substantial portions of the software.