Adrodoc / MPL

A language to generate command blocks for Minecraft 1.9 and higher
GNU General Public License v3.0
18 stars 5 forks source link

MCFunction Format Ideas #71

Open JusticePro opened 6 years ago

JusticePro commented 6 years ago
namespace "example"

install {
    /say Installed Example
}

uninstall {
    /say Uninstalled Example
    /say The functions still exist in the file. You'd have to delete those if you wanted the functions gone.
}

repeat process lol {
    /say hi
}

namespace is the folder the functions are in. This is required for functions.

It would export as a zip. It'll always have Install.mcfunction, Uninstall.mcfunction, Core.mcfunction Each process will be it's own function.

Core.mcfunction will look like this, All repeating functions are here.

/function example/lol
Adrodoc commented 6 years ago

I think the language should make a distinction between processes and functions, because there a several things you can do in a process (in cmd blocks) that you can't do in functions. For instance cmd block modifier impulse/repeat, waiting for a process or event. On the other hand you can do things in functions that are extremely inefficient and hard to do with cmd blocks. This comes down to the fact that a function can be executed by an entity and use @s. If you want to efficiently support constructs like if-then-else you need more than one function file per MPL function, I'm not sure if that is what you meant with all repeating functions are in that folder. Considering the namespace: I really like the idea to force the declaration of something like a package in Java, I would even call it package and not namespace, but namespace is fine too. The declared namespace would however not be the namespace of the mcfunction, because you need several mcfunction files for one mpl function and it makes sense to put them in the same Mc namespace. My POC also had an install.mcfunction and an uninstall.mcfunction that you can see here: https://github.com/Adrodoc/MPL/tree/fix/%2367/compiler/src/main/resources/mpl/lang/function Here are the relevant classes of my POC: https://github.com/Adrodoc/MPL/tree/fix/%2367/compiler/src/main/java/de/adrodoc55/minecraft/mpl/materialize/function

JusticePro notifications@github.com schrieb am Fr., 1. Juni 2018, 14:07:

namespace "example"

install { /say Installed Example }

uninstall { /say Uninstalled Example /say The functions still exist in the file. You'd have to delete those if you wanted the functions gone. }

repeat process lol { /say hi }

namespace is the folder the functions are in. This is required for functions.

It would export as a zip. It'll always have Install.mcfunction, Uninstall.mcfunction, Core.mcfunction Each process will be it's own function.

Core.mcfunction will look like this, All repeating functions are here.

/function example/lol

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Adrodoc/MPL/issues/71, or mute the thread https://github.com/notifications/unsubscribe-auth/AOcaHXHUOyoxUZLLCUg6vOgpNRsWv7Nuks5t4S5kgaJpZM4UWl9V .

Adrodoc commented 6 years ago

Relates to #67