Skip to content

Commit 771f1ee

Browse files
committed
Update workflow
1 parent 4c85cc2 commit 771f1ee

18 files changed

Lines changed: 22474 additions & 36 deletions

File tree

.github/workflows/cl.yml

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ on:
1010
- cron: "00 20 * * 3"
1111

1212
jobs:
13-
type-check:
14-
name: 'Type Check'
13+
checks:
14+
name: 'Script Check'
1515
runs-on: ubuntu-latest
1616

1717
steps:
@@ -24,32 +24,9 @@ jobs:
2424
find ./scripts/* -maxdepth 2 -name package.json -execdir sh -c 'pwd && npm install' \;
2525
find ./docs/* -maxdepth 5 -name package.json -execdir sh -c 'pwd && npm install' \;
2626
27-
- name: Build tsc
27+
- name: Type Check
2828
run: tsc --build --verbose
2929

30-
- name: Commit Changes
31-
if: ${{ github.event_name == 'schedule' }}
32-
uses: EndBug/add-and-commit@v9
33-
with:
34-
add: ./scripts
35-
message: 'Upload transpiled JS files.'
36-
default_author: github_actions
37-
pull: '-v'
38-
39-
format-check:
40-
name: 'Format Check'
41-
runs-on: ubuntu-latest
42-
43-
steps:
44-
- name: Checkout
45-
uses: actions/checkout@v3
46-
47-
- name: npm install
48-
run: npm install
49-
50-
- name: Build tools
51-
run: npm run tools
52-
5330
- name: Format Check
5431
run: node ./tools/index.js
5532
env:
@@ -60,6 +37,6 @@ jobs:
6037
uses: EndBug/add-and-commit@v9
6138
with:
6239
add: ./scripts
63-
message: 'Upload generated README files.'
40+
message: 'Upload generated files.'
6441
default_author: github_actions
6542
pull: '-v'

legacyPackages.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,15 @@
22
"packages": [
33
"chat-rank",
44
"chest-lock",
5-
"command-types",
65
"dimension-entities",
76
"dimensions",
87
"get-scores",
98
"is-host",
109
"is-operator",
1110
"lz-string",
12-
"minecraft-language",
13-
"player-extra",
14-
"player-velocity-fix",
1511
"remove-permission",
1612
"run-command-async",
1713
"set-permission",
18-
"shopui",
19-
"timers"
14+
"shopui"
2015
]
2116
}

scripts/command-types/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Script example for ScriptAPI
2+
// Author: bot174 <https://github.com/bot174>
3+
// Project: https://github.com/JaylyDev/ScriptAPI
14
export * from './blocks';
25
export * from './endpoints';
36
export * from './enums';

scripts/minecraft-language/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Script example for ScriptAPI
2+
// Author: bot174 <https://github.com/bot174>
3+
// Project: https://github.com/JaylyDev/ScriptAPI
14
import { RawMessage } from "@minecraft/server";
25
export type langKey =
36
| "accessibility.disableTTS"

scripts/player-extra/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Script example for ScriptAPI
2+
// Author: Jayly <https://github.com/JaylyDev>
3+
// Project: https://github.com/JaylyDev/ScriptAPI
14
import * as mc from "@minecraft/server";
25
import { getGamemode } from "get-gamemode/index";
36
import { ActionFormData, MessageFormData, ModalFormData} from "@minecraft/server-ui";

scripts/player-velocity-fix/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
// Script example for ScriptAPi
2+
// Author: Jayly <https://github.com/JaylyDev>
3+
// Project: https://github.com/JaylyDev/GametestDB/
14
/**
25
* @license MIT
36
* @author JaylyMC
47
* @project https://github.com/JaylyDev/GametestDB/
58
*/
69
import { Vector3, Player, MinecraftEntityTypes, Entity, EntityRideableComponent, EntityMovementComponent, EntityHealthComponent, MinecraftEffectTypes } from "@minecraft/server";
710
import { Commands } from "../commands/index.js";
8-
import { clearInterval, setInterval } from "../timers/timers.js";
11+
import { clearInterval, setInterval } from "../timers/index.js";
912

1013
function trunc (x: number, decimal: number): number {
1114
let y = 10 ** decimal;
File renamed without changes.

scripts/run-command/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# run-command
2+
3+
## Description
4+
5+
6+
## Credits
7+
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
interface BlockPropertiesRoute {
2+
brushed_progress: 0 | 1 | 2 | 3;
3+
books_stored: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63;
4+
propagule_stage: 0 | 1 | 2 | 3 | 4;
5+
can_summon: false | true;
6+
bloom: false | true;
7+
active: false | true;
8+
item_frame_photo_bit: false | true;
9+
candles: 0 | 1 | 2 | 3;
10+
lit: false | true;
11+
multi_face_direction_bits: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63;
12+
big_dripleaf_head: false | true;
13+
big_dripleaf_tilt: "none" | "unstable" | "partial_tilt" | "full_tilt";
14+
growing_plant_age: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25;
15+
dripstone_thickness: "tip" | "frustum" | "middle" | "base" | "merge";
16+
respawn_anchor_charge: 0 | 1 | 2 | 3 | 4;
17+
twisting_vines_age: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25;
18+
rotation: 0 | 1 | 2 | 3;
19+
wall_connection_type_west: "none" | "short" | "tall";
20+
wall_connection_type_south: "none" | "short" | "tall";
21+
wall_connection_type_east: "none" | "short" | "tall";
22+
wall_connection_type_north: "none" | "short" | "tall";
23+
wall_post_bit: false | true;
24+
weeping_vines_age: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25;
25+
honey_level: 0 | 1 | 2 | 3 | 4 | 5;
26+
block_light_level: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
27+
pillar_axis: "y" | "x" | "z";
28+
lever_direction: "down_east_west" | "east" | "west" | "south" | "north" | "up_north_south" | "up_east_west" | "down_north_south";
29+
coral_fan_direction: 0 | 1;
30+
composter_fill_level: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
31+
extinguished: false | true;
32+
structure_block_type: "data" | "save" | "load" | "corner" | "invalid" | "export";
33+
structure_void_type: "void" | "air";
34+
attachment: "standing" | "hanging" | "side" | "multiple";
35+
coral_hang_type_bit: false | true;
36+
stripped_bit: false | true;
37+
hanging: false | true;
38+
cauldron_liquid: "water" | "lava" | "powder_snow";
39+
coral_color: "blue" | "pink" | "purple" | "red" | "yellow";
40+
sea_grass_type: "default" | "double_top" | "double_bot";
41+
chemistry_table_type: "compound_creator" | "material_reducer" | "element_constructor" | "lab_table";
42+
double_plant_type: "sunflower" | "syringa" | "grass" | "fern" | "rose" | "paeonia";
43+
prismarine_block_type: "default" | "dark" | "bricks";
44+
wall_block_type: "cobblestone" | "mossy_cobblestone" | "granite" | "diorite" | "andesite" | "sandstone" | "brick" | "stone_brick" | "mossy_stone_brick" | "nether_brick" | "end_brick" | "prismarine" | "red_sandstone" | "red_nether_brick";
45+
huge_mushroom_bits: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
46+
stone_brick_type: "default" | "mossy" | "cracked" | "chiseled" | "smooth";
47+
monster_egg_stone_type: "stone" | "cobblestone" | "stone_brick" | "mossy_stone_brick" | "cracked_stone_brick" | "chiseled_stone_brick";
48+
stone_slab_type_4: "mossy_stone_brick" | "smooth_quartz" | "stone" | "cut_sandstone" | "cut_red_sandstone";
49+
stone_slab_type_3: "end_stone_brick" | "smooth_red_sandstone" | "polished_andesite" | "andesite" | "diorite" | "polished_diorite" | "granite" | "polished_granite";
50+
stone_slab_type_2: "red_sandstone" | "purpur" | "prismarine_rough" | "prismarine_dark" | "prismarine_brick" | "mossy_cobblestone" | "smooth_sandstone" | "red_nether_brick";
51+
stone_slab_type: "smooth_stone" | "sandstone" | "wood" | "cobblestone" | "brick" | "stone_brick" | "quartz" | "nether_brick";
52+
flower_type: "poppy" | "orchid" | "allium" | "houstonia" | "tulip_red" | "tulip_orange" | "tulip_white" | "tulip_pink" | "oxeye" | "cornflower" | "lily_of_the_valley";
53+
tall_grass_type: "default" | "tall" | "fern" | "snow";
54+
sand_stone_type: "default" | "heiroglyphs" | "cut" | "smooth";
55+
sponge_type: "dry" | "wet";
56+
new_leaf_type: "acacia" | "dark_oak";
57+
old_leaf_type: "oak" | "spruce" | "birch" | "jungle";
58+
deprecated: 0 | 1 | 2 | 3;
59+
chisel_type: "default" | "chiseled" | "lines" | "smooth";
60+
new_log_type: "acacia" | "dark_oak";
61+
old_log_type: "oak" | "spruce" | "birch" | "jungle";
62+
sand_type: "normal" | "red";
63+
dirt_type: "normal" | "coarse";
64+
stone_type: "stone" | "granite" | "granite_smooth" | "diorite" | "diorite_smooth" | "andesite" | "andesite_smooth";
65+
wood_type: "oak" | "spruce" | "birch" | "jungle" | "acacia" | "dark_oak";
66+
stability_check: false | true;
67+
stability: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
68+
bamboo_leaf_size: "no_leaves" | "small_leaves" | "large_leaves";
69+
bamboo_stalk_thickness: "thin" | "thick";
70+
color: "white" | "orange" | "magenta" | "light_blue" | "yellow" | "lime" | "pink" | "gray" | "silver" | "cyan" | "purple" | "blue" | "brown" | "green" | "red" | "black";
71+
coral_direction: 0 | 1 | 2 | 3;
72+
weirdo_direction: 0 | 1 | 2 | 3;
73+
ground_sign_direction: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
74+
cracked_state: "no_cracks" | "cracked" | "max_cracked";
75+
turtle_egg_count: "one_egg" | "two_egg" | "three_egg" | "four_egg";
76+
drag_down: false | true;
77+
torch_facing_direction: "unknown" | "west" | "east" | "north" | "south" | "top";
78+
sapling_type: "oak" | "spruce" | "birch" | "jungle" | "acacia" | "dark_oak";
79+
item_frame_map_bit: false | true;
80+
cluster_count: 0 | 1 | 2 | 3;
81+
dead_bit: false | true;
82+
color_bit: false | true;
83+
allow_underwater_bit: false | true;
84+
vine_direction_bits: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
85+
upside_down_bit: false | true;
86+
update_bit: false | true;
87+
triggered_bit: false | true;
88+
top_slot_bit: false | true;
89+
toggle_bit: false | true;
90+
suspended_bit: false | true;
91+
repeater_delay: 0 | 1 | 2 | 3;
92+
redstone_signal: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
93+
rail_direction: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
94+
rail_data_bit: false | true;
95+
powered_bit: false | true;
96+
persistent_bit: false | true;
97+
output_lit_bit: false | true;
98+
output_subtract_bit: false | true;
99+
open_bit: false | true;
100+
occupied_bit: false | true;
101+
kelp_age: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25;
102+
no_drop_bit: false | true;
103+
moisturized_amount: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
104+
liquid_depth: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
105+
in_wall_bit: false | true;
106+
infiniburn_bit: false | true;
107+
height: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
108+
head_piece_bit: false | true;
109+
growth: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
110+
fill_level: 0 | 1 | 2 | 3 | 4 | 5 | 6;
111+
facing_direction: 0 | 1 | 2 | 3 | 4 | 5;
112+
explode_bit: false | true;
113+
end_portal_eye_bit: false | true;
114+
direction: 0 | 1 | 2 | 3;
115+
upper_block_bit: false | true;
116+
door_hinge_bit: false | true;
117+
disarmed_bit: false | true;
118+
damage: "undamaged" | "slightly_damaged" | "very_damaged" | "broken";
119+
covered_bit: false | true;
120+
conditional_bit: false | true;
121+
button_pressed_bit: false | true;
122+
brewing_stand_slot_c_bit: false | true;
123+
brewing_stand_slot_b_bit: false | true;
124+
brewing_stand_slot_a_bit: false | true;
125+
bite_counter: 0 | 1 | 2 | 3 | 4 | 5 | 6;
126+
portal_axis: "unknown" | "x" | "z";
127+
attached_bit: false | true;
128+
age: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
129+
age_bit: false | true;
130+
}
131+
132+
export type BlockProperties = Partial<BlockPropertiesRoute>;

scripts/run-command/index.ts

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// Script example for ScriptAPI
2+
// Author: Jayly <https://github.com/JaylyDev>
3+
// Project: https://github.com/JaylyDev/ScriptAPI
4+
import { BlockType, Dimension, Entity, GameMode, Player, Vector3, world } from "@minecraft/server";
5+
import { CameraShakeType, CloneMode, Difficulty, MaskMode } from "command-types/enums";
6+
import { BlockProperties } from "./blockProperties";
7+
8+
export type Target = Entity | Dimension;
9+
export type BlockState = `${string}=${string}`;
10+
11+
export function displayHelp (target: Target, page = 0, command?: string) {
12+
if (!!command) return target.runCommand('help ' + command);
13+
else return target.runCommand('help ' + page);
14+
};
15+
16+
export class CameraShake {
17+
/**
18+
* Applies shaking to the players' camera with a specified intensity and duration.
19+
* @param player
20+
* @param intensity
21+
* @param seconds
22+
* @param shakeType
23+
* @returns
24+
*/
25+
applyShake (player: Player, intensity: number, seconds: number, shakeType: CameraShakeType) {
26+
return player.runCommand(`camerashake add @s ${intensity} ${seconds} ${shakeType}`);
27+
};
28+
stop (player: Player) {
29+
return player.runCommand(`camerashake stop @s`);
30+
};
31+
};
32+
33+
/**
34+
* Clones blocks from one region to another.
35+
*/
36+
export class Clone {
37+
basic(begin: Vector3, end: Vector3, destination: Vector3, dimension: Dimension) {
38+
return dimension.runCommand(`clone ${begin.x} ${begin.y} ${begin.z} ${end.x} ${end.y} ${end.z} ${destination.x} ${destination.y} ${destination.z}`);
39+
};
40+
masked(begin: Vector3, end: Vector3, destination: Vector3, dimension: Dimension, maskMode: MaskMode, cloneMode: CloneMode) {
41+
return dimension.runCommand(`clone ${begin.x} ${begin.y} ${begin.z} ${end.x} ${end.y} ${end.z} ${destination.x} ${destination.y} ${destination.z} ${maskMode} ${cloneMode}`);
42+
};
43+
filtered(begin: Vector3, end: Vector3, destination: Vector3, dimension: Dimension, cloneMode: CloneMode, blockType: BlockType, properties: BlockProperties) {
44+
const blockStates: BlockState[] = Object.keys(properties).map(key => `${key}=${properties[key]}` as BlockState);
45+
return dimension.runCommand(`clone ${begin.x} ${begin.y} ${begin.z} ${end.x} ${end.y} ${end.z} ${destination.x} ${destination.y} ${destination.z} filtered ${cloneMode} ${blockType.id}[${blockStates.toString()}]`);
46+
};
47+
};
48+
49+
/**
50+
* Locks and unlocks the day-night cycle.
51+
*/
52+
export function dayLock (lock: boolean) {
53+
return world.getDimension('overworld').runCommand('daylock ' + lock);
54+
};
55+
56+
/**
57+
* Opens NPC dialogue for a player.
58+
*/
59+
export class Dialogue {
60+
open(npc: Entity, player: Player, sceneName: string) {
61+
return npc.runCommand(`dialogue open @s "${player.name}" ${sceneName}`)
62+
};
63+
change(npc: Entity, player: Player, sceneName: string) {
64+
return npc.runCommand(`dialogue change @s "${player.name}" ${sceneName}`)
65+
};
66+
};
67+
68+
export function setDifficulty (difficulty: Difficulty) {
69+
return world.getDimension('overworld').runCommand('difficulty ' + difficulty);
70+
}
71+
72+
/**
73+
* Add or remove fog settings file.
74+
*/
75+
export class Fog {
76+
add(player: Player, fogId: string) {
77+
player.runCommand(`fog @s add ${fogId}`);
78+
};
79+
remove(player: Player, fogId: string) {
80+
player.runCommand(`fog @s delete ${fogId}`);
81+
};
82+
};
83+
84+
/**
85+
* Runs commands found in the corresponding function file.
86+
* @param path
87+
*/
88+
export function runMCFunction(path: string, target: Target) {
89+
target.runCommand('function ' + path);
90+
};
91+
92+
/**
93+
* Sets a player's game mode.
94+
* @param player
95+
*/
96+
export function setGameMode(player: Player, gameMode: GameMode) {
97+
player.runCommand("gamemode " + gameMode)
98+
}
99+
100+
/**
101+
* Sets or queries a game rule value.
102+
* @param gameRule
103+
* @param value
104+
*/
105+
export function setGameRule(gameRule: string, value: number | boolean) {
106+
world.getDimension("overworld").runCommand(`gamerule ${gameRule} ${value}`)
107+
};

0 commit comments

Comments
 (0)