32 lines
2.0 KiB
Diff
32 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrHua269 <novau233@163.com>
|
|
Date: Sat, 6 Apr 2024 05:14:57 +0000
|
|
Subject: [PATCH] Gale Reduce lambda and Optional allocation in
|
|
EntityBasedExplosionDamageCalculator
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
|
index 3527f1621ef9b4f3f8d8bbb93379f13ff141c3be..4e4dfb72d5a0b46917999b709c655ccfdae27183 100644
|
|
--- a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
|
+++ b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
|
@@ -15,8 +15,17 @@ public class EntityBasedExplosionDamageCalculator extends ExplosionDamageCalcula
|
|
|
|
@Override
|
|
public Optional<Float> getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState) {
|
|
- return super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState)
|
|
- .map(max -> this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, max));
|
|
+ // Gale start - Lithium - reduce lambda and Optional allocation in EntityBasedExplosionDamageCalculator
|
|
+ Optional<Float> optionalBlastResistance = super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState);
|
|
+ if (optionalBlastResistance.isPresent()) {
|
|
+ float blastResistance = optionalBlastResistance.get();
|
|
+ float effectiveExplosionResistance = this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, blastResistance);
|
|
+ if (effectiveExplosionResistance != blastResistance) {
|
|
+ return Optional.of(effectiveExplosionResistance);
|
|
+ }
|
|
+ }
|
|
+ return optionalBlastResistance;
|
|
+ // Gale end - Lithium - reduce lambda and Optional allocation in EntityBasedExplosionDamageCalculator
|
|
}
|
|
|
|
@Override
|