完整版BedrockWiki镜像!

This commit is contained in:
boybook
2025-03-20 11:52:46 +08:00
parent 1994c41f01
commit bf9aa4b056
214 changed files with 9042 additions and 8867 deletions

View File

@@ -1,21 +1,24 @@
---
title: Disabling Particles
category: Tutorials
title: 禁用粒子效果
category: 巧思案例
tags:
- beginner
- 新手
mentions:
- SirLich
- Joelant05
- MedicalJewel105
---
In the event that you want to disable a particle, it is recommended to do so from the particle file itself as opposed to simply making the particle texture transparent in `particles.png`. Additionally, disabling a particle might offer a slight performance boost compared to making it transparent, as transparent particles are still emitted (but not visible).
# 禁用粒子效果
The basic idea of disabling a particle from emitting is as follows:
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
<CodeHeader>RP/particles/some_vanilla_particle.json</CodeHeader>
当你需要禁用某个粒子效果时,建议直接在粒子文件中进行禁用,而不是简单地在 `particles.png` 中将粒子纹理设为透明。此外,与透明化处理相比,完全禁用粒子可能会带来小幅性能提升,因为透明粒子仍会被发射(只是不可见)。
```json
禁用粒子发射的基本原理如下:
::: code-group
```json [RP/particles/some_vanilla_particle.json]
{
"format_version": "1.10.0",
"particle_effect": {
@@ -28,13 +31,19 @@ The basic idea of disabling a particle from emitting is as follows:
},
"components": {
"minecraft:emitter_lifetime_expression": {
"activation_expression": 0,
"expiration_expression": 1
"activation_expression": 0, // 立即激活
"expiration_expression": 1 // 立即结束生命周期(单位:秒)
},
"minecraft:emitter_rate_manual": {
"max_particles": 0
"max_particles": 0 // 设置最大粒子生成数为0
}
}
}
}
```
:::
**实现原理说明:**
1. 通过 `emitter_lifetime_expression` 组件将粒子发射器的生命周期设为瞬时0秒激活1秒后过期
2. 使用 `emitter_rate_manual` 组件将最大粒子数设为0彻底阻止粒子生成
3. 保留原始渲染参数确保兼容性,但实际不会产生任何可见粒子