Files
MiraiMC/patches/server/0035-Tweak-Explosions.patch
2022-02-14 17:37:45 +01:00

47 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Jun 2018 22:35:39 -0400
Subject: [PATCH] Tweak Explosions
Original code by Starlis, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/starlis/empirecraft
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index e0e27004d67fd759903645cff8a491e5516aeea8..354d6aa1fdead781ff7ff4c5e7fa261181ce754d 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -156,6 +156,7 @@ public class Explosion {
int i;
int j;
+ if (this.fire || this.blockInteraction != BlockInteraction.NONE) { // EMC - don't run block processing if neither flag is set
for (int k = 0; k < 16; ++k) {
for (i = 0; i < 16; ++i) {
for (j = 0; j < 16; ++j) {
@@ -210,6 +211,7 @@ public class Explosion {
}
}
}
+ } // EMC
this.toBlow.addAll(set);
float f2 = this.radius * 2.0F;
@@ -220,7 +222,7 @@ public class Explosion {
int i1 = Mth.floor(this.y + (double) f2 + 1.0D);
int j1 = Mth.floor(this.z - (double) f2 - 1.0D);
int k1 = Mth.floor(this.z + (double) f2 + 1.0D);
- List<Entity> list = this.level.getEntities(this.source, new AABB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator()); // Paper - Fix lag from explosions processing dead entities
+ List<Entity> list = this.level.getEntities(this.source, new AABB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator() && !(entity instanceof ItemEntity)); // Paper - Fix lag from explosions processing dead entitiess // EMC - exclude item entities
Vec3 vec3d = new Vec3(this.x, this.y, this.z);
for (int l1 = 0; l1 < list.size(); ++l1) {
@@ -300,7 +302,7 @@ public class Explosion {
boolean flag1 = this.blockInteraction != Explosion.BlockInteraction.NONE;
if (particles) {
- if (this.radius >= 2.0F && flag1) {
+ if (this.radius >= 2.0F /*&& flag1*/) { // EMC - don't care about block breaks flag for animation
this.level.addParticle(ParticleTypes.EXPLOSION_EMITTER, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);
} else {
this.level.addParticle(ParticleTypes.EXPLOSION, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D);