Merged master into 1.13.2 branch. 😎
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||

|
||||
[](https://github.com/cabaletta/baritone/graphs/contributors/)
|
||||
[](https://github.com/cabaletta/baritone/commit/)
|
||||
[](https://impactclient.net/)
|
||||
[](https://impactclient.net/)
|
||||
[](https://github.com/fr1kin/ForgeHax/)
|
||||
[](https://gitlab.com/emc-mods-indrit/baritone_api)
|
||||
[](https://wweclient.com/)
|
||||
|
||||
20
USAGE.md
20
USAGE.md
@@ -8,11 +8,23 @@ Baritone commands can also by default be typed in the chatbox. However if you ma
|
||||
|
||||
To disable direct chat control (with no prefix), turn off the `chatControl` setting. To disable chat control with the `#` prefix, turn off the `prefixControl` setting. In Impact, `.b` cannot be disabled. Be careful that you don't leave yourself with all control methods disabled (if you do, reset your settings by deleting the file `minecraft/baritone/settings.txt` and relaunching).
|
||||
|
||||
# For Baritone 1.2.10+, 1.3.5+, 1.4.2+
|
||||
|
||||
Lots of the commands have changed, BUT `#help` is improved vastly (its clickable! commands have tab completion! oh my!).
|
||||
|
||||
Try `#help` I promise it won't just send you back here =)
|
||||
|
||||
"wtf where is cleararea" -> look at `#help sel`
|
||||
|
||||
"wtf where is goto death, goto waypoint" -> look at `#help wp`
|
||||
|
||||
just look at `#help` lmao
|
||||
|
||||
# Commands
|
||||
|
||||
**All** of these commands may need a prefix before them, as above ^.
|
||||
|
||||
`help` for (rudimentary) help. You can see what it says [here](https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/utils/ExampleBaritoneControl.java#L47).
|
||||
`help`
|
||||
|
||||
To toggle a boolean setting, just say its name in chat (for example saying `allowBreak` toggles whether Baritone will consider breaking blocks). For a numeric setting, say its name then the new value (like `primaryTimeoutMS 250`). It's case insensitive. To reset a setting to its default value, say `acceptableThrowawayItems reset`. To reset all settings, say `reset`. To see all settings that have been modified from their default values, say `modified`.
|
||||
|
||||
@@ -38,12 +50,6 @@ Some common examples:
|
||||
- `version` to get the version of Baritone you're running
|
||||
- `damn` daniel
|
||||
|
||||
|
||||
New commands:
|
||||
- `sel` to manage selections
|
||||
- some others
|
||||
|
||||
|
||||
For the rest of the commands, you can take a look at the code [here](https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/utils/ExampleBaritoneControl.java).
|
||||
|
||||
All the settings and documentation are <a href="https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/Settings.java">here</a>. If you find HTML easier to read than Javadoc, you can look <a href="https://baritone.leijurv.com/baritone/api/Settings.html#field.detail">here</a>.
|
||||
|
||||
@@ -20,7 +20,6 @@ version '1.3.5'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name = 'forge'
|
||||
url = 'http://files.minecraftforge.net/maven'
|
||||
@@ -29,6 +28,7 @@ buildscript {
|
||||
name = 'impactdevelopment-repo'
|
||||
url = 'https://impactdevelopment.github.io/maven/'
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -81,6 +81,4 @@ public interface ICachedWorld {
|
||||
* in a new thread by default.
|
||||
*/
|
||||
void save();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -77,10 +77,20 @@ public interface IWorldScanner {
|
||||
}
|
||||
|
||||
/**
|
||||
* Repacks 40 chunks around the player.
|
||||
* Overload of {@link #repack(IPlayerContext, int)} where the value of the {@code range} parameter is {@code 40}.
|
||||
*
|
||||
* @param ctx The player context for that player.
|
||||
* @return The number of chunks queued for repacking.
|
||||
* @param ctx The player, describing the origin
|
||||
* @return The amount of chunks successfully queued for repacking
|
||||
*/
|
||||
int repack(IPlayerContext ctx);
|
||||
|
||||
/**
|
||||
* Queues the chunks in a square formation around the specified player, using the specified
|
||||
* range, which represents 1/2 the square's dimensions, where the player is in the center.
|
||||
*
|
||||
* @param ctx The player, describing the origin
|
||||
* @param range The range to repack
|
||||
* @return The amount of chunks successfully queued for repacking
|
||||
*/
|
||||
int repack(IPlayerContext ctx, int range);
|
||||
}
|
||||
|
||||
57
src/main/java/baritone/cache/WorldScanner.java
vendored
57
src/main/java/baritone/cache/WorldScanner.java
vendored
@@ -111,6 +111,41 @@ public enum WorldScanner implements IWorldScanner {
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int repack(IPlayerContext ctx) {
|
||||
return this.repack(ctx, 40);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int repack(IPlayerContext ctx, int range) {
|
||||
IChunkProvider chunkProvider = ctx.world().getChunkProvider();
|
||||
ICachedWorld cachedWorld = ctx.worldData().getCachedWorld();
|
||||
|
||||
BetterBlockPos playerPos = ctx.playerFeet();
|
||||
|
||||
int playerChunkX = playerPos.getX() >> 4;
|
||||
int playerChunkZ = playerPos.getZ() >> 4;
|
||||
|
||||
int minX = playerChunkX - range;
|
||||
int minZ = playerChunkZ - range;
|
||||
int maxX = playerChunkX + range;
|
||||
int maxZ = playerChunkZ + range;
|
||||
|
||||
int queued = 0;
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
Chunk chunk = chunkProvider.getChunk(x, z, false, false);
|
||||
|
||||
if (chunk != null && !chunk.isEmpty()) {
|
||||
queued++;
|
||||
cachedWorld.queueForPacking(chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return queued;
|
||||
}
|
||||
|
||||
private boolean scanChunkInto(int chunkX, int chunkZ, Chunk chunk, BlockOptionalMetaLookup filter, Collection<BlockPos> result, int max, int yLevelThreshold, int playerY, int[] coordinateIterationOrder) {
|
||||
ChunkSection[] chunkInternalStorageArray = chunk.getSections();
|
||||
boolean foundWithinY = false;
|
||||
@@ -147,26 +182,4 @@ public enum WorldScanner implements IWorldScanner {
|
||||
}
|
||||
return foundWithinY;
|
||||
}
|
||||
|
||||
public int repack(IPlayerContext ctx) {
|
||||
IChunkProvider chunkProvider = ctx.world().getChunkProvider();
|
||||
ICachedWorld cachedWorld = ctx.worldData().getCachedWorld();
|
||||
|
||||
BetterBlockPos playerPos = ctx.playerFeet();
|
||||
int playerChunkX = playerPos.getX() >> 4;
|
||||
int playerChunkZ = playerPos.getZ() >> 4;
|
||||
int queued = 0;
|
||||
for (int x = playerChunkX - 40; x <= playerChunkX + 40; x++) {
|
||||
for (int z = playerChunkZ - 40; z <= playerChunkZ + 40; z++) {
|
||||
Chunk chunk = chunkProvider.getChunk(x, z, false, false);
|
||||
|
||||
if (chunk != null && !chunk.isEmpty()) {
|
||||
queued++;
|
||||
cachedWorld.queueForPacking(chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return queued;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,9 @@ import net.minecraft.client.GameSettings;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.tutorial.TutorialSteps;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.util.HttpUtil;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.GameType;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.WorldType;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -92,17 +88,21 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
||||
if (mc.currentScreen instanceof GuiMainMenu) {
|
||||
System.out.println("Beginning Baritone automatic test routine");
|
||||
mc.displayGuiScreen(null);
|
||||
WorldSettings worldsettings = new WorldSettings(TEST_SEED, GameType.getByName("survival"), true, false, WorldType.DEFAULT);
|
||||
WorldSettings worldsettings = new WorldSettings(TEST_SEED, GameType.SURVIVAL, true, false, WorldType.DEFAULT);
|
||||
mc.launchIntegratedServer("BaritoneAutoTest", "BaritoneAutoTest", worldsettings);
|
||||
}
|
||||
|
||||
IntegratedServer server = mc.getIntegratedServer();
|
||||
// If the integrated server is running, set the difficulty to peaceful
|
||||
if (mc.getIntegratedServer() != null) {
|
||||
mc.getIntegratedServer().setDifficultyForAllWorlds(EnumDifficulty.PEACEFUL);
|
||||
|
||||
// If the integrated server is launched and the world has initialized, set the spawn point
|
||||
// to our defined starting position
|
||||
if (server != null && server.getWorld(DimensionType.OVERWORLD) != null) {
|
||||
server.getWorld(DimensionType.OVERWORLD).setSpawnPoint(STARTING_POSITION);
|
||||
server.getWorld(DimensionType.OVERWORLD).getGameRules().setOrCreateGameRule("spawnRadius", "0", server);
|
||||
for (final WorldServer world : mc.getIntegratedServer().getWorlds()) {
|
||||
// If the world has initialized, set the spawn point to our defined starting position
|
||||
if (world != null) {
|
||||
world.setSpawnPoint(STARTING_POSITION);
|
||||
world.getGameRules().setOrCreateGameRule("spawnRadius", "0", mc.getIntegratedServer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getType() == TickEvent.Type.IN) { // If we're in-game
|
||||
@@ -110,7 +110,7 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
||||
// Force the integrated server to share the world to LAN so that
|
||||
// the ingame pause menu gui doesn't actually pause our game
|
||||
if (mc.isSingleplayer() && !mc.getIntegratedServer().getPublic()) {
|
||||
mc.getIntegratedServer().shareToLAN(GameType.getByName("survival"), false, HttpUtil.getSuitableLanPort());
|
||||
mc.getIntegratedServer().shareToLAN(GameType.SURVIVAL, false, HttpUtil.getSuitableLanPort());
|
||||
}
|
||||
|
||||
// For the first 200 ticks, wait for the world to generate
|
||||
|
||||
Reference in New Issue
Block a user