--- a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
+++ b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
@@ -2,6 +2,8 @@
 
 import com.mojang.serialization.Codec;
 import it.unimi.dsi.fastutil.objects.ObjectArrayList;
+import it.unimi.dsi.fastutil.objects.ObjectListIterator;
+import java.util.Iterator;
 import java.util.Set;
 import net.minecraft.Util;
 import net.minecraft.core.BlockPos;
@@ -23,6 +25,7 @@
 import net.minecraft.world.level.storage.loot.BuiltInLootTables;
 
 public class DesertPyramidStructure extends SinglePieceStructure {
+
     public static final Codec<DesertPyramidStructure> CODEC = simpleCodec(DesertPyramidStructure::new);
 
     public DesertPyramidStructure(Structure.StructureSettings config) {
@@ -32,25 +35,34 @@
     @Override
     public void afterPlace(WorldGenLevel world, StructureManager structureAccessor, ChunkGenerator chunkGenerator, RandomSource random, BoundingBox box, ChunkPos chunkPos, PiecesContainer pieces) {
         Set<BlockPos> set = SortedArraySet.create(Vec3i::compareTo);
+        Iterator iterator = pieces.pieces().iterator();
 
-        for(StructurePiece structurePiece : pieces.pieces()) {
-            if (structurePiece instanceof DesertPyramidPiece desertPyramidPiece) {
-                set.addAll(desertPyramidPiece.getPotentialSuspiciousSandWorldPositions());
-                placeSuspiciousSand(box, world, desertPyramidPiece.getRandomCollapsedRoofPos());
+        while (iterator.hasNext()) {
+            StructurePiece structurepiece = (StructurePiece) iterator.next();
+
+            if (structurepiece instanceof DesertPyramidPiece) {
+                DesertPyramidPiece desertpyramidpiece = (DesertPyramidPiece) structurepiece;
+
+                set.addAll(desertpyramidpiece.getPotentialSuspiciousSandWorldPositions());
+                DesertPyramidStructure.placeSuspiciousSand(box, world, desertpyramidpiece.getRandomCollapsedRoofPos());
             }
         }
 
-        ObjectArrayList<BlockPos> objectArrayList = new ObjectArrayList<>(set.stream().toList());
-        RandomSource randomSource = RandomSource.create(world.getSeed()).forkPositional().at(pieces.calculateBoundingBox().getCenter());
-        Util.shuffle(objectArrayList, randomSource);
-        int i = Math.min(set.size(), randomSource.nextInt(5, 8));
+        ObjectArrayList<BlockPos> objectarraylist = new ObjectArrayList(set.stream().toList());
+        RandomSource randomsource1 = RandomSource.create(world.getSeed()).forkPositional().at(pieces.calculateBoundingBox().getCenter());
+
+        Util.shuffle(objectarraylist, randomsource1);
+        int i = Math.min(set.size(), randomsource1.nextInt(5, 8));
+        ObjectListIterator objectlistiterator = objectarraylist.iterator();
+
+        while (objectlistiterator.hasNext()) {
+            BlockPos blockposition = (BlockPos) objectlistiterator.next();
 
-        for(BlockPos blockPos : objectArrayList) {
             if (i > 0) {
                 --i;
-                placeSuspiciousSand(box, world, blockPos);
-            } else if (box.isInside(blockPos)) {
-                world.setBlock(blockPos, Blocks.SAND.defaultBlockState(), 2);
+                DesertPyramidStructure.placeSuspiciousSand(box, world, blockposition);
+            } else if (box.isInside(blockposition)) {
+                world.setBlock(blockposition, Blocks.SAND.defaultBlockState(), 2);
             }
         }
 
@@ -58,9 +70,18 @@
 
     private static void placeSuspiciousSand(BoundingBox box, WorldGenLevel world, BlockPos pos) {
         if (box.isInside(pos)) {
+            // CraftBukkit start
+            if (world instanceof org.bukkit.craftbukkit.v1_20_R2.util.TransformerGeneratorAccess transformerAccess) {
+                org.bukkit.craftbukkit.v1_20_R2.block.CraftBrushableBlock brushableState = (org.bukkit.craftbukkit.v1_20_R2.block.CraftBrushableBlock) org.bukkit.craftbukkit.v1_20_R2.block.CraftBlockStates.getBlockState(pos, Blocks.SUSPICIOUS_SAND.defaultBlockState(), null);
+                brushableState.setLootTable(org.bukkit.Bukkit.getLootTable(org.bukkit.craftbukkit.v1_20_R2.util.CraftNamespacedKey.fromMinecraft(BuiltInLootTables.DESERT_PYRAMID_ARCHAEOLOGY)));
+                brushableState.setSeed(pos.asLong());
+                transformerAccess.setCraftBlock(pos, brushableState, 2);
+                return;
+            }
+            // CraftBukkit end
             world.setBlock(pos, Blocks.SUSPICIOUS_SAND.defaultBlockState(), 2);
-            world.getBlockEntity(pos, BlockEntityType.BRUSHABLE_BLOCK).ifPresent((blockEntity) -> {
-                blockEntity.setLootTable(BuiltInLootTables.DESERT_PYRAMID_ARCHAEOLOGY, pos.asLong());
+            world.getBlockEntity(pos, BlockEntityType.BRUSHABLE_BLOCK).ifPresent((brushableblockentity) -> {
+                brushableblockentity.setLootTable(BuiltInLootTables.DESERT_PYRAMID_ARCHAEOLOGY, pos.asLong());
             });
         }
 
