From 67ba0df80d87bd0b1a150c4b68e4cd5035bb7c7e Mon Sep 17 00:00:00 2001 From: Keyyard <84187238+Keyyard@users.noreply.github.com> Date: Sun, 18 Jul 2021 02:16:14 +0700 Subject: [PATCH 1/4] damage sensor a damage sensor topic with all the damage sources and how to use them. --- docs/documentation/Damage Sensor.md | 248 ++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 docs/documentation/Damage Sensor.md diff --git a/docs/documentation/Damage Sensor.md b/docs/documentation/Damage Sensor.md new file mode 100644 index 00000000000..480c1f2f883 --- /dev/null +++ b/docs/documentation/Damage Sensor.md @@ -0,0 +1,248 @@ +# minecraft:damage_sensor +minecraft:damage_sensor defines what events to call when this entity is damaged by specific entities or items. + +## Parameters +Name | Default Value | Type| Description +------- | ---------------- | ---------- | ---------: +List| triggers | | List of triggers with the events to call when taking specific kinds of damage. +## triggers + + + + + + + + + + + + + + + + + + + + + + +
NameDefault ValueTypeDescription
causenoneStringType of damage that triggers the events.
damage_modifier0.0DecimalA modifier that adds to/removes from the base damage from the damage cause. It does not reduce damage to less than 0.
+ +## on_damage + + + + + + + + + + + + + + + + + + + + + + + +
on_damage
NameDefault ValueTypeDescription
filtersnot setMinecraft Filterfilters to use to define specific tests
eventnot setStringDefines what event to run
+ +## Examples +### Goat + +``` +"minecraft:damage_sensor": { + "triggers": { + "cause": "fall", + "deals_damage": true, + "damage_modifier": -20 + } +} +``` +### Pillagers + +``` +"minecraft:damage_sensor": { + "triggers": { + "on_damage": { + "filters": { + "all_of": [ + { + "test": "has_damage", + "value": "fatal" + }, + { + "test": "is_family", + "subject": "other", + "value": "player" + } + ] + }, + "event": "minecraft:gain_bad_omen", + "target": "other" + } + } +} +``` + +### Custom Damage Sensor to trigger event (like slapper for example) +``` + "minecraft:damage_sensor": { + "triggers": [ + { + "on_damage": { + "filters":{ + "all_of": [ + { + "test": "is_family", + "subject": "other", + "operator": "==", + "value": "player" + }, + { + "test": "has_tag", + "operator": "==", + "subject": "other", + "value": "example" + } + ] + }, + "event": "event:example" + }, + "deals_damage": false + }, + { + "on_damage": { + "filters":{ + "all_of": [ + { + "test": "is_family", + "subject": "other", + "value": "player" + } + ] + } + }, + "deals_damage": false + }, + { + "on_damage": { + "filters": { + "test": "is_family", + "subject": "other", + "value": "example2" + }, + "event": "event:example2" + }, + "deals_damage": false + } + ] + } +``` +## All Damage Sources + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Damage Source
all
anvil
block_explosion
charging
contact
drowning
entity_attack
entity_explosion
fall
falling_block
fire
fire_tick
fireworks
fly_into_wall
freezing
lava
lightning
magic
magma
none
override
piston
projectile
stalactite
stalagmite
starve
suffocation
suicide
temperature
thorns
void
wither
\ No newline at end of file From f691e5ba6fb159ca2f73e86a745adac8e35afaa0 Mon Sep 17 00:00:00 2001 From: Keyyard Date: Sun, 13 Apr 2025 00:56:35 +0700 Subject: [PATCH 2/4] Added ``npx creaete-mc-bedrock`` --- docs/meta/useful-links.md | 1 + docs/scripting/scripting-intro.md | 37 ++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/docs/meta/useful-links.md b/docs/meta/useful-links.md index f0e00ae104f..da9f64ca348 100644 --- a/docs/meta/useful-links.md +++ b/docs/meta/useful-links.md @@ -129,6 +129,7 @@ These packs are published by the open-source community. - [GameTests API Wrapper](https://github.com/notbeer/Framework-Wrapper) - [GameTests Plugin-API-Starter-Pack](https://github.com/MajestikButter/Plugin-API-Starter-Pack) - [Useful for Block Tags](https://mcpedl.com/debug-stick/) +- [create-mc-bedrock CLI](https://github.com/Keyyard/create-mc-bedrock-cli) ## Raytracing Resources diff --git a/docs/scripting/scripting-intro.md b/docs/scripting/scripting-intro.md index e2d2aa0941d..397f48a81c5 100644 --- a/docs/scripting/scripting-intro.md +++ b/docs/scripting/scripting-intro.md @@ -11,6 +11,7 @@ mentions: - SimpleDevMCBE - QuazChick - jeanmajid + - Keyyard description: Learn how to modify your world through the use of JavaScript files. --- @@ -28,7 +29,7 @@ The Script API (formerly GameTest Framework) is a feature that allows for a new This page will give you an introduction to the 80% of Minecraft's Creator API concepts that you will use on a daily basis. -## Create Your First Project +## Create Your First Project Manually Currently, scripts can only be used in behavior packs. @@ -176,6 +177,34 @@ system.runInterval(() => { }, 1); ``` + +## Using `create-mc-bedrock` to Set Up a Workspace Automatically +`create-mc-bedrock` is a simple interactive CLI tool to help you quickly set up Minecraft Bedrock projects by cloning samples from the [Microsoft Minecraft Scripting Samples](https://github.com/Microsoft/Minecraft-Scripting-Samples) repository. + +This tool is recommended for experienced developers to quickly set up a project with a compiler. Generated templates usually come with a compiler and a build system, so you can start coding right away. Works with both JavaScript and TypeScript. + +It requires Node.js and npm to be installed on your system. + +#### Steps: + +1. Open a terminal and run the following command: + ```bash + npx create-mc-bedrock + ``` +2. Follow the prompts to select a template for your project. +3. Once the setup is complete, navigate into the generated folder: + ```bash + cd + ``` +4. Install the dependencies: + ```bash + npm install + ``` +5. Start working with the provided template workspace, which includes Microsoft's official setup for Bedrock scripting. +- ``npm run local-deploy``: This command will build the project and deploy into your local Minecraft. You should see your package in Minecraft now. +- ``npm run mcaddon``: This command will build the project into mcaddon files in the `dist` folder. +- you can discover more commands in the `package.json` file. + ## Reference Documentation Official documentation are hosted on Microsoft Learn and can be found here: @@ -215,3 +244,9 @@ Latest stable API modules: npm i @minecraft/server npm i @minecraft/server-ui ``` + +Official Microsoft Minecraft Scripting Samples: +- [Minecraft Scripting Samples](https://github.com/Microsoft/Minecraft-Scripting-Samples) + +Community-based CLI tools: +- [`create-mc-bedrock` CLI](https://github.com/Keyyard/create-mc-bedrock-cli). \ No newline at end of file From a950a48674c82ef990ed9bce61ca37b7bc8b7e60 Mon Sep 17 00:00:00 2001 From: Keyyard Date: Sun, 13 Apr 2025 01:02:00 +0700 Subject: [PATCH 3/4] npx create-mc-bedrock --- docs/meta/useful-links.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/meta/useful-links.md b/docs/meta/useful-links.md index da9f64ca348..b162dbf6338 100644 --- a/docs/meta/useful-links.md +++ b/docs/meta/useful-links.md @@ -16,6 +16,7 @@ mentions: - JaylyDev - zheaEvyline - phoenixr-codes + - Keyyard description: Useful links for developing add-ons. --- From 54d101770f6ad6f0344dc1f65c201fe51dacfda5 Mon Sep 17 00:00:00 2001 From: Keyyard <84187238+Keyyard@users.noreply.github.com> Date: Sun, 13 Apr 2025 02:23:59 +0700 Subject: [PATCH 4/4] Delete docs/documentation/Damage Sensor.md --- docs/documentation/Damage Sensor.md | 248 ---------------------------- 1 file changed, 248 deletions(-) delete mode 100644 docs/documentation/Damage Sensor.md diff --git a/docs/documentation/Damage Sensor.md b/docs/documentation/Damage Sensor.md deleted file mode 100644 index 480c1f2f883..00000000000 --- a/docs/documentation/Damage Sensor.md +++ /dev/null @@ -1,248 +0,0 @@ -# minecraft:damage_sensor -minecraft:damage_sensor defines what events to call when this entity is damaged by specific entities or items. - -## Parameters -Name | Default Value | Type| Description -------- | ---------------- | ---------- | ---------: -List| triggers | | List of triggers with the events to call when taking specific kinds of damage. -## triggers - - - - - - - - - - - - - - - - - - - - - - -
NameDefault ValueTypeDescription
causenoneStringType of damage that triggers the events.
damage_modifier0.0DecimalA modifier that adds to/removes from the base damage from the damage cause. It does not reduce damage to less than 0.
- -## on_damage - - - - - - - - - - - - - - - - - - - - - - - -
on_damage
NameDefault ValueTypeDescription
filtersnot setMinecraft Filterfilters to use to define specific tests
eventnot setStringDefines what event to run
- -## Examples -### Goat - -``` -"minecraft:damage_sensor": { - "triggers": { - "cause": "fall", - "deals_damage": true, - "damage_modifier": -20 - } -} -``` -### Pillagers - -``` -"minecraft:damage_sensor": { - "triggers": { - "on_damage": { - "filters": { - "all_of": [ - { - "test": "has_damage", - "value": "fatal" - }, - { - "test": "is_family", - "subject": "other", - "value": "player" - } - ] - }, - "event": "minecraft:gain_bad_omen", - "target": "other" - } - } -} -``` - -### Custom Damage Sensor to trigger event (like slapper for example) -``` - "minecraft:damage_sensor": { - "triggers": [ - { - "on_damage": { - "filters":{ - "all_of": [ - { - "test": "is_family", - "subject": "other", - "operator": "==", - "value": "player" - }, - { - "test": "has_tag", - "operator": "==", - "subject": "other", - "value": "example" - } - ] - }, - "event": "event:example" - }, - "deals_damage": false - }, - { - "on_damage": { - "filters":{ - "all_of": [ - { - "test": "is_family", - "subject": "other", - "value": "player" - } - ] - } - }, - "deals_damage": false - }, - { - "on_damage": { - "filters": { - "test": "is_family", - "subject": "other", - "value": "example2" - }, - "event": "event:example2" - }, - "deals_damage": false - } - ] - } -``` -## All Damage Sources - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Damage Source
all
anvil
block_explosion
charging
contact
drowning
entity_attack
entity_explosion
fall
falling_block
fire
fire_tick
fireworks
fly_into_wall
freezing
lava
lightning
magic
magma
none
override
piston
projectile
stalactite
stalagmite
starve
suffocation
suicide
temperature
thorns
void
wither
\ No newline at end of file