Skip to content

Commit

Permalink
Changed "randomtickedChunksCount" option on rng command to make it sh…
Browse files Browse the repository at this point in the history
…ow how many subchunks randomticks
  • Loading branch information
Dioswilson committed Feb 4, 2022
1 parent ad9ff52 commit a15d56b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion carpetmodSrc/carpet/commands/CommandRNG.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
World world = sender.getEntityWorld();
int iters = Integer.MAX_VALUE;
int chunkCount = 0;
int subchunkneedsRandomTick = 0;
int x = 0;
int z = 0;

Expand All @@ -161,12 +162,20 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
for (Iterator<Chunk> iterator = ((WorldServer) world).playerChunkMap.getChunkIterator(); iterator
.hasNext() && chunkCount < iters; ((WorldServer) world).profiler.endSection()) {
Chunk chunk = iterator.next();
System.out.println("chunk x: " + chunk.x + " z: " + chunk.z);
if (iters != Integer.MAX_VALUE) {
chunkCount++;
x = chunk.x;
z = chunk.z;
}
count++;
//added
for (ExtendedBlockStorage extendedblockstorage : chunk.getBlockStorageArray()) {
if (extendedblockstorage != Chunk.NULL_BLOCK_STORAGE && extendedblockstorage.needsRandomTick()) {
subchunkneedsRandomTick++;
//break;
}
}
}
if (iters != Integer.MAX_VALUE) {
notifyCommandListener(sender, this,
Expand All @@ -175,7 +184,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
count, x, z));
} else {
notifyCommandListener(sender, this,
String.format("Number of chunks around the player random ticking: %d", count));
String.format("Number of chunks around the player random ticking: %d", subchunkneedsRandomTick));
}
}
} else if ("randomtickedBlocksInRange".equalsIgnoreCase(args[0])) {
Expand Down

0 comments on commit a15d56b

Please sign in to comment.