physic addons
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 活跃
- 技术栈
- javascript
- 领域
- game-dev
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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
});
}
- 主要语言
- TypeScript
- 星标
- 433
- 派生
- 247
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/minecraft-samples 的其他 Issue
-
physic addons未关闭
难度 4/5 3-5 天 新手友好度 35/100
microsoft/minecraft-samples#161 · 1 条评论 ·
-
@Hy893513#未关闭
难度 5/5 一周以上 新手友好度 1/100
microsoft/minecraft-samples#146 ·
-
难度 2/5 1-3 小时 新手友好度 45/100
microsoft/minecraft-samples#131 · 1 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 5/100
microsoft/minecraft-samples#129 ·
-
Sign in未关闭
难度 5/5 一周以上 新手友好度 10/100
microsoft/minecraft-samples#127 ·
查看 microsoft/minecraft-samples 的全部 Issue
相似的 Issue
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 75/100
lingdojo/kana-dojo#32018 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
paperclipai/paperclip#15751 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
BuilderIO/agent-native#7275 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复