Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 02:50:09 +01:00
355b1cbaf6
This intends to give plugin developers more control over explosions created using the World#createExplosion method, specifically by adding the option for explosions to damage the explosion cause (not the default behavior, and previously impossible to do, as far as I know). This is done by overloading existing methods with an extra `excludeSourceFromDamage` parameter. Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
31 Zeilen
1.7 KiB
Diff
31 Zeilen
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sat, 6 Apr 2019 10:16:48 -0400
|
|
Subject: [PATCH] Optimize Captured BlockEntity Lookup
|
|
|
|
upstream was doing a containsKey/get pattern, and always doing it at that.
|
|
that scenario is only even valid if were in the middle of a block place.
|
|
|
|
Optimize to check if the captured list even has values in it, and also to
|
|
just do a get call since the value can never be null.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index e414d417dc9226339f0d6c32406772a2eda92940..ba914a54d549b45bdbede2a9850aab34c3640c59 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -929,9 +929,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
@Nullable
|
|
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {
|
|
- if (this.capturedTileEntities.containsKey(blockposition)) {
|
|
- return this.capturedTileEntities.get(blockposition);
|
|
+ // Paper start - Perf: Optimize capturedTileEntities lookup
|
|
+ net.minecraft.world.level.block.entity.BlockEntity blockEntity;
|
|
+ if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(blockposition)) != null) {
|
|
+ return blockEntity;
|
|
}
|
|
+ // Paper end - Perf: Optimize capturedTileEntities lookup
|
|
// CraftBukkit end
|
|
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE));
|
|
}
|