From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java +++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java @@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ 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) { @@ -0,0 +0,0 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } } - }); + } // Paper this.pieceIterator = this.rigids.iterator(); this.junctionIterator = this.junctions.iterator(); }