Minecraft Data Packs / Tool

MCalcLib - MC Datapack Library (random numbers, motion in direction, new entity tags, useful predicates, player head, player id, etc)

  • check_circle Functions
  • check_circle Loot Tables
  • 1,923 views, 3 today
  • 158 downloads, 0 today
  • 9
  • 7
  • 3
lullaby6's Avatar lullaby6
Level 27 : Expert Miner
9

MCalc Lib
Library to help you!





Feactures



  • Choice a random number between two numbers (scoreboard)
  • Motion in direction
  • Despawn an entity (without death animation)
  • Reset XP Player (levels and points)
  • Make unfire entities with a tag
  • More entities tags: #animals, #breedable, #tameable and #undead
  • Get player head
  • A lot of predicates, like: "has/passenger", "is/riding", "in/dimension/the_end", "is/sneaking"
  • Player unique ID score

Usage


Get a random number between a minimum and a maximum:


(including minimum and maximum)
scoreboard players set <entity> mcalc.min 1
scoreboard players set <entity> mcalc.max 10
execute as <entity> run function mcalc:calc/random

the random number will be stored in "mcalc.random" score
tellraw @a {"score":{"name":"<entity>","objective":"mcalc.random"}}


Motion in direction


throw_fireball.mcfunction:
function mcalc:calc/motion

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
execute as <entity> at @s run function <datapack>:throw_fireball


Despawn entity

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


Reset XP

execute as <player> run function mcalc:player/reset_xp


Unfire entity

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


New entities Tags

  • animal
  • boss
  • breedable
  • hostile
  • passive
  • rideable
  • tameable
  • undead

Example:
kill @e[type=#mcalc:undead]


Clear chat


For specific player:
execute as <player> run function mcalc:player/clear_chat

For all players
function mcalc:global/clear_chat


Get player head

execute at @s as <player> run loot spawn ~ ~ ~ loot mcalc:player_head


All new predicates

  • has/passenger
  • has/effect/<effect_name> (example effects name: "regeneration", "fire_resistance", "glowing)
  • in/biome/<biome_name> (example biomes name: "forest", "badlands", "jungle)
  • in/dimension/<dimension_name> (example dimensions name: "overworld", "the_end", "the_nether")
  • is/baby
  • is/on_fire
  • is/riding
  • is/sneaking
  • is/sprinting
  • is/swimming
  • random/<random_chance> (example: "0_1" = 10% of chance, "0.5" = 50% of chance, "0.75" = 75% of chance)

Examples:
execute as <player> if predicate mcalc:is/sprinting run say a player is runing!

execute if predicate mcalc:random/0_5 run say 50% of chance!



Player unique ID score

scoreboard players get @s mcalc.player_id
Creditgithub.com/lullaby6
CompatibilityMinecraft 1.19
Tags

Create an account or sign in to comment.

justwillywastaken
08/28/2023 7:37 am
Level 72 : Legendary uwu
justwillywastaken's Avatar
can you add for custom model for custom item and 3d blocks?
1
Echovite
02/12/2023 2:52 pm
Level 1 : New Miner
Echovite's Avatar
definitely gonna use this once i start making datapacks again, appreciate it
2
lullaby6
02/12/2023 3:42 pm
Level 27 : Expert Miner
lullaby6's Avatar
Thanks! I will try to keep adding features to save datapack developers time!
2
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome