Skip to content

Commit a0f28e0

Browse files
committed
v3.1 for Minecraft 1.16
1 parent 5fa7066 commit a0f28e0

25 files changed

+439
-443
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
* text=auto
2-
*.mcscript linguist-language=mcfunction
2+
*.mcf linguist-language=mcfunction

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Compiled
2-
*.mcfunction
2+
functions/
3+
mcscripts/

compile.bat

Lines changed: 0 additions & 1 deletion
This file was deleted.

compile.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
MCScript uses syntax that makes mcfunction syntax highlighting on GitHub an eyesore.
3+
This script converts a custom syntax into MCScript.
4+
The custom syntax:
5+
- Uses `_const` instead of `const` (etc)
6+
- Uses `fill` instead of `/fill` (etc)
7+
*/
8+
9+
const fs = require('fs');
10+
const cp = require('child_process');
11+
const glob = require('glob');
12+
13+
glob('data/mb/scripts/**/*.mcf', {}, (err, files) => {
14+
if (err) throw err.name;
15+
files.forEach(file => {
16+
const outfile = file.replace('funcs', 'scripts').replace('.mcf', '.mcscript');
17+
const outfolder = outfile.replace(/[^/\\]+$/, '');
18+
if (!fs.existsSync(outfolder)) fs.mkdirSync(outfolder);
19+
const inContent = fs.readFileSync('./' + file, { encoding: 'utf8' });
20+
const outContent = inContent
21+
.replace(/\/\/.+$/gm, '') // remove comments
22+
.replace(/^( *)(?=[a-z])/gm, '$1/') // execute -> /execute
23+
.replace(/^_/gm, '') // _const -> const
24+
.replace(/ (?=\()/gm, '') // for (1,2) -> for(1,2)
25+
fs.writeFileSync(outfile, outContent);
26+
});
27+
cp.execSync('mcscript compile');
28+
fs.rmdirSync('data/mb/scripts', { recursive: true }); // comment out if inspecting intermediary `.mcscript` files is needed
29+
});

data/mb/funcs/init.mcf

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#---------------------------------#
2+
# #
3+
# MUSICAL BLOCKS v2 #
4+
# by Nixinova #
5+
# #
6+
# World setup commands #
7+
# #
8+
#---------------------------------#
9+
10+
tellraw @a "If the map has not been set up properly, please run the command again."
11+
12+
# Teleport players
13+
setworldspawn 968 5 1018
14+
spawnpoint @a 968 5 1018
15+
tp @a 968 5 1018
16+
17+
# Teams
18+
team add lobby
19+
team modify lobby color yellow
20+
team modify lobby friendlyFire false
21+
team add playing
22+
team modify playing color green
23+
team add dead
24+
team modify dead color red
25+
team modify playing friendlyFire false
26+
27+
# Scoreboards
28+
scoreboard objectives add Timer dummy "Timer"
29+
scoreboard objectives add Dead deathCount "Dead"
30+
scoreboard objectives add Health health "Health"
31+
scoreboard objectives add MB dummy {"text":"§1M§3U§5S§7I§9C§bA§dL §2B§4L§6O§8C§aK§cS§r"}
32+
scoreboard objectives add Map dummy "Map"
33+
scoreboard objectives add Wins dummy "§aWins"
34+
scoreboard objectives add Players dummy "Players"
35+
scoreboard objectives add Colour dummy "Colour"
36+
37+
# Command blocks
38+
setblock 965 4 1041 repeating_command_block{Command:"function mb:map/running",auto:true}
39+
40+
# World settings
41+
gamerule spawnRadius 2
42+
gamerule commandBlockOutput false
43+
gamerule doImmediateRespawn true
44+
gamerule showDeathMessages false
45+
gamerule doDaylightCycle false
46+
time set day
47+
difficulty peaceful
48+
49+
# Spawn
50+
fill 975 3 1010 960 8 1026 iron_block hollow
51+
fill 962 3 1024 967 3 1019 redstone_lamp
52+
fill 962 3 1012 967 3 1017 redstone_lamp
53+
fill 973 3 1024 969 3 1019 redstone_lamp
54+
fill 969 3 1017 973 3 1012 redstone_lamp
55+
fill 973 2 1012 962 2 1024 redstone_block
56+
setblock 961 5 1018 player_wall_head[facing=east]{SkullOwner:{Name:"Nixinova"}}
57+
setblock 961 5 1019 birch_wall_sign[facing=east]{Text2:'"§1M§3U§5S§7I§9C§bA§dL"',Text3:'"§2B§4L§6O§8C§aK§cS"'}
58+
setblock 961 5 1017 birch_wall_sign[facing=east]{Text2:'{"text":"v3.0","color":"red"}'}
59+
setblock 974 5 1018 birch_wall_sign[facing=west]{Text1:'{"color":"green","clickEvent":{"action":"run_command","value":"function mb:map/play"},"text":"=========================="}',Text2:'{"bold":true,"color":"green","text":"Start"}',Text3:'{"bold":true,"color":"green","text":"Game"}',Text4:'{"color":"green","text":"=========================="}'}
60+
setblock 976 4 1018 command_block{Command:"function mb:map/play"}
61+
setblock 974 4 1018 stone_button[facing=west]
62+
63+
# Map
64+
fill 1027 17 947 1060 8 980 barrier hollow
65+
fill 1027 8 947 1060 0 980 iron_block hollow
66+
fill 1059 8 948 1028 8 979 air
67+
fill 1059 16 948 1028 17 979 air
68+
fill 1028 1 979 1059 1 948 lava
69+
70+
# Banners
71+
_const banner_east = 'black_wall_banner[facing=east]'
72+
_const banner_west = 'black_wall_banner[facing=west]'
73+
_const pattern_N = '{Patterns:[{Pattern:"drs",Color:0},{Pattern:"ls",Color:0},{Pattern:"rs",Color:0},{Pattern:"ss",Color:0},{Pattern:"bo",Color:15}]}'
74+
_const pattern_I = '{Patterns:[{Pattern:"ss",Color:0},{Pattern:"ls",Color:15},{Pattern:"rs",Color:15},{Pattern:"ts",Color:0},{Pattern:"cs",Color:0},{Pattern:"bs",Color:0},{Pattern:"bo",Color:15}]}'
75+
_const pattern_X = '{Patterns:[{Pattern:"bs",Color:0},{Pattern:"ts",Color:0},{Pattern:"cs",Color:15},{Pattern:"dls",Color:0},{Pattern:"drs",Color:0},{Pattern:"bo",Color:15}]}'
76+
_const pattern_O = '{Patterns:[{Pattern:"ts",Color:0},{Pattern:"bs",Color:0},{Pattern:"rs",Color:0},{Pattern:"ls",Color:0},{Pattern:"bo",Color:15}]}'
77+
_const pattern_V = '{Patterns:[{Pattern:"ls",Color:0},{Pattern:"rd",Color:15},{Pattern:"dls",Color:0},{Pattern:"bo",Color:15}]}'
78+
_const pattern_A = '{Patterns:[{Pattern:"ts",Color:0},{Pattern:"ms",Color:0},{Pattern:"ls",Color:0},{Pattern:"rs",Color:0},{Pattern:"bo",Color:15}]}'
79+
setblock 1028 7 967 $(banner_east)$(pattern_N)
80+
setblock 1028 7 966 $(banner_east)$(pattern_I)
81+
setblock 1028 7 965 $(banner_east)$(pattern_X)
82+
setblock 1028 7 964 $(banner_east)$(pattern_I)
83+
setblock 1028 7 963 $(banner_east)$(pattern_N)
84+
setblock 1028 7 962 $(banner_east)$(pattern_O)
85+
setblock 1028 7 961 $(banner_east)$(pattern_V)
86+
setblock 1028 7 960 $(banner_east)$(pattern_A)
87+
88+
setblock 1059 7 960 $(banner_west)$(pattern_N)
89+
setblock 1059 7 961 $(banner_west)$(pattern_I)
90+
setblock 1059 7 962 $(banner_west)$(pattern_X)
91+
setblock 1059 7 963 $(banner_west)$(pattern_I)
92+
setblock 1059 7 964 $(banner_west)$(pattern_N)
93+
setblock 1059 7 965 $(banner_west)$(pattern_O)
94+
setblock 1059 7 966 $(banner_west)$(pattern_V)
95+
setblock 1059 7 967 $(banner_west)$(pattern_A)
96+
97+
# RNG by fafik77
98+
scoreboard objectives add RNG_77 dummy "RNG"
99+
scoreboard objectives add RNG_77_rp minecraft.custom:minecraft.walk_one_cm "RNG-data"
100+
execute unless score #const2 RNG_77 matches 1.. run scoreboard players set #const2 RNG_77 3
101+
scoreboard players add #prev_number RNG_77 0
102+
scoreboard players set #m1 RNG_77 -1
103+
scoreboard players add #clock_time RNG_77 1

data/mb/funcs/map/.gl.mcf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_const MUSICAL_BLOCKS = '{"text":"[","color":"white","bold":true},{"text":"M","color":"dark_blue","bold":true},{"text":"U","color":"dark_aqua","bold":true},{"text":"S","color":"dark_purple","bold":true},{"text":"I","color":"gray","bold":true},{"text":"C","color":"blue","bold":true},{"text":"A","color":"aqua","bold":true},{"text":"L ","color":"light_purple","bold":true},{"text":"B","color":"dark_green","bold":true},{"text":"L","color":"dark_red","bold":true},{"text":"O","color":"gold","bold":true},{"text":"C","color":"dark_gray","bold":true},{"text":"K","color":"green","bold":true},{"text":"S","color":"red","bold":true},{"text":"]","color":"white","bold":true}'

data/mb/funcs/map/countdown.mcf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#---------------------------------#
2+
# #
3+
# MUSICAL BLOCKS v2 #
4+
# by Nixinova #
5+
# #
6+
# Starting countdown commands #
7+
# #
8+
#---------------------------------#
9+
10+
_const starting_in = '{"text":" Starting in ","color":"white","bold":false}'
11+
_const timer = 'score starting Timer matches'
12+
_const target = '@a[team=lobby]'
13+
14+
execute if $(timer) 10 run tellraw $(target) [$(MUSICAL_BLOCKS),$(starting_in),{"text":"5","color":"dark_green"}]
15+
execute if $(timer) 30 run tellraw $(target) [$(MUSICAL_BLOCKS),$(starting_in),{"text":"4","color":"dark_green"}]
16+
execute if $(timer) 50 run tellraw $(target) [$(MUSICAL_BLOCKS),$(starting_in),{"text":"3","color":"dark_green"}]
17+
execute if $(timer) 70 run tellraw $(target) [$(MUSICAL_BLOCKS),$(starting_in),{"text":"2","color":"dark_green"}]
18+
execute if $(timer) 90 run tellraw $(target) [$(MUSICAL_BLOCKS),$(starting_in),{"text":"1","color":"dark_green"}]
19+
execute if $(timer) 110.. run function mb:map/game_start

data/mb/funcs/map/game_end.mcf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#---------------------------------#
2+
# #
3+
# MUSICAL BLOCKS v2 #
4+
# by Nixinova #
5+
# #
6+
# Game ending commands #
7+
# #
8+
#---------------------------------#
9+
10+
# Declare winner
11+
title @a title [{"selector":"@a[team=playing]"}]
12+
title @a subtitle [{"text":" has won!","color":"green"}]
13+
14+
# Update scoreboards
15+
scoreboard players add @a[team=playing] Wins 1
16+
scoreboard players reset starting Map
17+
scoreboard players set playing Map 0
18+
scoreboard players set Round MB 0
19+
scoreboard players reset @a Dead
20+
scoreboard objectives setdisplay sidebar Wins
21+
22+
# Move players to lobby
23+
clear @a
24+
tp @a 967 5 1018
25+
team join lobby @a
26+
gamemode adventure @a[team=lobby]

data/mb/funcs/map/game_start.mcf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#---------------------------------#
2+
# #
3+
# MUSICAL BLOCKS v2 #
4+
# by Nixinova #
5+
# #
6+
# Game starting commands #
7+
# #
8+
#---------------------------------#
9+
10+
# Prepare players
11+
clear @a[team=lobby]
12+
gamemode adventure @a[team=lobby]
13+
14+
# Reset scoreboards
15+
scoreboard players reset starting Map
16+
scoreboard players set playing Map 1
17+
scoreboard players set Round MB 0
18+
scoreboard players reset @a Dead
19+
scoreboard objectives setdisplay sidebar MB
20+
21+
# Move players to game map
22+
spreadplayers 1044 964 3 14 false @a[team=lobby]
23+
stopsound @a
24+
execute as @a at @s run playsound minecraft:music_disc.stal master @a
25+
team join playing @a[team=lobby]
26+
27+
# Setup round
28+
function mb:map/round_setup

data/mb/funcs/map/play.mcf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#---------------------------------#
2+
# #
3+
# MUSICAL BLOCKS v2 #
4+
# by Nixinova #
5+
# #
6+
# Game initialising commands #
7+
# #
8+
#---------------------------------#
9+
10+
scoreboard players reset online Players
11+
execute as @a run scoreboard players add online Players 1
12+
_if ('score online Players matches 2..') {
13+
scoreboard players reset starting Timer
14+
scoreboard players set starting Map 1
15+
_}
16+
execute unless score online Players matches 2.. run tellraw @p [{"text":"Not enough players!","color":"red"}]

0 commit comments

Comments
 (0)