Skip to content

Commit

Permalink
Replace for loop with object iterator, closes #207
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Dec 28, 2023
1 parent 07f1f3d commit bd78fb8
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.*;

import it.unimi.dsi.fastutil.objects.ObjectIterator;

/**
* Courtesy of yungnickyoung
* Replacement for normal strongholds.
Expand Down Expand Up @@ -37,10 +39,11 @@ public synchronized void generateSafeStructure(World worldIn, Random randomIn, C
this.initializeStructureData(worldIn);
int i = (chunkCoord.x << 4) + 8;
int j = (chunkCoord.z << 4) + 8;
ObjectIterator objectiterator = this.structureMap.values().iterator();

for (StructureStart structureStart : this.structureMap.values())
while (objectiterator.hasNext())
{
Start structurestart = (Start) structureStart;
Start structurestart = (Start) objectiterator.next();

if (structurestart.isSizeableStructure() && structurestart.isValidForPostProcess(chunkCoord) && structurestart.getBoundingBox().intersectsWith(i, j, i + 15, j + 15))
{
Expand Down Expand Up @@ -142,4 +145,4 @@ public void generateSafeStructure(World worldIn, Random rand, StructureBoundingB
}
}
}
}
}

0 comments on commit bd78fb8

Please sign in to comment.