Project MMO

Project MMO

Scripting

This feature allows you to define .pmmo files in your config folder that are read when your world loads and provide configurations that supersede datapacks. This powerful feature simplifies the configuration process.

Basic Syntax

.pmmo files use a "chaining" style where each line is a configuration that "chains" together nodes of information

A node is simply keyword(data). The keyword defines what happens behind the scenes, and the data is the specific information it needs to know what you want to do.

Nodes are connected with a period (.). By connecting nodes with a period, you "chain" them together. Let's look at an example:

color(yellow).type(ball).sport(tennis);

Note: the semicolon (;) at the end is important and will be explained later

PMMO Basic Nodes

PMMO has 3 basic types of nodes, target nodes, value nodes, and feature nodes. All configurations must have a target node. feature nodes are what actually do the work, so you will always have one, or else you line doesn't do anything. The value node is a holder for special information that certain feature nodes will use.

Target Nodes

PMMO has specific target nodes that correspond to object types in the game. they are:

  • item
  • block
  • entity
  • dimension
  • biome
  • effect
  • enchantment

Target nodes take one or multiple IDs. for example:

item(minecraft:stick)
block(minecraft:obsidian)
entity(minecraft:zombie, iceandfire:wyvern, alexmobs:elephant)

Note: when using multiple IDs, each id is separated by a commma

Target nodes can also take tags and wildcards. prefixing a # to an ID will tell PMMO this id is a tag. eg blocks(#c:ores/copper). wildcards let you provide a modid and have all objects for that mod configured by the line. to use wildcards, use an ID like modid:*. eg entity(alexmobs:*)

PMMO also provides advanced target nodes, which you can read about here

Value Nodes

Value nodes are blank space for feature nodes to grab additional information from. They follow the same format of keyword(data) as other nodes. See the table in the next section for what value nodes each feature node uses.

Feature Nodes

These nodes take the target and perform a configuration action for that object. Some feature nodes can use the value node for extra data. The Feature nodes, their applicable data values, and what/if they use the value node are detailed below:

keyworddata formatvalue format
xpevent name in all uppercase letters. Eg. CONSUME, BREAK, PLACE, CRAFTkeyword = award. the skills and experience separated by commas. skill,1 for multiple skills continue the pattern award(skill,1,otherskill,10)
deal_damagethe damage type idkeyword = require. the skills and experience separated by commas. skill,1 for multiple skills continue the pattern requires(skill,1,otherskill,10)
receive_damagethe damage type idkeyword = award. the skills and experience separated by commas. skill,1 for multiple skills continue the pattern award(skill,1,otherskill,10)
reqreq name in all uppercase letters. EG. KILL, BREAK, TRAVELkeyword = award. the skills and experience separated by commas. skill,1 for multiple skills continue the pattern award(skill,1,otherskill,10)
bonusbonus type in all uppercase letters. Eg. HELD, WORN, BIOME, DIMENSIONkeyword = value. the skills and bonus percent as decimal separated by commas. skill,1.1 for multiple skills continue the pattern value(skill,1.1,otherskill,2.0)
vein_chargethe amount of charge this item givesN/A
vein_capacitythe capacity this item addsN/A
vein_consumethe amount of vein consumed by this blockN/A
mob_scalethe id of the mob being scaledkeyword = attribute. the attributed id and scaling value separated by a comma. minecraft:generic.max_health,1.001 for multiple attributes, continue the pattern attribute(minecraft:generic.max_health,1.001,minecraft:generic.movement_speed,1.00001)
positive_effectthe effect id and magnitude separated by a comma. Eg minecraft:swiftness,2N/A
negative_effectthe effect id and magnitude separated by a comma. Eg minecraft:weakness,2N/A
salvagethe Item ID for the item returned when salvaged.see table below
setused only with the config target selector, accepts a config keysee links below for server config keys and examples

Salvage value keywords

keyworddata format
chance_levelthe skills and chance separated by commas. skill,0.1 for multiple skills continue the pattern chance_level(skill,0.3,otherskill,0.001)
chance_basepercent as a decimal chance_base(0.1) 10% chance.
chance_maxpercent as decimal chance_max(0.8) 80% max chance.
level_reqthe skills and levels separated by commas. skill,10 for multiple skills continue the pattern level_req(skill,10,otherskill,5)
salvage_awardthe skills and xp separated by commas. skill,10 for multiple skills continue the pattern salvage_award(skill,10,otherskill,5)
max_dropswhole number max_drops(3)

Server config syntax and examples

Advanced Syntax

Long repetitive lines over the length of a file are both tedious and an eyesore. To help with that, there are some special formatting tools you can use to make your life easier.

Comments

Any text on the same line and after // will be ignored by the script. You can use this to document your scripts.

WITH statement

By starting a line with WITH the nodes that follow will be used with every line after until you define another WITH. For example, if we wanted to write out how much xp breaking blocks should be, we can do the following

WITH xp(BLOCK_BREAK)
block(stone, andesite, granite, diorite).award(mining,10);
block(obsidian).award(mining,500);
block(extra_ores:ultra_diamond).award(mining,5000);

Without the WITH statement before, each line would need to repeat the .xp(BREAK).

To remove the prefix create a line that just has END

Omitting The Semicolon

Earlier the semicolon (;) was mentioned. Here it is explained. Semicolons end chains. Which means if you omit the semicolon you can continue on the next line. this is helpful for really long lines to make them more readable

//very long line
item(iron_sword).vein_charge(1.5).vein_capacity(30).deal_damage(minecraft:player_attack).award(combat,10);
//same line but broken up for readability
item(iron_sword)
.vein_charge(1.5)
.vein_capacity(30)
.deal_damage(minecraft:player_attack).award(combat,10);
//a simple example of breaking up the value to make the skills easier to read
item(diamond_helmet).xp(CRAFT)
.award(crafting,100,
smithing,1000);

Advanced Target Nodes

These selectors allow you to configure objects based on common properties without knowing the item ID in advance. You can use this to create configurations that apply to new mods as they are added without needing to explicitly add the object IDs to your script.

Note: if a line contains both a basic target node and an advanced selector, the latter in the chain will be used

Here are the advanced nodes and their parameters. Advanced selectors do not use value nodes

selector keywordparameters
foodtakes two optional expressions separated by a comma (expr1,expr2). the expressions start with a keyword of either nutrition or saturation followed by an operator >, <, =, >=, or <= and the value to filter by. eg (nutrition\>=5,saturation>0) applies your settings to all food of 5 or more nutrition and any saturation. (omitting saturation in this case would have the same effect)
toolconfigures any item with the TOOL data component. accepts an optional item tag as a parameter. eg tool() will configure all items with the data component, but tool(minecraft:pickaxes) will configure all items with the data component AND are in the pickaxes tag.
armorconfigures any item extending ArmorItem. accepts an optional item tag as a parameter. eg armor() will configure all items of the class, but armor(minecraft:chest_armor) will configure all items of the class AND are in the chest_armor tag.
weaponconfigures any item with the DAMAGE data component. accepts an optional item tag as a parameter. eg weapon() will configure all items with the data component, but weapon(minecraft:swords) will configure all items with the data component AND are in the swords tag.
configconfigures a serverconfig file and accepts the config name as the parameter. one of server, autovalues, skills, perks, globabls, anticheese