Download MCalc — Minecraft Mods — MetaMods

MCalc

Active

Downloads

0

Last update

2 years ago

Versions

1.19 — 1.19.3
Server
Libraries
Utils

MCalc

Universal library for datapack developers, offering a set of useful functions for simplifying the creation of complex mechanics in Minecraft.

Key Features

  • Generation of random numbers within a specified range using the scoreboard system
  • Implementation of object movement in a specific direction
  • Instant removal of entities without death animation
  • Player experience reset (levels and points)
  • Protection of entities from catching fire using a special tag
  • Additional entity tags: #animals, #breedable, #tameable and #undead

Usage Examples

Random Number Generation

Set minimum and maximum values for random number generation:

scoreboard players set <entity> mcalc.min 1
scoreboard players set <entity> mcalc.max 10
execute as <entity> run function mcalc:random

Result is stored in "mcalc.random" scores:

tellraw @a {"score":{"name":"<entity>","objective":"mcalc.random"}}

Object Movement

Example of creating a fireball with specified direction:

function mcalc:calc

summon minecraft:fireball ^ ^1.5 ^.5 {Tags:["test.fireball"]}

data modify entity @e[tag=test.fireball,limit=1,sort=nearest] Owner set from entity @s UUID

execute store result entity @e[tag=test.fireball,limit=1,sort=nearest] power[0] double -0.00025 run scoreboard players get @s mcalc.mx
execute store result entity @e[tag=test.fireball,limit=1,sort=nearest] power[1] double -0.00025 run scoreboard players get @s mcalc.my
execute store result entity @e[tag=test.fireball,limit=1,sort=nearest] power[2] double -0.00025 run scoreboard players get @s mcalc.mz

tag @e[tag=test.fireball,limit=1,sort=nearest] remove test.fireball

Function execution:

execute as <entity> at @s run function <datapack>:throw_fireball

Fast Entity Removal

execute as <entity> at @s run function mcalc:kill

Player Experience Reset

execute as <player> run function mcalc:reset_xp

Fire Protection

Create an entity that cannot catch fire:

summon zombie ~ ~ ~ {Tags:["mcalc.unfire"]}

New Entity Tags

Use extended tags for filtering:

kill @e[type=#undead]
Project members
lullaby6

lullaby6

Developer

Created: 1 Feb 2023

ID: 23454