Skip to content

Commit 8fcfbc6

Browse files
committed
perf: shrink method size of aquiferExtracted$refreshDistPosIdx
1 parent ea693df commit 8fcfbc6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

c2me-opts-worldgen-vanilla/src/main/java/com/ishland/c2me/opts/worldgen/vanilla/mixin/aquifer/MixinAquiferSamplerImpl.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,7 @@ public BlockState apply(DensityFunction.NoisePos pos, double density) {
246246
for (int offY = -1; offY <= 1; ++offY) {
247247
for (int offZ = 0; offZ <= 1; ++offZ) {
248248
for (int offX = 0; offX <= 1; ++offX) {
249-
int curX = gx + offX;
250-
int curY = gy + offY;
251-
int curZ = gz + offZ;
252-
int posIdx = this.index(curX, curY, curZ);
249+
int posIdx = this.index(gx + offX, gy + offY, gz + offZ);
253250

254251
int shiftedIdx = posIdx << 2;
255252
int dx = this.c2me$blockPos[shiftedIdx + 0] - x;
@@ -258,15 +255,15 @@ public BlockState apply(DensityFunction.NoisePos pos, double density) {
258255
int dist = dx * dx + dy * dy + dz * dz;
259256
if (dist1 >= dist) {
260257
posIdx3 = posIdx2;
261-
posIdx2 = posIdx1;
262-
posIdx1 = posIdx;
263258
dist3 = dist2;
259+
posIdx2 = posIdx1;
264260
dist2 = dist1;
261+
posIdx1 = posIdx;
265262
dist1 = dist;
266263
} else if (dist2 >= dist) {
267264
posIdx3 = posIdx2;
268-
posIdx2 = posIdx;
269265
dist3 = dist2;
266+
posIdx2 = posIdx;
270267
dist2 = dist;
271268
} else if (dist3 >= dist) {
272269
posIdx3 = posIdx;

0 commit comments

Comments
 (0)