Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 03:20:07 +01:00
ef0e5a642d
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API 48c0c547 PR-786: Add methods to get sounds from entities CraftBukkit Changes: 5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event 4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation 4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API e5d6a9bbf PR-1100: Add methods to get sounds from entities b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta Spigot Changes: 4c157bb4 Rebuild patches
51 Zeilen
3.3 KiB
Diff
51 Zeilen
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
|
Date: Mon, 27 Apr 2020 02:48:06 -0700
|
|
Subject: [PATCH] Reduce MutableInt allocations from light engine
|
|
|
|
We can abuse the fact light is single threaded and share an instance
|
|
per light engine instance
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
|
|
index 729c4b1763a24bac3c0764bea505555a32e54f57..37d7165dfd17da03428f8dbbbf95aa8005be289c 100644
|
|
--- a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
|
|
+++ b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
|
|
@@ -15,6 +15,7 @@ import org.apache.commons.lang3.mutable.MutableInt;
|
|
public final class BlockLightEngine extends LayerLightEngine<BlockLightSectionStorage.BlockDataLayerStorageMap, BlockLightSectionStorage> {
|
|
private static final Direction[] DIRECTIONS = Direction.values();
|
|
private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
|
+ private final MutableInt mutableInt = new MutableInt(); // Paper
|
|
|
|
public BlockLightEngine(LightChunkGetter chunkProvider) {
|
|
super(chunkProvider, LightLayer.BLOCK, new BlockLightSectionStorage(chunkProvider));
|
|
@@ -44,7 +45,7 @@ public final class BlockLightEngine extends LayerLightEngine<BlockLightSectionSt
|
|
if (direction == null) {
|
|
return 15;
|
|
} else {
|
|
- MutableInt mutableInt = new MutableInt();
|
|
+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded
|
|
BlockState blockState = this.getStateAndOpacity(targetId, mutableInt);
|
|
if (mutableInt.getValue() >= 15) {
|
|
return 15;
|
|
diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
|
|
index 56b8f6ac53e7598da4dea2180825242222f86731..ca710a20e8b97341616463f4058b61cf4999af28 100644
|
|
--- a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
|
|
+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
|
|
@@ -15,6 +15,7 @@ import org.apache.commons.lang3.mutable.MutableInt;
|
|
public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorage.SkyDataLayerStorageMap, SkyLightSectionStorage> {
|
|
private static final Direction[] DIRECTIONS = Direction.values();
|
|
private static final Direction[] HORIZONTALS = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST};
|
|
+ private final MutableInt mutableInt = new MutableInt(); // Paper
|
|
|
|
public SkyLightEngine(LightChunkGetter chunkProvider) {
|
|
super(chunkProvider, LightLayer.SKY, new SkyLightSectionStorage(chunkProvider));
|
|
@@ -26,7 +27,7 @@ public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorag
|
|
if (level >= 15) {
|
|
return level;
|
|
} else {
|
|
- MutableInt mutableInt = new MutableInt();
|
|
+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded
|
|
BlockState blockState = this.getStateAndOpacity(targetId, mutableInt);
|
|
if (mutableInt.getValue() >= 15) {
|
|
return 15;
|