CoreM

CoreM

1.2k Downloads

CoreM migrated to the GitHub! All updates you can find only there!

Legacy information:

Attention! CoreM 1.2+ is only for 1.15.X and 1.16.X!

Don't forget to use resourcepack if you have custom workbench: Google Drive


My own datapacks where you can see how I use CoreM:

• Steel Update
Fauna+
Potions+


CoreM is
 powerful tool for datapacks
Right now CoreM has:
• Custom optimized workbench
• Random
• Comfortable math functions
• Raycast
• A lot of tags:

  1. #corem:1.16/pickaxe - all blocks, which can be broken only with pickaxe at 1.16 (you can use any version from 1.13-1.16)
  2. #corem:1.16/shovel - all blocks, which can be broken only with shovel at 1.16 (you can use any version from 1.13-1.16)
  3. #corem:1.16/axe -
all blocks, which can be broken only with axe at 1.16 (you can use any version from 1.13-1.16)
  4. #corem:air -
minecraft:void_air, minecraft:cave_air and minecraft:air
  5. #corem:concrete - all blocks of concrete
  6.
#corem:concrete_powder -
all blocks of concrete powder
  7.
#corem:dead_coral_blocks -
all dead coral blocks
  8.
#corem:dead_corals -
all dead corals
  9.
#corem:terracotta -
all blocks of terracotta
  10.
#corem:glazed_terracotta -
all blocks of glazed terracotta
  11.
#corem:shulker_boxes -
all shulker boxes

 

If you want you can donate me here: https://www.donationalerts.com/r/leonidmem

Short documentation:
(1.0.6-1.1.2) If you want create your own crafts in other datapacks, using functions like here (example without air in recipe):

#Custom Recipe 1:
#Classic craft of enchanted golden apple:
#[{Slot:0b,id:"minecraft:gold_block",Count:1b},
#{Slot:1b,id:"minecraft:gold_block",Count:1b},
#{Slot:2b,id:"minecraft:gold_block",Count:1b},
#{Slot:3b,id:"minecraft:gold_block",Count:1b},
#{Slot:4b,id:"minecraft:apple",Count:1b},
#{Slot:5b,id:"minecraft:gold_block",Count:1b},
#{Slot:6b,id:"minecraft:gold_block",Count:1b},
#{Slot:7b,id:"minecraft:gold_block",Count:1b},
#{Slot:8b,id:"minecraft:gold_block",Count:1b}]

#If recipe is true it will play sound
execute as @e[type=area_effect_cloud,name=MWorkbench] at @s if block ~ ~ ~ dropper{Items:[{Slot:0b,id:"minecraft:gold_block",Count:1b},{Slot:1b,id:"minecraft:gold_block",Count:1b},{Slot:2b,id:"minecraft:gold_block",Count:1b},{Slot:3b,id:"minecraft:gold_block",Count:1b},{Slot:4b,id:"minecraft:apple",Count:1b},{Slot:5b,id:"minecraft:gold_block",Count:1b},{Slot:6b,id:"minecraft:gold_block",Count:1b},{Slot:7b,id:"minecraft:gold_block",Count:1b},{Slot:8b,id:"minecraft:gold_block",Count:1b}]} run playsound minecraft:block.anvil.use block @a ~ ~ ~ 1 1 0

#If recipe is true it will replace items
execute as @e[type=area_effect_cloud,name=MWorkbench] at @s if block ~ ~ ~ dropper{Items:[{Slot:0b,id:"minecraft:gold_block",Count:1b},{Slot:1b,id:"minecraft:gold_block",Count:1b},{Slot:2b,id:"minecraft:gold_block",Count:1b},{Slot:3b,id:"minecraft:gold_block",Count:1b},{Slot:4b,id:"minecraft:apple",Count:1b},{Slot:5b,id:"minecraft:gold_block",Count:1b},{Slot:6b,id:"minecraft:gold_block",Count:1b},{Slot:7b,id:"minecraft:gold_block",Count:1b},{Slot:8b,id:"minecraft:gold_block",Count:1b}]} run data merge block ~ ~ ~ {Items:[{Slot:4b,id:"minecraft:enchanted_golden_apple",Count:1b}]}

or here (example with air in recipe):

#Custom Recipe 2:
#Classic craft of chest:
#[{Slot:0b,id:"minecraft:oak_planks",Count:1b},
#{Slot:1b,id:"minecraft:oak_planks",Count:1b},
#{Slot:2b,id:"minecraft:oak_planks",Count:1b},
#{Slot:3b,id:"minecraft:oak_planks",Count:1b},
#{Slot:4b,id:"minecraft:air"},
#{Slot:5b,id:"minecraft:oak_planks",Count:1b},
#{Slot:6b,id:"minecraft:oak_planks",Count:1b},
#{Slot:7b,id:"minecraft:oak_planks",Count:1b},
#{Slot:8b,id:"minecraft:oak_planks",Count:1b}]

#But when the slot is empty, slot deletes automatically
#So, you need to use " *here you detect recipe* ... run execute unless block ~ ~ ~ dropper{Items:[{Slot:4b}]} run ..."

#If you need to check more then 2 slots without items use this construction:
#execute unless block ~ ~ ~ dropper{Items:[{Slot:0b}] unless block ~ ~ ~ dropper{Items:[{Slot:1b}]} run ...

#If recipe is true it will play sound
execute as @e[type=area_effect_cloud,name=MWorkbench] at @s if block ~ ~ ~ dropper{Items:[{Slot:0b,id:"minecraft:oak_planks",Count:1b},{Slot:1b,id:"minecraft:oak_planks",Count:1b},{Slot:2b,id:"minecraft:oak_planks",Count:1b},{Slot:3b,id:"minecraft:oak_planks",Count:1b},{Slot:5b,id:"minecraft:oak_planks",Count:1b},{Slot:6b,id:"minecraft:oak_planks",Count:1b},{Slot:7b,id:"minecraft:oak_planks",Count:1b},{Slot:8b,id:"minecraft:oak_planks",Count:1b}]} run execute unless block ~ ~ ~ dropper{Items:[{Slot:4b}]} run playsound minecraft:block.anvil.use block @a ~ ~ ~ 1 1 0

#If recipe is true it will replace items
execute as @e[type=area_effect_cloud,name=MWorkbench] at @s if block ~ ~ ~ dropper{Items:[{Slot:0b,id:"minecraft:oak_planks",Count:1b},{Slot:1b,id:"minecraft:oak_planks",Count:1b},{Slot:2b,id:"minecraft:oak_planks",Count:1b},{Slot:3b,id:"minecraft:oak_planks",Count:1b},{Slot:5b,id:"minecraft:oak_planks",Count:1b},{Slot:6b,id:"minecraft:oak_planks",Count:1b},{Slot:7b,id:"minecraft:oak_planks",Count:1b},{Slot:8b,id:"minecraft:oak_planks",Count:1b}]} run execute unless block ~ ~ ~ dropper{Items:[{Slot:4b}]} run data merge block ~ ~ ~ {Items:[{Slot:4b,id:"minecraft:chest",Count:1b}]}

When you created recipes, go to data/minecraft/tags/tick.json and edit this files to this:

{

    "values": [

        "your_datapack_name:name_of_the_first_function_with_recipe(s)",

        "your_datapack_name:name_of_the_second_function_with_recipe(s)_if_exists"
    ]
}

(1.2+) If you want create your own crafts in other datapacks, using functions like here:

# You should change tag "corem.recipe.1" to "datapack_name.recipe.item_you_crafted" for no bugs
# All tags in all recipes should be unique for no bugs!
# For example, if you have 2 crafts for dirt in datapack "Example", you can change tag to "example.recipe.dirt.first" and "example.recipe.dirt.second"

execute if block ~ ~ ~ barrel{Items:[{Slot:2b,id:"minecraft:gold_block"},{Slot:3b,id:"minecraft:gold_block"},{Slot:4b,id:"minecraft:gold_block"},{Slot:11b,id:"minecraft:gold_block"},{Slot:12b,id:"minecraft:apple"},{Slot:13b,id:"minecraft:gold_block"},{Slot:20b,id:"minecraft:gold_block"},{Slot:21b,id:"minecraft:gold_block"},{Slot:22b,id:"minecraft:gold_block"}]} run tag @s add corem.recipe

execute if entity @s[tag=corem.recipe,scores={corem.workbench=0}] run data modify block ~ ~ ~ Items[{Slot:15b}] set value {Slot:15b,Count:1b,id:"minecraft:enchanted_golden_apple",tag:{Tags:[corem.clear,corem.recipe.1]}}

execute if entity @s[tag=corem.recipe] run scoreboard players set @s corem.workbench 2

execute if entity @s[tag=!corem.recipe] if data block ~ ~ ~ Items[{Slot:15b,id:"minecraft:enchanted_golden_apple",tag:{Tags:[corem.recipe.1]}}] run scoreboard players set @s corem.workbench 0

tag @s remove corem.recipe

execute if block ~ ~ ~ barrel{Items:[{Slot:2b,id:"minecraft:gold_block"},{Slot:3b,id:"minecraft:gold_block"},{Slot:4b,id:"minecraft:gold_block"},{Slot:11b,id:"minecraft:gold_block"},{Slot:12b,id:"minecraft:apple"},{Slot:13b,id:"minecraft:gold_block"},{Slot:20b,id:"minecraft:gold_block"},{Slot:21b,id:"minecraft:gold_block"},{Slot:22b,id:"minecraft:gold_block"},{Slot:15b,id:"minecraft:barrier"}]} run tag @s add corem.recipe.crafted

execute if entity @s[tag=corem.recipe.crafted] run clear @a[distance=..6] enchanted_golden_apple{Tags:[corem.clear]}

execute if entity @s[tag=corem.recipe.crafted] run give @p enchanted_golden_apple

execute if entity @s[tag=corem.recipe.crafted] run function corem:custom_wb/count

execute if entity @s[tag=corem.recipe.crafted] run scoreboard players set @s corem.workbench 0

tag @s remove corem.recipe.crafted

I advise you to use one file for one recipe.


When you created recipes, create folders and JSON file in this path: data/corem/tags/functions/custom_recipes.json and edit this files like this:

{

    "values": [

        "datapack_name:path_to_recipe"
    ]

}



(1.0.6+) If you want use random in any function use function "corem:random/(number: 5, 10, 20, 50, 100)" like here:

#Don't forget to give tag to target!
tag @s add corem.random

function corem:random/5

#You can use any command instead "say":

execute as @s[scores={corem.random=1}] run say 1
execute as @s[scores={corem.random=2}] run say 2
execute as @s[scores={corem.random=3}] run say 3
execute as @s[scores={corem.random=4}] run say 4
execute as @s[scores={corem.random=5}] run say 5

#Don't forget to reset score "corem.random"
#P.s. Tag will be removed automatically

execute as @s[scores={corem.random=1..}] run scoreboard players reset @s corem.random

(1.0.4+) If you want use math functions use it like here:

#Firstly, you need to define your numbers

scoreboard players set corem.num1 corem.math 205

scoreboard players set corem.num2 corem.math 100

#Secondly, use function add / rem / div / mod / mult

#All results of this functions will be saved in corem.num in score corem.math:

#Add (+):

function corem:math/add
tellraw @a {"score":{"name":"const.num","objective":"const.math"}}
#Output: 305

#Remove (-):


function corem:math/rem
tellraw @a {"score":{"name":"const.num","objective":"const.math"}}
#Output: 105


#Division (/):

function corem:math/div

tellraw @a {"score":{"name":"const.num","objective":"const.math"}}


#Output: 2, because Minecraft scoreboard supports only integer numbers


#Module (%):

function corem:math/mod

tellraw @a {"score":{"name":"const.num","objective":"const.math"}}


#Output: 5

#Multiplication (*):

function corem:math/mult

tellraw @a {"score":{"name":"const.num","objective":"const.math"}}


#Output: 20500

 
(1.0.6+) If you want to check version of CoreM in any function you can do it this way:

#10006 - is needed version (10006 = 01 00 06 - this is version of CoreM 1.0.6)

scoreboard players set 10006 corem.version 10006

execute if score corem.version corem.version = 10006 corem.version run say All is fine, needed version of CoreM is installed!
execute if score corem.version corem.version > 10006 corem.version run say Install needed version of Corem or datapack may not work correctly!
execute if score corem.version corem.version < 10006 corem.version run say Install needed version of Corem or datapack will not work correctly!

• (1.0.7+) If you want use raycast use it like here:

#Give tag to one entity
tag @e[type=zombie,limit=1] add corem.raycast
function corem:raycast/start

#OR


execute as @e[type=zombie,limit=1] run function corem:raycast/start


#Then we can check all needed conditions:
execute as @e[type=area_effect_cloud,tag=corem.raycast.point,limit=1] if block ~ ~ ~ minecraft:ice run say It's ice!

execute as @e[type=area_effect_cloud,tag=corem.raycast.point,limit=1] if block ~ ~ ~ minecraft:grass run say It's grass!

execute as @e[type=area_effect_cloud,tag=corem.raycast.point,limit=1] if block ~ ~ ~ #corem:air run say It's air, cave air or void air!

#In the end you should kill area effect cloud with tag "corem.raycast.point", but if you will use again function "corem:raycast/start", it will kill area
kill @e[type=area_effect_cloud,tag=corem.raycast.point,limit=1]