mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-03 05:32:18 -07:00
Prepare for 1.19 dev
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
|
||||
@@ -0,0 +0,0 @@ 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));
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
|
||||
@@ -0,0 +0,0 @@ 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));
|
||||
@@ -0,0 +0,0 @@ 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;
|
Reference in New Issue
Block a user