Project MMO

Project MMO

Events

Everything in Project MMO revolves around events. These are gameplay actions that PMMO watches for and what trigger all the features of the mod. In most cases, events are used to define what experience is earned. An event usually has an item, block, entity, etc that the player has interacted with which PMMO then looks up to figure out what experience to award for this action and that thing.

Events also work to block behavior as well. Events like mining and dealing damage can be prevented if the player doesn't meet the requirement for the subject block/entity or for a tool/weapon they are holding.

Events are also what activate special abilities (known as Perks). As an example, players with enough swimming experience get night vision while swimming

Event Configuration

Event names are used to define when XP is awarded. Certain events can be blocked/prevented/gated. For more information on requirements, see HERE. The below table lists the name of the event as it is used in configurations, a description of what the event is, any applicable requirements, and where the xp award configuration is located and how it works.

Event KeyDescriptionRequirementsXp Awarded
ANVIL_REPAIRWhen an Item is repaired in an anvilNonethe flat amount from the item's data
BLOCK_BREAKWhen a block is actually broken (not when it is in the process of being broken)BREAK(block)defined in the block's data, affected by whether the player placed this block via the server config's Reuse Penalty setting.
BREAK_SPEEDUsed by perks to control how fast a block can be broken and also checks requirements in advance of the block being brokenTOOL(item) and BLOCK(block)None
BLOCK_PLACEWhen a block is placed in the worldPLACE(block)flat amount from the block's data
BREATH_CHANGEwhen the player's breath increases or decreasesNonedefined in server config
BREEDwhen animals are bred to make a baby animalBREED(entity)flat amount from the entity's data
BREWwhen a brewed potion is removed from the brewing standNonedefined in the item's data (for output item, not the materials used)
CONSUMEwhen a potion or food item is consumedUSEflat amount from the item's data
CRAFTwhen an item is craftedNoneflat amount from the item's data
CROUCHoccurs every 10 ticks while the player is crouching.NoneN/A for Perks only
TOOL_BREAKINGwhen a tool breaksNoneflat amount from the item's data
RECEIVE_DAMAGEwhen the player receives damageNonedefined by the entity that dealt the damage. This will be the mob itself if melee or the projectile of ranged. if no entity data exists, server config has a fallback section for damage types. Note that xp is differentiated by damage type and the value entered is multiplied by the damage value actually received by the player (after damage reduction from armor, enchants, etc)
DEAL_DAMAGEwhen the player deals melee damageWEAPON(item) and KILL(entity)combined from the item data of the player's held item, the entity being damaged, and the projectile if ranged. if the damage type is not configured for all 3, server config will be used as a fallback. The Xp value is multiplied by the damage actually dealt after damage reduction effects.
DEATHwhen an entity dies from a player (notice that DEAL_DAMAGE and DEATH will both fire and may have different settings)WEAPON(item) and KILL(entity)defined in the dying entity's data
ENCHANTwhen an item is enchanted in a crafting tableNonefrom item's data (the config setting will be scaled according to the max enchant level of the enchantment for every enchantment. So if the config setting is 100 xp and you get mending, which has one level, you get 100 xp. However, if you get Efficiency 1 which has a max of 3, you get 33 experience instead. If both enchantments were added, you would get 133)
EFFECTOccurs every 10 ticks when the player has any active potion effectsNonedefined in the effect's data
FISHwhen an item is obtained from fishingTOOL(item)each loot item's data is referenced and XP from all loot items is awarded.
SMELTwhen an item is smelted in a vanilla furnace, the player who placed the furnace gets the experienceNonefrom the ingredient item's data'
GROWwhen a crop's age increases by one, the player who placed the crop gets the experienceNonefrom block's data
GIVEN_AS_TRADEwhen an item is given to a villager as part of a successful tradeNonefrom item's data times number traded
HEALTH_INCREASEwhen the players health increasesNonedefined in server config
HEALTH_DECREASEwhen the players health decreasesNonedefined in server config
JUMPwhen the player performs a regular jump.Nonedefined in server config
SPRINT_JUMPwhen the player performs a regular jump while sprinting.Nonedefined in server config
CROUCH_JUMPwhen the player performs a regular jump from a crouch.Nonedefined in server config
HIT_BLOCKoccurs when a player hits the block. This works similarly to the BREAK_SPEED event except that you cannot modify the break speed and also captures creative mode player breaks before they happen.INTERACT(block) and INTERACT(item)defined in the block's data
ACTIVATE_BLOCKoccurs when a block is interacted with to activate such as pushing a button of flipping a lever.INTERACT(block) and INTERACT(item) when using an item on a blockdefined in the block's data for the block's behavior and the item's data for the item use on block behavior
ACTIVATE_ITEMoccurs when an item is right-clicked (or activated).USE(item)from item's data
ENTITYexperience for interacting with an entity, such as shearing a sheep, or talking to a villagerENTITY_INTERACT(entity)from entity's data
RECEIVED_AS_TRADEwhen an item is received from a villager as part of a successful tradeNonefrom item's data times number traded
RIDINGoccurs every 10 ticks while riding in any vehicle (horses, boats, minecarts, etc)None (though you can gate mounting the entity with an interact check)from entity's data
SHIELD_BLOCKearn xp when damage is successfully blocked by your shieldWEAPON(item)defined in the attacking entity's data
SKILL_UPwhenever a player's level increases. this is not used to award XP but is used by Perks.
SPRINTINGxp earned every 10 ticks while sprintingNonedefined in server config
SUBMERGEDxp earned every 10 ticks while underwater. is awarded simultaneously with other applicable swim eventsNonedefined in server config
SWIMMINGxp earned every 10 ticks while swimming above waterNonedefined in server config and multiplied by travel speed
DIVINGxp earned every 10 ticks while submerged and sinking deeperNonedefined in server config multiplied by travel speed
SURFACINGxp earned every 10 ticks while submerged but rising to the surfaceNonedefined in server config multiplied by travel speed
SWIM_SPRINTINGxp earned every 10 ticks while submerged and swimming at a sprintNonedefined in server config multiplied by travel speed
TAMINGawarded for successfully taming an animal.TAME(entity)defined in the tamed entity's data