physic addons
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- javascript
- Domain
- game-dev
Research direction
Start with physics_addon_bp/manifest.json to confirm the Bedrock add-on configuration, then read scripts/index.js and verify the entry point and Minecraft API usage. Test the add-on in Minecraft Bedrock with supported log types; done means the sample is integrated and its described tree-breaking behavior works without errors.
Written by the indexing model from the issue text.
Description
physics_addon_bp/
├── manifest.json
└── scripts/
└── index.js
{
"format_version": 2,
"header": {
"name": "Physics Addon",
"description": "Thêm hiệu ứng vật lý chân thực cho Minecraft!",
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"version": [1, 0, 0],
"min_engine_version": [1, 20, 50]
},
"modules": [
{
"type": "script",
"language": "javascript",
"uuid": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"version": [1, 0, 0],
"entry": "scripts/index.js"
}
],
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.9.0"
}
]
}
import { world, system, BlockPermutation } from "@minecraft/server";
// Danh sách các loại gỗ hỗ trợ
const LOG_BLOCKS = [
"minecraft:oak_log",
"minecraft:spruce_log",
"minecraft:birch_log",
"minecraft:jungle_log",
"minecraft:acacia_log",
"minecraft:dark_oak_log",
"minecraft:mangrove_log",
"minecraft:cherry_log"
];
// Lắng nghe sự kiện người chơi phá khối
world.beforeEvents.playerBreakBlock.subscribe((event) => {
const block = event.block;
const dimension = event.dimension;
// Kiểm tra xem khối bị phá có phải gỗ không
if (LOG_BLOCKS.includes(block.typeId)) {
// Chạy thuật toán rơi vật lý sau 1 tick
system.run(() => {
breakTreePhysics(block.location, dimension);
});
}
});
function breakTreePhysics(startLocation, dimension) {
let currentY = startLocation.y + 1;
const logsToBreak = [];
// Tìm toàn bộ khối gỗ nối tiếp thẳng đứng
while (currentY < startLocation.y + 30) {
const checkLocation = { x: startLocation.x, y: currentY, z: startLocation.z };
const block = dimension.getBlock(checkLocation);
if (block && LOG_BLOCKS.includes(block.typeId)) {
logsToBreak.push({ location: checkLocation, typeId: block.typeId });
currentY++;
} else {
break; // Dừng lại nếu hết khối gỗ
}
}
// Làm rơi từng khối gỗ theo hiệu ứng thời gian
logsToBreak.forEach((logData, index) => {
system.runTimeout(() => {
const block = dimension.getBlock(logData.location);
if (block && LOG_BLOCKS.includes(block.typeId)) {
// Đổi khối thành không khí và thả rơi item
dimension.runCommand(`setblock ${logData.location.x} ${logData.location.y} ${logData.location.z} air destroy`);
}
}, index * 2); // Trễ 2 tick giữa mỗi khối để tạo hiệu ứng rơi mượt
});
}
- Dominant language
- TypeScript
- Stars
- 433
- Forks
- 247
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/minecraft-samples
-
physic addonsOpen
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoft/minecraft-samples#161 · 1 comment ·
-
@Hy893513#Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
microsoft/minecraft-samples#146 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
microsoft/minecraft-samples#131 · 1 comment · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 5/100
microsoft/minecraft-samples#129 ·
-
Sign inOpen
Difficulty 5/5 Over a week Newbie friendliness 10/100
microsoft/minecraft-samples#127 ·
All issues in microsoft/minecraft-samples
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
farbenmeer/tapi#531 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
naver/egjs-flicking#971 ·
-
Renderer treats a sub-pixel width difference as a resize, which cancels the `motion()` entranceOpen
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Tenant
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
MTES-MCT/Dossier-Facile-Frontend#2061 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
backnotprop/plannotator#1784 ·
Maintainers usually reply within 1 day