altoclef icon indicating copy to clipboard operation
altoclef copied to clipboard

Concise task tree

Open KTibow opened this issue 3 years ago • 4 comments

Command Before After
@get log
@get planks
@get bed
@get iron_ingot
@equip diamond

KTibow avatar Feb 09 '22 02:02 KTibow

Pretty neat

Bluscream avatar Feb 10 '22 02:02 Bluscream

ty, its still a heavy WIP

KTibow avatar Feb 10 '22 02:02 KTibow

Your commits are better than mine somehow

SnivyLlama avatar Feb 11 '22 01:02 SnivyLlama

i dont want this send anymore

V sre., 23. mar. 2022 20:00 je oseba TacoTechnica @.***> napisala:

@.**** requested changes on this pull request.

What James said lol.

Whenever you see "(See later review comment)" that means we can remove this change and instead have the printing handled as a Helper Function (in ItemHelper most likely). This helper function would be given an ItemHelper and would check if the Items are a FULL list of oak planks/logs/anything or a FULL list of beds/carpets/anything. This would take use ItemHelper.getWoodItems() and ItemHelper.getColorfulItems().

In src/main/java/adris/altoclef/tasks/CraftInInventoryTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833518717 :

@@ -96,20 +94,28 @@ protected boolean isEqualResource(ResourceTask other) { return false; }

  • @Override
  • protected String toDebugString() {
  •    // Prevent redundancy
    
  •    // eg Craft 2x2 CraftingRecipe{craft planks} for *acacia_planks x4*: [*acacia_planks x4*]
    
  •    // given that the RecipeTarget already contains the goal of what to get
    
  •    return toDebugStringName();
    

Just do toCraftingDebugStringName() + " " + _target; here and remove the override to toDebugStringName

In src/main/java/adris/altoclef/tasks/CraftInInventoryTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833518939 :

 @Override
 protected String toDebugStringName() {
     return toCraftingDebugStringName() + " " + _target;
 }
  • protected String toCraftingDebugStringName() {
  •    return "Craft 2x2";
    

Include this in toDebugString so we don't have extra functions

In src/main/java/adris/altoclef/tasks/ResourceTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833522609 :

@@ -250,4 +253,19 @@ public ResourceTask forceDimension(Dimension dimension) { public ItemTarget[] getItemTargets() { return _itemTargets; }

  • public String getItemName() {

This should probably be a static function in ItemHelper

In src/main/java/adris/altoclef/tasks/entity/DoToClosestEntityTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833524215 :

@@ -92,6 +92,10 @@ protected boolean isEqual(Task other) {

 @Override
 protected String toDebugString() {
  •    return "Doing something to closest entity...";
    
  •    return "Running a task on " + (
    
  •        _targetEntities.length > 1 ?
    

Make this a helper function in EntityHelper

In src/main/java/adris/altoclef/tasks/resources/CollectBedTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833525034 :

@@ -19,8 +19,14 @@

 public CollectBedTask(Item[] beds, ItemTarget wool, int count) {
     // Top 3 are wool, must be the same.
  •    super(new ItemTarget(beds, count), colorfulItems -> colorfulItems.wool, colorfulItems -> colorfulItems.bed, createBedRecipe(wool), new boolean[]{true, true, true, false, false, false, false, false, false});
    
  •    _visualBedTarget = new ItemTarget(beds, count);
    
  •    super(
    
  •        beds.length > 1 ? new ItemTarget(beds, count, "any bed") : new ItemTarget(beds, count),
    

(See later review comment)

In src/main/java/adris/altoclef/tasks/resources/CollectPlanksTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833537680 :

@@ -20,7 +20,7 @@ private boolean _logsInNether;

 public CollectPlanksTask(Item[] planks, Item[] logs, int count, boolean logsInNether) {
  •    super(new ItemTarget(planks, count));
    
  •    super(planks.length > 1 ? new ItemTarget(planks, count, "any planks") : new ItemTarget(planks, count));
    

(See later review comment)

In src/main/java/adris/altoclef/tasks/resources/CollectPlanksTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833537812 :

@@ -73,15 +73,15 @@ protected Task onResourceTick(AltoClef mod) { }

     // Collect planks and logs
  •    ArrayList<ItemTarget> blocksTomine = new ArrayList<>(2);
    
  •    blocksTomine.add(new ItemTarget(_logs));
    
  •    ArrayList<ItemTarget> blocksToMine = new ArrayList<>(2);
    
  •    blocksToMine.add(new ItemTarget(_logs, "any logs"));
    

(See later review comment)

In src/main/java/adris/altoclef/tasks/resources/CollectWoolTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833538060 :

@@ -24,7 +24,7 @@ private final Item[] _wools;

 public CollectWoolTask(DyeColor[] colors, int count) {
  •    super(new ItemTarget(ItemHelper.WOOL, count));
    
  •    super(new ItemTarget(ItemHelper.WOOL, count, "any wool"));
    

(See later review comment)

In src/main/java/adris/altoclef/tasks/resources/CollectWoolTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833538123 :

@@ -66,7 +66,7 @@ protected Task onResourceTick(AltoClef mod) { // If we find a wool block, break it. Block[] woolBlocks = ItemHelper.itemsToBlocks(_wools); if (mod.getBlockTracker().anyFound(woolBlocks)) {

  •        return new MineAndCollectTask(new ItemTarget(_wools), woolBlocks, MiningRequirement.HAND);
    
  •        return new MineAndCollectTask(new ItemTarget(_wools, "any wool"), woolBlocks, MiningRequirement.HAND);
    

(See later review comment)

In src/main/java/adris/altoclef/tasks/resources/CollectWoolTask.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833539501 :

@@ -89,7 +89,7 @@ protected Task onResourceTick(AltoClef mod) { return _colors.contains(sheep.getColor()) && !sheep.isSheared(); } return false;

  •    }, new ItemTarget(_wools, _count));
    
  •    }, new ItemTarget(_wools, _count, "any wool"));
    

(See later review comment)

In src/main/java/adris/altoclef/ui/CommandStatusOverlay.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833542097 :

         }
     } else {
         float fontHeight = renderer.fontHeight;
  •        if (mod.getModSettings().shouldShowTimer()) { //If it's enabled
    
  •            _lastTime = Instant.now().toEpochMilli(); //keep the last time for the timer reset
    
  •            String _realTime = DATE_TIME_FORMATTER.format(Instant.now().minusMillis(_timeRunning)); //Format the running time to string
    
  •            renderer.draw(stack, "<"+_realTime+">", dx, dy, color);//Draw the timer before drawing tasks list
    
  •            dx += 8;//Do the same thing to list the tasks
    
  •        // Draw the timer
    

Why is the diff so big here? The only thing changed is "<"+_realTime+">"

In src/main/java/adris/altoclef/ui/CommandStatusOverlay.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833545033 :

             dy += fontHeight + 2;
         }
  •        // Draw the item chain
    
  •        List<String> itemChain = new ArrayList<>();
    

I'm 50/50 on this change, on one hand altoclef is not just a resource collection bot, but on the other hand I really like how this gives a rough outline on what the bot is doing. I'd say we should add a setting that controls this (reference Settings.shouldShowTimer())

In src/main/java/adris/altoclef/util/ItemTarget.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833545488 :

@@ -27,7 +27,12 @@ public ItemTarget(Item[] items, int targetCount) { _itemMatches = items; _targetCount = targetCount;

  •    _infinite = false;
    
  •    if (items.length > 1) {
    

(See later review comment)

In src/main/java/adris/altoclef/util/ItemTarget.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833545700 :

@@ -36,6 +41,12 @@ public ItemTarget(String catalogueName, int targetCount) { _targetCount = targetCount; }

  • public ItemTarget(Item[] items, int targetCount, String catalogueName) {

(See later review comment)

In src/main/java/adris/altoclef/util/ItemTarget.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833545795 :

@@ -48,6 +59,10 @@ public ItemTarget(Item[] items) { this(items, 1); }

  • public ItemTarget(Item[] items, String catalogueName) {

(See later review comment)

In src/main/java/adris/altoclef/util/ItemTarget.java https://github.com/gaucho-matrero/altoclef/pull/212#discussion_r833546339 :

@@ -158,12 +182,15 @@ public String toString() { result.append(","); } }

  •        result.append("]");
    
  •        if (_itemMatches.length > 1) {
    

(See later review comment)

— Reply to this email directly, view it on GitHub https://github.com/gaucho-matrero/altoclef/pull/212#pullrequestreview-919142008, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUAR3VYQ2Q3ZA3C3LVF42BTVBNS4ZANCNFSM5N4HJROA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Mankifg avatar Mar 23 '22 19:03 Mankifg

Stale and conflicting

KTibow avatar Oct 13 '23 00:10 KTibow