Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ scratch.js
bots/**/action-code/**
bots/**/
keys.json
settings_local.json
services/viaproxy/jars/**
services/viaproxy/logs/**
services/viaproxy/plugins/**
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,33 @@ To connect to online servers your bot will need an official Microsoft/Minecraft

To use different accounts, Mindcraft will connect with the account that the Minecraft launcher is currently using. You can switch accounts in the launcher, then run `node main.js`, then switch to your main account after the bot has connected.

## Local Settings Override

To avoid modifying `settings.js` (which is tracked by git), you can create a `settings_local.json` file that overrides default settings. This file is gitignored, so your local configuration won't be affected by branch switches or git pulls.

```bash
# Copy the example file
cp settings_local.json.example settings_local.json

# Edit with your settings
nano settings_local.json # or use any editor
```

Example `settings_local.json`:
```json
{
"minecraft_version": "1.21.8",
"host": "192.168.1.100",
"port": 25565,
"auto_open_ui": false,
"profiles": [
"./profiles/gemini.json"
]
}
```

Only include the settings you want to override. Any settings not specified will use the defaults from `settings.js`.

## Tasks

Tasks automatically start the bot with a prompt and a goal item to aquire or blueprint to construct. To run a simple task that involves collecting 4 oak_logs run
Expand Down
15 changes: 15 additions & 0 deletions settings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import fs from 'fs';
import path from 'path';

const settings = {
"minecraft_version": "auto", // or specific version like "1.21.6"
"host": "127.0.0.1", // or "localhost", "your.ip.address.here"
Expand Down Expand Up @@ -60,4 +63,16 @@ const settings = {

}

// Load local settings override if it exists (not tracked by git)
const localSettingsPath = path.join(process.cwd(), 'settings_local.json');
if (fs.existsSync(localSettingsPath)) {
try {
const localSettings = JSON.parse(fs.readFileSync(localSettingsPath, 'utf8'));
Object.assign(settings, localSettings);
console.log('Loaded local settings from settings_local.json');
} catch (err) {
console.error('Error loading settings_local.json:', err.message);
}
}

export default settings;
9 changes: 9 additions & 0 deletions settings_local.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"minecraft_version": "1.21.8",
"host": "10.1.1.232",
"port": 25565,
"auto_open_ui": false,
"profiles": [
"./profiles/gemini.json"
]
}