3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/patches/server/0457-Remove-some-streams-from-structures.patch
2022-06-02 21:26:56 -07:00

42 Zeilen
2.3 KiB
Diff

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
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
@@ -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;
import net.minecraft.world.level.levelgen.structure.pools.JigsawJunction;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
@@ -40,9 +41,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
int j = chunkPos.getMinBlockZ();
this.junctions = new ObjectArrayList<>(32);
this.rigids = new ObjectArrayList<>(10);
- 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 {
}
}
- });
+ } // Paper
this.pieceIterator = this.rigids.iterator();
this.junctionIterator = this.junctions.iterator();
}