Skip to content

Commit

Permalink
允许不计算烟花实体的伤害,以增加性能
Browse files Browse the repository at this point in the history
  • Loading branch information
boybook committed Dec 14, 2023
1 parent c914b45 commit 1b78654
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/cn/nukkit/entity/item/EntityFirework.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import cn.nukkit.nbt.tag.ListTag;
import cn.nukkit.network.protocol.EntityEventPacket;
import cn.nukkit.network.protocol.LevelSoundEventPacket;
import lombok.Setter;

import javax.annotation.Nullable;
import java.util.Random;
Expand All @@ -41,6 +42,8 @@ public class EntityFirework extends Entity {
private Item firework;
@Nullable
private Entity attached;
@Setter
private boolean calculateAttack = true;

public EntityFirework(FullChunk chunk, CompoundTag nbt) {
this(chunk, nbt, false);
Expand Down Expand Up @@ -132,7 +135,7 @@ public boolean onUpdate(int currentTick) {
pk.eid = this.getId();
Server.broadcastPacket(getViewers().values(), pk);

if (firework instanceof ItemFirework) {
if (calculateAttack && firework instanceof ItemFirework) {
ItemFirework firework = (ItemFirework) this.firework;
CompoundTag nbt = firework.getNamedTag();
if (nbt != null) {
Expand Down

0 comments on commit 1b78654

Please sign in to comment.