Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Fixed altoclef crashing if quitting the world while the task is running. #340

Open
wants to merge 132 commits into
base: 1.19.4--marvion
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
9526ed1
1.19.2 Update
MarvionKirito Oct 31, 2022
59d54fc
Remove cave and void air in blocksToAvoid.
MarvionKirito Nov 1, 2022
e03c02f
Fixes and Additions:
MarvionKirito Nov 5, 2022
2d05070
chore: document "hero" in usage.md
JustaSqu1d Nov 5, 2022
ce525c7
Fixes:
MarvionKirito Nov 6, 2022
bb4f735
Merge pull request #1 from JustaSqu1d/patch-2
MarvionKirito Nov 6, 2022
c2995dc
Fix:
MarvionKirito Nov 6, 2022
8f405d0
Fix:
MarvionKirito Nov 12, 2022
68933f0
Fix:
MarvionKirito Nov 13, 2022
7c1a7d1
Fix:
MarvionKirito Nov 15, 2022
0d0de54
Optimizations:
MarvionKirito Nov 18, 2022
a3281f2
Optimization:
MarvionKirito Nov 19, 2022
f7f66e7
Fix:
MarvionKirito Nov 19, 2022
5aedee5
Fix:
MarvionKirito Nov 19, 2022
e958ae2
1. Updated to 1.19.3
MarvionKirito Feb 6, 2023
ed750cc
perf: equip weapon then check charge progress
JustaSqu1d Feb 25, 2023
0ec5a5e
Merge pull request #4 from JustaSqu1d/patch-1
MarvionKirito Mar 2, 2023
9987e57
chore(README): update versions availiblity
JustaSqu1d Mar 10, 2023
12111aa
Additions:
MarvionKirito Mar 12, 2023
22bad21
Merge pull request #5 from JustaSqu1d/patch-1
MarvionKirito Mar 12, 2023
7567dce
feat: camera movement smoothing
JustaSqu1d Mar 15, 2023
067222e
Merge pull request #7 from JustaSqu1d/main
MarvionKirito Mar 29, 2023
32915bb
Improved shielding mechanics.
MarvionKirito Mar 29, 2023
98c8492
Updated to 1.19.4
MarvionKirito Mar 31, 2023
824d4e0
Fixed altoclef crashing if quitting the world while the task is running.
MarvionKirito Apr 2, 2023
fc7a73d
docs(README): bump supported versions from 1.19.3 to 1.19.4
JustaSqu1d Apr 2, 2023
a7c2fdc
Merge branch '1.19.4--marvion' into main
MarvionKirito Apr 2, 2023
eb2f03c
Merge pull request #8 from JustaSqu1d/patch-1
MarvionKirito Apr 2, 2023
9694872
Fixed Altoclef from crashing by checking if the player is in-game bef…
MarvionKirito Apr 3, 2023
7414776
Removed AltoClef.inGame() in FoodChain and fixed gradle workflow
MarvionKirito Apr 3, 2023
35251c4
Fixed altoclef crashing if quitting the world while the task is running.
MarvionKirito Apr 4, 2023
3f5a95f
fix butler not working
dolphin-cat Apr 9, 2023
baac615
Addition of windows command line build/run instructions
dolphin-cat Apr 9, 2023
65d7f6e
Update develop.md
dolphin-cat Apr 9, 2023
138325a
Update src/main/java/adris/altoclef/eventbus/events/ChatMessageEvent.…
dolphin-cat Apr 9, 2023
b752e3c
Update src/main/java/adris/altoclef/butler/Butler.java
dolphin-cat Apr 9, 2023
4c020bc
JustaSqu1d's typo
dolphin-cat Apr 9, 2023
ed3a98c
Merge pull request #9 from dolphin-cat/main
MarvionKirito Apr 10, 2023
e983979
(run command on death)[https://discord.com/channels/84615038121384349…
dolphin-cat Apr 10, 2023
e1d7e04
Merge pull request #2 from MarvionKirito/main
dolphin-cat Apr 10, 2023
b4d15c0
(run command on death)[https://discord.com/channels/84615038121384349…
dolphin-cat Apr 10, 2023
4457e5f
add support for {deathmessage} placeholder
dolphin-cat Apr 10, 2023
d4760a1
Allow multiple commands
dolphin-cat Apr 10, 2023
ad5b7d3
Update Settings.java
dolphin-cat Apr 10, 2023
909e685
Delete PlayerDeathEvent.java
dolphin-cat Apr 10, 2023
f0f3742
Update DeathMenuChain.java
dolphin-cat Apr 10, 2023
9cc1945
Merge pull request #10 from dolphin-cat/main
MarvionKirito Apr 13, 2023
81abac2
Updated maven link
MarvionKirito Apr 10, 2023
af5ca7a
Updated maven link
MarvionKirito Apr 21, 2023
e49cdc2
Versions have been updated
MarvionKirito Apr 21, 2023
af883fe
Merge remote-tracking branch 'origin/main'
MarvionKirito Apr 21, 2023
660ac0a
Fixed flinting portal error
MarvionKirito Apr 22, 2023
4cfb6a7
Fixed flinting portal error and reduced the occurrence of accidental …
MarvionKirito Apr 22, 2023
d3ed92e
Merge remote-tracking branch 'origin/main'
MarvionKirito Apr 22, 2023
977ba7c
Implementing self care task
MarvionKirito Apr 23, 2023
ac3ecff
Implementing self care task pt. 2
MarvionKirito Apr 23, 2023
ed1c1eb
Implementing self-care task pt. 3
MarvionKirito Apr 23, 2023
0563add
Implementing self-care task pt. 4
MarvionKirito May 7, 2023
6170b93
Continue diamond tool set
MarvionKirito May 7, 2023
24a856f
Implementing self-care task pt. 5
MarvionKirito May 8, 2023
aaad871
Implement self-care task
MarvionKirito May 17, 2023
f335f6f
Implement self-care task
MarvionKirito May 18, 2023
779e330
Fixing item getting stuck at cursor when picking up the item from con…
MarvionKirito May 19, 2023
b703088
Fixed item getting stuck at cursor when picking up the item from cont…
MarvionKirito May 19, 2023
e5cb987
Clean up code
MarvionKirito May 23, 2023
f7fcc63
Fixed sometimes there's a warning showing in chat saying "BlockTracke…
MarvionKirito May 23, 2023
034a236
Update MarvionBeatMinecraftTask.java
Aldias7 Jun 20, 2023
aae919f
Updated to 1.20.1 for bug fixes and improvements
MarvionKirito Aug 9, 2023
47c3562
Updated to 1.20.1 for bug fixes and improvements
MarvionKirito Aug 9, 2023
0aee424
Merge pull request #13 from Aldias7/patch-3
MarvionKirito Aug 9, 2023
6639a3d
Fixed killing baby mobs while obtaining food
MarvionKirito Aug 10, 2023
e5ffe6f
Merge remote-tracking branch 'MarvionAltoclefPrivate/main'
MarvionKirito Aug 10, 2023
a0d31a9
Fixed killing baby mobs while obtaining food
MarvionKirito Aug 10, 2023
376bf54
Merge remote-tracking branch 'MarvionAltoclefPrivate/main'
MarvionKirito Aug 10, 2023
45f80cf
Fixed running away from hostile loop
MarvionKirito Aug 13, 2023
310e362
Improved CollectBlazeRodsTask
MarvionKirito Aug 13, 2023
5daf183
Improved defense system
MarvionKirito Aug 13, 2023
d5d2936
Fixed the issue where the bot wouldn't reach its position after being…
MarvionKirito Aug 13, 2023
f743d5c
Improved accuracy
MarvionKirito Aug 13, 2023
af5454c
Added a feature where the bot will now attempt to eliminate all aggre…
MarvionKirito Aug 13, 2023
92607f4
Fixed the issue of crashing when the bot dies while any task is running
MarvionKirito Aug 13, 2023
eeb695e
Resolved the action of killing baby pigs when obtaining pork chops in…
MarvionKirito Aug 13, 2023
72e186a
I have added a feature where the bot will wait for chunks to load at …
MarvionKirito Aug 13, 2023
82621bd
Updated to beta 2
MarvionKirito Aug 13, 2023
f37a29d
feat: better enderman-hunting logic
JustaSqu1d Aug 13, 2023
b938352
feat: use better hunt logic
JustaSqu1d Aug 13, 2023
1749509
perf: don't hit an extra time
JustaSqu1d Aug 13, 2023
84fe018
feat: use golden helmet instead of golden boots
JustaSqu1d Aug 13, 2023
0de20c5
feat: add vindicators to dangerous mobs
JustaSqu1d Aug 13, 2023
ed04ff2
feat: collect obsidian in nether by trading
JustaSqu1d Aug 13, 2023
eb03388
feat: don't pick up eyes if there is enough
JustaSqu1d Aug 13, 2023
42a4b07
refactor: use constants for clarity
JustaSqu1d Aug 13, 2023
f4b3743
Merge pull request #14 from JustaSqu1d/feat/enderman-hunt
MarvionKirito Aug 14, 2023
7237bfa
Merge pull request #15 from JustaSqu1d/feat/various-slight-optimizations
MarvionKirito Aug 16, 2023
8779989
Fixed commanding butler
MarvionKirito Aug 28, 2023
07f6dfd
quick and dirty fix to netherite
Jacoblightning Sep 16, 2023
c9833a8
IT WORKS??!?!?
Jacoblightning Oct 25, 2023
c05f051
Merge pull request #16
MarvionKirito Dec 10, 2023
785c5ae
Updated to 1.20.2
MarvionKirito Dec 21, 2023
e50ae10
Optimized entity interact.
MarvionKirito Dec 21, 2023
d22647d
Optimized interacting with block.
MarvionKirito Dec 21, 2023
4b32c14
A little refactoring.
MarvionKirito Dec 21, 2023
1026661
Fixed obtaining recipe and a little refactoring.
MarvionKirito Dec 21, 2023
2f51bce
Fixed obtaining recipe and a little refactoring.
MarvionKirito Dec 21, 2023
c7e3ce4
A little refactoring.
MarvionKirito Dec 21, 2023
3f8d2f7
Fixed obtaining recipe and a little refactoring.
MarvionKirito Dec 21, 2023
a4dee52
A little refactoring.
MarvionKirito Dec 21, 2023
5b34062
A little refactoring.
MarvionKirito Dec 21, 2023
7dde6b5
A little refactoring.
MarvionKirito Dec 21, 2023
063e38f
A little refactoring.
MarvionKirito Dec 21, 2023
7cbaa20
A little refactoring.
MarvionKirito Dec 21, 2023
92a2991
Optimized building nether portal frame.
MarvionKirito Dec 21, 2023
6a39827
A little refactoring.
MarvionKirito Dec 21, 2023
a070139
Clean up.
MarvionKirito Dec 21, 2023
f701800
Version correction.
MarvionKirito Dec 21, 2023
b51a26e
Merge remote-tracking branch 'MarvionAltoclefPrivate/main'
MarvionKirito Dec 21, 2023
5a0cd35
chore(gitignore): add visual studio files
JustaSqu1d Dec 28, 2023
82c92e8
feat: add smooth look
JustaSqu1d Dec 28, 2023
2c99b73
feat: optimize end fight
JustaSqu1d Dec 28, 2023
0663bde
feat: "shoot arrow to an entity" task
JustaSqu1d Dec 28, 2023
d97fa92
feat: add `@test arrow`
JustaSqu1d Dec 28, 2023
be536ae
fix: lapis requirement iron -> stone
JustaSqu1d Dec 28, 2023
71549bf
feat: ignore projectiles that will not hit player
JustaSqu1d Dec 28, 2023
7cfd71b
chore: standarize command description style
JustaSqu1d Dec 28, 2023
9f503ec
chore: simplify code
JustaSqu1d Dec 28, 2023
caf203e
Look up when the dragon is dying.
MarvionKirito Jan 2, 2024
b3554b5
Just removed some codes.
MarvionKirito Jan 2, 2024
bd13a4c
Kill angry endermen first.
MarvionKirito Jan 2, 2024
da3dce5
1.20.4 update
MarvionKirito Feb 25, 2024
2ca4196
1.20.5 update
MarvionKirito Jun 20, 2024
1713539
1.20.6 update
MarvionKirito Jun 20, 2024
e45566e
1.21 update
MarvionKirito Aug 5, 2024
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# User-specific stuff
.idea/
.vs/
baritone/

*.iml
Expand Down Expand Up @@ -117,4 +118,3 @@ run/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ If the Nightly Link doesn't work, check the latest [Build Action](https://github
that succeeded and download `Artifacts.zip` (you must be signed into GitHub). Replace your
existing `altoclef-4.0-SNAPSHOT.jar` with the one found in `Artifacts.zip`

Then, copy `altoclef-4.0-SNAPSHOT.jar` from `Artifacts.zip` to `./mods`.

Then, copy the `baritone-unoptimized-fabric-1.XX.X.jar` from the long term release zip file to `./mods`

### Long Term Release

[Check releases](https://github.com/gaucho-matrero/altoclef/releases). Note you will need to copy over both jar files
Expand All @@ -65,7 +61,7 @@ out now if you'd like:

### Versions

This is a **fabric only** mod, currently only available for **Minecraft 1.19.2-1.19.3**.
This is a **fabric only** mod, currently only available for **Minecraft 1.19.2-1.19.4**.

For older MC versions, try [multiconnect](https://www.curseforge.com/minecraft/mc-mods/multiconnect) (NOTE: multiconnect
is untested and not affiliated with altoclef, use at your own risk!)
Expand Down
45 changes: 26 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id "fabric-loom" version "1.1-SNAPSHOT"
id "fabric-loom" version "1.7-SNAPSHOT"
id "maven-publish"
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
version = project.mod_version
Expand All @@ -14,8 +14,12 @@ group = project.maven_group
repositories {
mavenCentral()
maven {
name = "gaucho-matrero-repo"
url = "https://gaucho-matrero.github.io/maven/"
name = "MarvionKiritoRepo"
url = "https://marvionkirito.github.io/maven/"
}
maven {
name = 'babbaj-repo'
url = 'https://babbaj.github.io/maven/'
}
flatDir {
dirs '../baritone/dist'
Expand All @@ -32,25 +36,28 @@ dependencies {
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")

// Jackson JSON
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.0-rc1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.0-rc1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.0-rc1'
implementation 'com.fasterxml.jackson.core:jackson-core:2.17.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.17.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.2'

// Nether pathfinder
implementation 'dev.babbaj:nether-pathfinder:1.5'

// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
shadow('com.fasterxml.jackson.core:jackson-core:2.15.0-rc1')
shadow('com.fasterxml.jackson.core:jackson-annotations:2.15.0-rc1')
shadow('com.fasterxml.jackson.core:jackson-databind:2.15.0-rc1')
shadow('com.fasterxml.jackson.core:jackson-core:2.17.2')
shadow('com.fasterxml.jackson.core:jackson-annotations:2.17.2')
shadow('com.fasterxml.jackson.core:jackson-databind:2.17.2')

// Thank you georgeagostino for fixing my garbage
// if (getProject().hasProperty("altoclef.development")) {
// Must run build from baritone-plus once
modImplementation 'baritone-api-fabric:baritone-unoptimized-fabric-1.19.4-beta1'
include "baritone-api-fabric:baritone-unoptimized-fabric-1.19.4-beta1"
//} else {
// modImplementation "cabaletta:baritone-unoptimized-fabric:1.18.2"
// include "cabaletta:baritone-unoptimized-fabric:1.18.2"
//}
if (getProject().hasProperty("altoclef.development")) {
// Must run build from baritone-plus once
modImplementation 'baritone-api-fabric:baritone-unoptimized-fabric-1.21-beta1'
include "baritone-api-fabric:baritone-unoptimized-fabric-1.21-beta1"
} else {
modImplementation "cabaletta:baritone-unoptimized-fabric:1.21-beta1"
include "cabaletta:baritone-unoptimized-fabric:1.21-beta1"
}
//modImplementation 'baritone-api-fabric:baritone-api-fabric:1.6.3'
//implementation files('baritone-plus/build/libs/baritone-unoptimized-fabric-1.6.3.jar')
}
Expand Down
4 changes: 2 additions & 2 deletions develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ Click `File > New > Project from Version Control...` ![image](https://user-image

If the gradle tab doesn't exist, try `View > Tool Windows > Gradle`

## Get it Running (Command line, Linux & macOS)
## Get it Running (Command line)

1) Git Clone project
2) `cd` into cloned local repo
3) `sudo / doas chmod +x gradlew`
3) `sudo / doas chmod +x gradlew` (skip this step if you are on windows)
4) `./gradlew build` or `./gradlew runClient`

## Modifying Baritone (dev mode)
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ org.gradle.caching=true
org.gradle.warning.mode=all
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
loader_version=0.14.18
minecraft_version=1.21
yarn_mappings=1.21+build.9
loader_version=0.15.11
# Mod Properties
mod_version=1.19.4-beta1
mod_version=1.21-beta1
maven_group=gaucho-matrero.altoclef
archives_base_name=altoclef
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.76.0+1.19.4
fabric_version=0.100.7+1.21
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 3 additions & 2 deletions src/main/java/adris/altoclef/AltoClef.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,10 @@ private void initializeBaritoneSettings() {
getClientBaritoneSettings().blocksToAvoid.value = List.of(Blocks.FLOWERING_AZALEA, Blocks.AZALEA,
Blocks.POWDER_SNOW, Blocks.BIG_DRIPLEAF, Blocks.BIG_DRIPLEAF_STEM, Blocks.CAVE_VINES,
Blocks.CAVE_VINES_PLANT, Blocks.TWISTING_VINES, Blocks.TWISTING_VINES_PLANT, Blocks.SWEET_BERRY_BUSH,
Blocks.WARPED_ROOTS, Blocks.VINE, Blocks.GRASS, Blocks.FERN, Blocks.TALL_GRASS, Blocks.LARGE_FERN,
Blocks.WARPED_ROOTS, Blocks.VINE, Blocks.GRASS_BLOCK, Blocks.FERN, Blocks.TALL_GRASS, Blocks.LARGE_FERN,
Blocks.SMALL_AMETHYST_BUD, Blocks.MEDIUM_AMETHYST_BUD, Blocks.LARGE_AMETHYST_BUD,
Blocks.AMETHYST_CLUSTER, Blocks.SCULK, Blocks.SCULK_VEIN);
Blocks.AMETHYST_CLUSTER, Blocks.SCULK, Blocks.SCULK_VEIN, Blocks.SUNFLOWER, Blocks.LILAC,
Blocks.ROSE_BUSH, Blocks.PEONY);
// Let baritone move items to hotbar to use them
// Reduces a bit of far rendering to save FPS
getClientBaritoneSettings().fadePath.value = true;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/adris/altoclef/AltoClefCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public AltoClefCommands() throws CommandException {
new SetGammaCommand(),
new ListCommand(),
new CoverWithSandCommand(),
new CoverWithBlocksCommand()
new CoverWithBlocksCommand(),
new SelfCareCommand()
//new TestMoveInventoryCommand(),
// new TestSwapInventoryCommand()
);
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/adris/altoclef/Playground.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import adris.altoclef.tasks.container.SmeltInFurnaceTask;
import adris.altoclef.tasks.container.StoreInAnyContainerTask;
import adris.altoclef.tasks.entity.KillEntityTask;
import adris.altoclef.tasks.entity.ShootArrowSimpleProjectileTask;
import adris.altoclef.tasks.examples.ExampleTask2;
import adris.altoclef.tasks.misc.EquipArmorTask;
import adris.altoclef.tasks.misc.PlaceBedAndSetSpawnTask;
Expand All @@ -31,7 +32,9 @@
import adris.altoclef.util.helpers.WorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.GhastEntity;
import net.minecraft.entity.mob.ZombieEntity;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
Expand All @@ -43,6 +46,7 @@

import java.io.*;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;

/**
Expand Down Expand Up @@ -335,6 +339,18 @@ public static void TEMP_TEST_FUNCTION(AltoClef mod, String arg) {
new ItemTarget("netherite_leggings", 1),
new ItemTarget("netherite_boots", 1)));
break;
case "arrow":

List<GhastEntity> ghasts = mod.getEntityTracker().getTrackedEntities(GhastEntity.class);

if (ghasts.size() == 0) {
Debug.logWarning("No ghasts found.");
break;
}

GhastEntity ghast = ghasts.get(0);
mod.runUserTask(new ShootArrowSimpleProjectileTask(ghast));
break;
case "whisper": {
File check = new File("whisper.txt");
try {
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/adris/altoclef/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,19 @@ public class Settings implements IFailableConfigFile {
*/
private String idleCommand = "";


/**
* If set, will run this command after death.
* Also {deathmessage} will be replaced with the death message.
* <p>
* For example, try setting this to "@goto <Your base coords>" to make the bot go to the base before continuing the task it was given.
* Or setting it to "I died!" will send the i died message
* Or setting it to "/back" will execute /back on the server
* When running altoclef commands, if the prefix is not @, the set prefix should be used for the command and not @
* You may run multiple commands even commands of differet type by splitting them with " & ". Example: /home & i died with message: {deathmessage} & @get diamond
*/
private String deathCommand = "";

/**
* If we need to throw away something, throw away these items first.
*/
Expand Down Expand Up @@ -507,6 +520,10 @@ public String getIdleCommand() {
return idleCommand;
}

public String getDeathCommand() {
return deathCommand;
}

public boolean shouldRunIdleCommandWhenNotActive() {
return idleCommand != null && !idleCommand.isBlank();
}
Expand Down
27 changes: 24 additions & 3 deletions src/main/java/adris/altoclef/TaskCatalogue.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class TaskCatalogue {
mine("diamond", MiningRequirement.IRON, new Block[]{Blocks.DIAMOND_ORE, Blocks.DEEPSLATE_DIAMOND_ORE}, Items.DIAMOND);
mine("emerald", MiningRequirement.IRON, new Block[]{Blocks.EMERALD_ORE, Blocks.DEEPSLATE_EMERALD_ORE}, Items.EMERALD);
mine("redstone", MiningRequirement.IRON, new Block[]{Blocks.REDSTONE_ORE, Blocks.DEEPSLATE_REDSTONE_ORE}, Items.REDSTONE);
mine("lapis_lazuli", MiningRequirement.IRON, new Block[]{Blocks.LAPIS_ORE, Blocks.DEEPSLATE_LAPIS_ORE}, Items.LAPIS_LAZULI);
mine("lapis_lazuli", MiningRequirement.STONE, new Block[]{Blocks.LAPIS_ORE, Blocks.DEEPSLATE_LAPIS_ORE}, Items.LAPIS_LAZULI);
alias("lapis", "lapis_lazuli");
mine("amethyst_shard", MiningRequirement.WOOD, Blocks.AMETHYST_CLUSTER, Items.AMETHYST_SHARD);
mine("pointed_dripstone", MiningRequirement.WOOD, Blocks.POINTED_DRIPSTONE, Items.POINTED_DRIPSTONE);
Expand All @@ -88,6 +88,7 @@ public class TaskCatalogue {
mine("acacia_sapling", Blocks.ACACIA_LEAVES, Items.ACACIA_SAPLING);
mine("dark_oak_sapling", Blocks.DARK_OAK_LEAVES, Items.DARK_OAK_SAPLING);
mine("mangrove_propagule", Blocks.MANGROVE_PROPAGULE, Items.MANGROVE_PROPAGULE);
mine("cherry_sapling", Blocks.CHERRY_LEAVES, Items.CHERRY_SAPLING);
simple("sapling", ItemHelper.SAPLINGS, CollectSaplingsTask::new);
simple("sandstone", Items.SANDSTONE, CollectSandstoneTask::new).dontMineIfPresent();
simple("red_sandstone", Items.RED_SANDSTONE, CollectRedSandstoneTask::new).dontMineIfPresent();
Expand All @@ -100,7 +101,7 @@ public class TaskCatalogue {
simple("egg", Items.EGG, CollectEggsTask::new);
mob("bone", Items.BONE, SkeletonEntity.class);
mob("gunpowder", Items.GUNPOWDER, CreeperEntity.class);
mob("ender_pearl", Items.ENDER_PEARL, EndermanEntity.class).anyDimension();
simple("ender_pearl", Items.ENDER_PEARL, KillEndermanTask::new);
mob("spider_eye", Items.SPIDER_EYE, SpiderEntity.class);
mob("leather", Items.LEATHER, CowEntity.class);
mob("feather", Items.FEATHER, ChickenEntity.class);
Expand Down Expand Up @@ -153,7 +154,7 @@ public class TaskCatalogue {
}
mine("bamboo", Blocks.BAMBOO, Items.BAMBOO);
shear("vine", Blocks.VINE, Items.VINE).dontMineIfPresent();
shear("grass", Blocks.GRASS, Items.GRASS).dontMineIfPresent();
shear("grass", Blocks.GRASS_BLOCK, Items.GRASS_BLOCK).dontMineIfPresent();
shear("lily_pad", Blocks.LILY_PAD, Items.LILY_PAD).dontMineIfPresent();
shear("tall_grass", Blocks.TALL_GRASS, Items.TALL_GRASS).dontMineIfPresent();
shear("fern", Blocks.FERN, Items.FERN).dontMineIfPresent();
Expand Down Expand Up @@ -190,6 +191,9 @@ public class TaskCatalogue {


// MATERIALS
//mine("netherite_upgrade_smithing_template", MiningRequirement.HAND, Blocks.CHEST, Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE).forceDimension(Dimension.NETHER);
simple("netherite_upgrade_smithing_template", Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, GetSmithingTemplateTask::new);
alias("netherite_upgrade", "netherite_upgrade_smithing_template");
simple("planks", ItemHelper.PLANKS, CollectPlanksTask::new).dontMineIfPresent();
// Per-tree Planks. At the moment, nether planks need to be specified that their logs are in the nether.
for (CataloguedResource woodCatalogue : woodTasks("planks", wood -> wood.planks, (wood, count) -> {
Expand All @@ -203,6 +207,11 @@ public class TaskCatalogue {
// Don't mine individual planks either!! Handled internally.
woodCatalogue.dontMineIfPresent();
}
simple("stripped_logs", ItemHelper.STRIPPED_LOGS, CollectStrippedLogTask::new).dontMineIfPresent();
for (CataloguedResource woodCatalogue : woodTasks("stripped_logs", wood -> wood.strippedLog,
(wood, count) -> new CollectStrippedLogTask(wood.strippedLog, count))) {
woodCatalogue.dontMineIfPresent();
}
// shapedRecipe2x2("stick", Items.STICK, 4, p, o, p, o);
simple("stick", Items.STICK, CollectSticksTask::new);
smelt("stone", Items.STONE, "cobblestone").dontMineIfPresent();
Expand Down Expand Up @@ -243,6 +252,8 @@ public class TaskCatalogue {
shapedRecipe2x2("sugar", Items.SUGAR, 1, "sugar_cane", o, o, o);
shapedRecipe2x2("bone_meal", Items.BONE_MEAL, 3, "bone", o, o, o);
shapedRecipe2x2("melon_seeds", Items.MELON_SEEDS, 1, "melon_slice", o, o, o);
shapedRecipe2x2("bamboo_planks", Items.BAMBOO_PLANKS, 2, "bamboo_block", o, o, o);
shapedRecipe3x3Block("bamboo_block", Items.BAMBOO_BLOCK, "bamboo");
simple("hay_block", Items.HAY_BLOCK, CollectHayBlockTask::new).dontMineIfPresent();
shapedRecipe2x2Block("polished_andesite", Items.POLISHED_ANDESITE, 4, "andesite");
shapedRecipe2x2Block("polished_diorite", Items.POLISHED_DIORITE, 4, "diorite");
Expand Down Expand Up @@ -276,6 +287,7 @@ public class TaskCatalogue {
String b = "nether_brick";
shapedRecipe3x3("nether_brick_fence", Items.NETHER_BRICK_FENCE, 6, o, o, o, B, b, B, B, b, B);
}
shapedRecipe3x3("brush", Items.BRUSH, 1, o, "feather", o, o, "copper_ingot", o, o, s, o);
shapedRecipe3x3("paper", Items.PAPER, 3, "sugar_cane", "sugar_cane", "sugar_cane", o, o, o, o, o, o);
shapedRecipe2x2("book", Items.BOOK, 1, "paper", "paper", "paper", "leather");
shapedRecipe2x2("writable_book", Items.WRITABLE_BOOK, 1, "book", "ink_sac", o, "feather");
Expand Down Expand Up @@ -459,6 +471,8 @@ public class TaskCatalogue {
shapedRecipe3x3("observer", Items.OBSERVER, 1, c, c, c, "redstone", "redstone", "quartz", c, c, c);
shapedRecipe2x2("lever", Items.LEVER, 1, s, o, c, o);
}
simple("hanging_sign", ItemHelper.WOOD_HANGING_SIGN, CollectHangingSignTask::new).dontMineIfPresent();
woodTasks("hanging_sign", woodItems -> woodItems.hangingSign, (woodItems, count) -> new CollectHangingSignTask(woodItems.hangingSign, woodItems.prefix + "_stripped_logs", count));
shapedRecipe3x3("chest", Items.CHEST, 1, p, p, p, p, o, p, p, p, p).dontMineIfPresent();
shapedRecipe2x2("torch", Items.TORCH, 4, "coal", o, s, o);
simple("bed", ItemHelper.BED, CollectBedTask::new);
Expand All @@ -483,6 +497,7 @@ public class TaskCatalogue {
}
{
String b = "brick";
shapedRecipe3x3("decorated_pot", Items.DECORATED_POT, 1, o, b, o, b, o, b, o, b, o);
shapedRecipe3x3("flower_pot", Items.FLOWER_POT, 1, b, o, b, o, b, o, o, o, o);
shapedRecipe2x2Block("bricks", Items.BRICKS, b);
shapedRecipeSlab("brick_slab", Items.BRICK_SLAB, b);
Expand Down Expand Up @@ -537,6 +552,7 @@ public class TaskCatalogue {
woodTasks("fence_gate", woodItems -> woodItems.fenceGate, (woodItems, count) -> new CollectFenceGateTask(woodItems.fenceGate, woodItems.prefix + "_planks", count));
{
String r = "wooden_slab";
shapedRecipe3x3("chiseled_bookshelf", Items.CHISELED_BOOKSHELF, 1, p, p, p, r, r, r, p, p, p).dontMineIfPresent();
shapedRecipe3x3("barrel", Items.BARREL, 1, p, r, p, p, o, p, p, r, p);
shapedRecipe3x3("cartography_table", Items.CARTOGRAPHY_TABLE, 1, "paper", "paper", o, p, p, o, p, p, o);
shapedRecipe3x3("composter", Items.COMPOSTER, 1, r, o, r, r, o, r, r, r, r);
Expand Down Expand Up @@ -715,6 +731,11 @@ private static CataloguedResource simple(String name, Item matches, Function<Int
return simple(name, new Item[]{matches}, getTask);
}

// TODO: Do I really need this?
//private static CataloguedResource task(Item matches, Function<Integer, ResourceTask> getTask){
//
//}

private static CataloguedResource mine(String name, MiningRequirement requirement, Item[] toMine, Item... targets) {
Block[] toMineBlocks = new Block[toMine.length];
for (int i = 0; i < toMine.length; ++i) toMineBlocks[i] = Block.getBlockFromItem(toMine[i]);
Expand Down
Loading