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 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { int j = pos.getMinBlockZ(); ObjectList objectList = new ObjectArrayList<>(10); ObjectList objectList2 = new ObjectArrayList<>(32); - world.startsForStructure(pos, (structure) -> { + // Paper start - replace for each + for (net.minecraft.world.level.levelgen.structure.StructureStart start : world.startsForStructure(pos, (structure) -> { return structure.terrainAdaptation() != TerrainAdjustment.NONE; - }).forEach((start) -> { + })) { // Paper end TerrainAdjustment terrainAdjustment = start.getStructure().terrainAdaptation(); for(StructurePiece structurePiece : start.getPieces()) { @@ -0,0 +0,0 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } for(JigsawJunction jigsawJunction : poolElementStructurePiece.getJunctions()) { - int i = jigsawJunction.getSourceX(); - int j = jigsawJunction.getSourceZ(); - if (i > i - 12 && j > j - 12 && i < i + 15 + 12 && j < j + 15 + 12) { + // Paper start - decompile fix + int i2 = jigsawJunction.getSourceX(); + int j2 = jigsawJunction.getSourceZ(); + if (i2 > i - 12 && j2 > j - 12 && i2 < i + 15 + 12 && j2 < j + 15 + 12) { + // Paper end objectList2.add(jigsawJunction); } } @@ -0,0 +0,0 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } } - }); + } // Paper return new Beardifier(objectList.iterator(), objectList2.iterator()); }