Skip to content

Commit

Permalink
Updated to 1.20.1 for bug fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvionKirito committed Aug 9, 2023
1 parent f7fcc63 commit 47c3562
Show file tree
Hide file tree
Showing 29 changed files with 454 additions and 118 deletions.
24 changes: 12 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "fabric-loom" version "1.2-SNAPSHOT"
id "fabric-loom" version "1.3-SNAPSHOT"
id "maven-publish"
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
Expand Down Expand Up @@ -32,24 +32,24 @@ dependencies {
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")

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

// 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')
shadow('com.fasterxml.jackson.core:jackson-annotations:2.15.0')
shadow('com.fasterxml.jackson.core:jackson-databind:2.15.0')
shadow('com.fasterxml.jackson.core:jackson-core:2.15.2')
shadow('com.fasterxml.jackson.core:jackson-annotations:2.15.2')
shadow('com.fasterxml.jackson.core:jackson-databind:2.15.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"
// Must run build from baritone-plus once
modImplementation 'baritone-api-fabric:baritone-unoptimized-1.20.1-beta1'
include "baritone-api-fabric:baritone-unoptimized-1.20.1-beta1"
} else {
modImplementation "cabaletta:baritone-unoptimized-fabric:1.19.4-beta1"
include "cabaletta:baritone-unoptimized-fabric:1.19.4-beta1"
modImplementation "cabaletta:baritone-unoptimized:1.20.1-beta1"
include "cabaletta:baritone-unoptimized:1.20.1-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
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.2
loader_version=0.14.19
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.14.22
# Mod Properties
mod_version=1.19.4-beta3
mod_version=1.20.1-beta1
maven_group=gaucho-matrero.altoclef
archives_base_name=altoclef
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.81.1+1.19.4
fabric_version=0.86.1+1.20.1
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.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 13 additions & 0 deletions src/main/java/adris/altoclef/TaskCatalogue.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 Down Expand Up @@ -203,6 +204,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 +249,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 +284,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 +468,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 +494,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 +549,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
3 changes: 2 additions & 1 deletion src/main/java/adris/altoclef/chains/DeathMenuChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ public float getPriority(AltoClef mod) {
Debug.logWarning("Failed to re-connect to server, no server entry cached.");
} else {
MinecraftClient client = MinecraftClient.getInstance();
ConnectScreen.connect(screen, client, ServerAddress.parse(_prevServerEntry.address), _prevServerEntry);
ConnectScreen.connect(screen, client, ServerAddress.parse(_prevServerEntry.address), _prevServerEntry, false);
//ConnectScreen.connect(screen, client, ServerAddress.parse(_prevServerEntry.address), _prevServerEntry);
//client.setScreen(new ConnectScreen(screen, client, _prevServerEntry));
}
}
Expand Down
25 changes: 17 additions & 8 deletions src/main/java/adris/altoclef/chains/MobDefenseChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import adris.altoclef.util.slots.Slot;
import adris.altoclef.util.time.TimerGame;
import baritone.Baritone;
import baritone.api.utils.Rotation;
import baritone.api.utils.input.Input;
import net.minecraft.block.AbstractFireBlock;
import net.minecraft.block.Block;
Expand Down Expand Up @@ -78,7 +79,7 @@ private void startShielding(AltoClef mod) {
_shielding = true;
mod.getInputControls().hold(Input.SNEAK);
mod.getInputControls().hold(Input.CLICK_RIGHT);
mod.getClientBaritone().getPathingBehavior().softCancelIfSafe();
mod.getClientBaritone().getPathingBehavior().requestPause();
mod.getExtraBaritoneSettings().setInteractionPaused(true);
if (!mod.getPlayer().isBlocking()) {
ItemStack handItem = StorageHelper.getItemStackInSlot(PlayerSlot.getEquipSlot());
Expand Down Expand Up @@ -189,7 +190,9 @@ public float getPriorityInner(AltoClef mod) {
if (shieldSlot.getItem() != Items.SHIELD) {
mod.getSlotHandler().forceEquipItemToOffhand(Items.SHIELD);
} else {
startShielding(mod);
if (mod.getClientBaritone().getPathingBehavior().isSafeToCancel()){
startShielding(mod);
}
}
} else {
_doingFunkyStuff = true;
Expand All @@ -214,7 +217,9 @@ public float getPriorityInner(AltoClef mod) {
if (shieldSlot.getItem() != Items.SHIELD) {
mod.getSlotHandler().forceEquipItemToOffhand(Items.SHIELD);
} else {
startShielding(mod);
if (mod.getClientBaritone().getPathingBehavior().isSafeToCancel()){
startShielding(mod);
}
}
} else {
if (blowingUp == null) {
Expand Down Expand Up @@ -408,11 +413,15 @@ private BlockPos isInsideFireAndOnFire(AltoClef mod) {
}

private void putOutFire(AltoClef mod, BlockPos pos) {
LookHelper.lookAt(mod, pos);
Baritone b = mod.getClientBaritone();
if (LookHelper.isLookingAt(mod, pos)) {
b.getPathingBehavior().requestPause();
b.getInputOverrideHandler().setInputForceState(Input.CLICK_LEFT, true);
Optional<Rotation> reach = LookHelper.getReach(pos);
if (reach.isPresent()){
Baritone b = mod.getClientBaritone();
if (LookHelper.isLookingAt(mod, pos)) {
b.getPathingBehavior().requestPause();
b.getInputOverrideHandler().setInputForceState(Input.CLICK_LEFT, true);
return;
}
LookHelper.lookAt(mod, reach.get());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/adris/altoclef/commands/SelfCareCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class SelfCareCommand extends Command {
public SelfCareCommand() {
super("selfcare", "Care for self");
super("selfcare", "Care for self (Not finished and tested yet)");
}

@Override
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/adris/altoclef/control/KillAura.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ public void tickEnd(AltoClef mod) {
if (shieldSlot.getItem() != Items.SHIELD) {
mod.getSlotHandler().forceEquipItemToOffhand(Items.SHIELD);
} else {
startShielding(mod);
if (mod.getClientBaritone().getPathingBehavior().isSafeToCancel()){
startShielding(mod);
}
performDelayedAttack(mod);
return;
}
Expand Down Expand Up @@ -201,7 +203,7 @@ public void startShielding(AltoClef mod) {
_shielding = true;
mod.getInputControls().hold(Input.SNEAK);
mod.getInputControls().hold(Input.CLICK_RIGHT);
mod.getClientBaritone().getPathingBehavior().softCancelIfSafe();
mod.getClientBaritone().getPathingBehavior().requestPause();
mod.getExtraBaritoneSettings().setInteractionPaused(true);
if (!mod.getPlayer().isBlocking()) {
ItemStack handItem = StorageHelper.getItemStackInSlot(PlayerSlot.getEquipSlot());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class BlockModifiedByPlayerMixin {
at = @At("HEAD")
)
public void onBlockBroken(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfo ci) {
if (player.world == world) {
if (player.getWorld() == world) {
BlockBrokenEvent evt = new BlockBrokenEvent();
evt.blockPos = pos;
evt.blockState = state;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/adris/altoclef/mixins/ClientUIMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import adris.altoclef.eventbus.EventBus;
import adris.altoclef.eventbus.events.ClientRenderEvent;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -15,7 +15,7 @@ public final class ClientUIMixin {
method = "render",
at = @At("TAIL")
)
private void clientRender(MatrixStack stack, float tickDelta, CallbackInfo ci) {
EventBus.publish(new ClientRenderEvent(stack, tickDelta));
private void clientRender(DrawContext context, float tickDelta, CallbackInfo ci) {
EventBus.publish(new ClientRenderEvent(context.getMatrices(), tickDelta));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
import adris.altoclef.tasks.slot.ReceiveCraftingOutputSlotTask;
import adris.altoclef.tasksystem.ITaskUsesCraftingGrid;
import adris.altoclef.tasksystem.Task;
import adris.altoclef.util.JankCraftingRecipeMapping;
import adris.altoclef.util.RecipeTarget;
import adris.altoclef.util.helpers.ItemHelper;
import adris.altoclef.util.helpers.StorageHelper;
import adris.altoclef.util.slots.CraftingTableSlot;
import adris.altoclef.util.slots.PlayerSlot;
import adris.altoclef.util.slots.Slot;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Recipe;
import net.minecraft.screen.slot.SlotActionType;

import java.util.Optional;
Expand Down Expand Up @@ -92,9 +96,14 @@ protected Task onTick(AltoClef mod) {
}
}
setDebugState("Crafting.");
if (mod.getSlotHandler().canDoSlotAction()) {
StorageHelper.instantFillRecipeViaBook(mod, _target.getRecipe(), _target.getOutputItem(), true);
mod.getSlotHandler().registerSlotAction();
Optional<Recipe<?>> recipeToSend = JankCraftingRecipeMapping.getMinecraftMappedRecipe(_target.getRecipe(), _target.getOutputItem());
if (recipeToSend.isPresent()) {
if (mod.getSlotHandler().canDoSlotAction()) {
ClientPlayerEntity player = MinecraftClient.getInstance().player;
assert player != null;
mod.getController().clickRecipe(player.currentScreenHandler.syncId, recipeToSend.get(), true);
mod.getSlotHandler().registerSlotAction();
}
}
return null;
}
Expand Down
20 changes: 15 additions & 5 deletions src/main/java/adris/altoclef/tasks/InteractWithBlockTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,21 @@ public InteractWithBlockTask(Item toUse, Direction direction, BlockPos target, I
public InteractWithBlockTask(Item toUse, Direction direction, BlockPos target, Input interactInput, boolean walkInto, boolean shiftClick) {
this(new ItemTarget(toUse, 1), direction, target, interactInput, walkInto, shiftClick);
}

public InteractWithBlockTask(Item toUse, Direction direction, BlockPos target, boolean walkInto) {
this(new ItemTarget(toUse, 1), direction, target, walkInto);
}

public InteractWithBlockTask(Item toUse, Direction direction, BlockPos target){
this(new ItemTarget(toUse, 1), direction, target, Input.CLICK_RIGHT, false, false);
}
public InteractWithBlockTask(Item toUse, BlockPos target, boolean walkInto, Vec3i interactOffset) {
this(new ItemTarget(toUse, 1), target, walkInto, interactOffset);
}

public InteractWithBlockTask(Item toUse, Direction direction, BlockPos target, Vec3i interactOffset){
this(new ItemTarget(toUse, 1), direction, target, Input.CLICK_RIGHT, false, interactOffset, false);
}
public InteractWithBlockTask(Item toUse, BlockPos target, Vec3i interactOffset){
this(new ItemTarget(toUse, 1), null, target, Input.CLICK_RIGHT, false, interactOffset, false);
}
public InteractWithBlockTask(Item toUse, BlockPos target, boolean walkInto) {
this(new ItemTarget(toUse, 1), target, walkInto);
}
Expand All @@ -122,6 +128,9 @@ public InteractWithBlockTask(Item toUse, BlockPos target) {
this(new ItemTarget(toUse, 1), target);
}

public InteractWithBlockTask(BlockPos target, boolean shiftClick) {
this(ItemTarget.EMPTY, null, target, Input.CLICK_RIGHT, false, shiftClick);
}
public InteractWithBlockTask(BlockPos target) {
this(ItemTarget.EMPTY, null, target, Input.CLICK_RIGHT, false, false);
}
Expand Down Expand Up @@ -380,8 +389,7 @@ private ClickResponse rightClick(AltoClef mod) {

Optional<Rotation> reachable = getCurrentReach();
if (reachable.isPresent()) {
LookHelper.lookAt(mod, reachable.get());
if (LookHelper.isLookingAt(mod, reachable.get())) {
if (LookHelper.isLookingAt(mod, _target)) {
if (_toUse != null) {
mod.getSlotHandler().forceEquipItem(_toUse, false);
} else {
Expand All @@ -395,6 +403,8 @@ private ClickResponse rightClick(AltoClef mod) {
return ClickResponse.CLICK_ATTEMPTED;
}
//mod.getClientBaritone().getInputOverrideHandler().setInputForceState(_interactInput, true);
} else {
LookHelper.lookAt(mod, reachable.get());
}
return ClickResponse.WAIT_FOR_CLICK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,10 @@ protected Task onTick(AltoClef mod) {
mod.getClientBaritone().getCustomGoalProcess().onLostControl();
mod.getClientBaritone().getBuilderProcess().onLostControl();
if (!LookHelper.isLookingAt(mod, reach.get())) {
reach.ifPresent(rotation -> LookHelper.lookAt(mod, rotation));
}
if (LookHelper.isLookingAt(mod, reach.get())) {
// Tool equip is handled in `PlayerInteractionFixChain`. Oof.
mod.getClientBaritone().getInputOverrideHandler().setInputForceState(Input.CLICK_LEFT, true);
LookHelper.lookAt(mod, reach.get());
}
// Tool equip is handled in `PlayerInteractionFixChain`. Oof.
mod.getClientBaritone().getInputOverrideHandler().setInputForceState(Input.CLICK_LEFT, true);
} else {
setDebugState("Getting to block...");
if (isMining && mod.getPlayer().isTouchingWater()) {
Expand Down
Loading

0 comments on commit 47c3562

Please sign in to comment.