command to rescan and repack all loaded chunks

This commit is contained in:
Leijurv 2018-09-16 13:43:54 -07:00
parent 0ce68ee21f
commit 3f15451e88
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 20 additions and 0 deletions

View File

@ -36,8 +36,10 @@ import baritone.pathing.movement.Movement;
import baritone.pathing.movement.MovementHelper;
import baritone.utils.pathing.BetterBlockPos;
import net.minecraft.block.Block;
import net.minecraft.client.multiplayer.ChunkProviderClient;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.Chunk;
import java.util.*;
@ -119,6 +121,24 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
event.cancel();
return;
}
if (msg.equals("repack") || msg.equals("rescan")) {
ChunkProviderClient cli = world().getChunkProvider();
int playerChunkX = playerFeet().getX() >> 4;
int playerChunkZ = playerFeet().getZ() >> 4;
int count = 0;
for (int x = playerChunkX - 40; x <= playerChunkX + 40; x++) {
for (int z = playerChunkZ - 40; z <= playerChunkZ + 40; z++) {
Chunk chunk = cli.getLoadedChunk(x, z);
if (chunk != null) {
count++;
WorldProvider.INSTANCE.getCurrentWorld().cache.queueForPacking(chunk);
}
}
}
logDirect("Queued " + count + " chunks for repacking");
event.cancel();
return;
}
if (msg.equals("axis")) {
PathingBehavior.INSTANCE.setGoal(new GoalAxis());
PathingBehavior.INSTANCE.path();