Skip to content

Commit

Permalink
Update last chunk position in findSupportingBlock
Browse files Browse the repository at this point in the history
Fixes fetching chunks needlessly multiple times.

Thanks Lulu13022002 for pointing this out
  • Loading branch information
Spottedleaf committed Jul 13, 2024
1 parent 2eb4a71 commit 24657f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ public final Optional<BlockPos> findSupportingBlock(final Entity entity, final A
final int newChunkZ = currZ >> 4;

if (((newChunkX ^ lastChunkX) | (newChunkZ ^ lastChunkZ)) != 0) {
lastChunkX = newChunkX;
lastChunkZ = newChunkZ;
lastChunk = (LevelChunk)chunkSource.getChunk(newChunkX, newChunkZ, ChunkStatus.FULL, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public abstract class FarmBlockMixin {

/**
* @reason Avoid usage of betweenClsed, this can become very hot when
* @reason Avoid usage of betweenClosed, this can become very hot when
* there are significant numbers of farm blocks in the world
* @author Spottedleaf
*/
Expand Down

0 comments on commit 24657f1

Please sign in to comment.