Skip to content

Commit

Permalink
new: add internal item count to debug hud
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Jan 21, 2025
1 parent a8a51fc commit a9e2340
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -38,6 +39,8 @@ public abstract class MixinServerChunkManager {
@Shadow
protected abstract @Nullable ChunkHolder getChunkHolder(long pos);

@Shadow public abstract int getLoadedChunkCount();

@Inject(method = "getChunk(IILnet/minecraft/world/chunk/ChunkStatus;Z)Lnet/minecraft/world/chunk/Chunk;", at = @At("HEAD"), cancellable = true)
private void shortcutGetChunk(int x, int z, ChunkStatus leastStatus, boolean create, CallbackInfoReturnable<Chunk> cir) {
if (Thread.currentThread() != this.serverThread) {
Expand Down Expand Up @@ -73,4 +76,13 @@ private int replaceLevel(ChunkHolder instance) {
return ((IChunkSystemAccess) this.chunkLoadingManager).c2me$getTheChunkSystem().vanillaIf$getManagedLevel(instance.getPos().toLong());
}

/**
* @author ishland
* @reason add debug string
*/
@Overwrite
public String getDebugString() {
return Integer.toString(((IChunkSystemAccess) this.chunkLoadingManager).c2me$getTheChunkSystem().itemCount()) + ", " + Integer.toString(this.getLoadedChunkCount());
}

}

0 comments on commit a9e2340

Please sign in to comment.