physic addons
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- javascript
- Domain
- game-dev
Research direction
Start with the proposed scripts/main.js entry point and the manifest dependency on @minecraft/server. Clarify which of the block-break particles, item impulses, and death impulses are intended, then verify the relevant event and entity APIs against the stated Minecraft version. Done should be defined as the selected physics effects working in-game without errors.
Written by the indexing model from the issue text.
Description
import { world, system } from "@minecraft/server";
// Lắng nghe sự kiện phá khối của người chơi
world.afterEvents.playerBreakBlock.subscribe((event) => {
const dimension = event.dimension;
const block = event.block;
const brokenBlockPermutation = event.brokenBlockPermutation;
const loc = block.location;
// Tọa độ tâm khối bị phá
const centerX = loc.x + 0.5;
const centerY = loc.y + 0.5;
const centerZ = loc.z + 0.5;
// 1. TẠO HIỆU ỨNG MẢNH VỠ 3D (BLOCK FRACTURE PARTICLES)
// Dùng hệ thống Particle có sẵn của Bedrock để mô phỏng mảnh vỡ vật lý văng ra
for (let i = 0; i < 12; i++) {
// Tạo vận tốc ngẫu nhiên văng ra mọi hướng
const offsetX = (Math.random() - 0.5) * 0.6;
const offsetY = (Math.random() - 0.5) * 0.6;
const offsetZ = (Math.random() - 0.5) * 0.6;
try {
// Bắn các hạt mảnh vỡ tương ứng với loại khối vừa đập
dimension.spawnParticle(
"minecraft:block_destruct",
{ x: centerX + offsetX, y: centerY + offsetY, z: centerZ + offsetZ },
brokenBlockPermutation
);
} catch (e) {}
}
// 2. VẬT LÝ VĂNG ITEM (Physics Item Drop)
// Làm cho vật phẩm rớt ra văng ngẫu nhiên giống Java Physics Mod
system.run(() => {
// Tìm các item entity vừa xuất hiện gần đó
const nearbyEntities = dimension.getEntities({
location: { x: centerX, y: centerY, z: centerZ },
maxDistance: 1.5,
type: "minecraft:item"
});
for (const itemEntity of nearbyEntities) {
// Áp dụng lực văng (Impulse) ngẫu nhiên cho Item
const forceX = (Math.random() - 0.5) * 0.25;
const forceY = Math.random() * 0.2 + 0.15; // Đẩy nảy nhẹ lên trên
const forceZ = (Math.random() - 0.5) * 0.25;
try {
itemEntity.applyImpulse({ x: forceX, y: forceY, z: forceZ });
} catch (e) {}
}
});
});
// ==========================================================
// 3. VẬT LÝ QUÁI VĂNG KHI CHẾT (Mob Ragdoll Knockback Impulse)
// ==========================================================
world.afterEvents.entityDie.subscribe((event) => {
const deadEntity = event.deadEntity;
const damageSource = event.damageSource;
// Nếu quái chết do người chơi hoặc vụ nổ
if (deadEntity && damageSource.damagingEntity) {
const attacker = damageSource.damagingEntity;
const loc = deadEntity.location;
// Tính hướng văng từ người tấn công đến quái
const dx = loc.x - attacker.location.x;
const dz = loc.z - attacker.location.z;
const distance = Math.sqrt(dx * dx + dz * dz) || 1;
// Tạo lực đẩy nảy xác quái ra xa (Mô phỏng Ragdoll)
const pushX = (dx / distance) * 0.6;
const pushZ = (dz / distance) * 0.6;
try {
deadEntity.applyImpulse({ x: pushX, y: 0.35, z: pushZ });
} catch (e) {}
}
});
{
"format_version": 2,
"header": {
"name": "Java-Style Physics Addon",
"description": "Mo phong hieu ung vat ly Java Physics Mod cho Bedrock",
"uuid": "7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
"version": [1, 0, 0],
"min_engine_version": [1, 20, 50]
},
"modules": [
{
"type": "script",
"language": "javascript",
"uuid": "8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e",
"version": [1, 0, 0],
"entry": "scripts/main.js"
}
],
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.9.0"
}
]
}
- 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 3/5 1-2 days Newbie friendliness 45/100
microsoft/minecraft-samples#160 ·
-
@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 78/100
prime-radiant-inc/evener#3726 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
FuRongJun-1999/dsh-memory#56 ·
Maintainers usually reply within 1 day
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
pingdotgg/t3code#15682 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openwatersio/slackwater.xyz#152 ·
Maintainers usually reply within 1 day
-
[BUG] 请修改标题为您遇到的问题Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
OpenListTeam/OpenList-Worker#103 ·
Maintainers usually reply within 1 day