PaperMC/patches/server/0457-Remove-some-streams-from-structures.patch

42 lines
2.3 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Mon, 29 Jun 2020 17:03:06 -0400
Subject: [PATCH] Remove some streams from structures
This showed up a lot in the spark profiler, should have a low-medium performance improvement.
diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
2022-03-01 06:43:03 +01:00
index 353fd8290a48c722a5eb86794dd09ca81960c8f5..e7b02df8fd5c19537fc793f0c61ebb85c86b2100 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
2022-03-01 06:43:03 +01:00
@@ -13,6 +13,7 @@ import net.minecraft.world.level.levelgen.feature.NoiseEffect;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.levelgen.structure.PoolElementStructurePiece;
import net.minecraft.world.level.levelgen.structure.StructurePiece;
+import net.minecraft.world.level.levelgen.structure.StructureStart;
2022-03-01 06:43:03 +01:00
import net.minecraft.world.level.levelgen.structure.pools.JigsawJunction;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
2022-03-01 06:43:03 +01:00
@@ -40,9 +41,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
int j = chunkPos.getMinBlockZ();
this.junctions = new ObjectArrayList<>(32);
this.rigids = new ObjectArrayList<>(10);
2022-03-01 06:43:03 +01:00
- structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), (configuredStructureFeature) -> {
+ // Paper start - replace for each
+ for (StructureStart start : structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), (configuredStructureFeature) -> {
return configuredStructureFeature.adaptNoise;
- }).forEach((start) -> {
+ })) { // Paper end
for(StructurePiece structurePiece : start.getPieces()) {
if (structurePiece.isCloseToChunk(chunkPos, 12)) {
if (structurePiece instanceof PoolElementStructurePiece) {
@@ -65,7 +67,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
}
2022-03-01 06:43:03 +01:00
}
2022-03-01 06:43:03 +01:00
- });
+ } // Paper
this.pieceIterator = this.rigids.iterator();
2022-03-01 06:43:03 +01:00
this.junctionIterator = this.junctions.iterator();
}