Skip to content

Cavalry 3 of 4#11529

Open
armele wants to merge 27 commits intoldtteam:version/mainfrom
armele:cavalry_3of4
Open

Cavalry 3 of 4#11529
armele wants to merge 27 commits intoldtteam:version/mainfrom
armele:cavalry_3of4

Conversation

@armele
Copy link
Copy Markdown
Contributor

@armele armele commented Feb 3, 2026

PR 1 of 4: Tags & associated utility methods. (Complete)
PR 2 of 4: Cavalry Horse Entity (Complete)
PR 3 of 4: Stable, Stablemaster, Horse Goals, Cavalry Job (this PR)
PR 4 of 4: Enabling the Cavalry barracks module, inserting the Stable recipe, including at least some stable blueprints

Changes proposed in this pull request

  • Introduce the Stable building, and Stablemaster AI
  • Introduce the Cavalry Job and Cavalry AI

Stablemaster

  • Extends herding logic
  • Train vanilla horses into Cavalry Horse
  • Feed cavalry horses (to heal them)
  • Breed vanilla horses
  • Use saddle and other tagged items to ready horses for combat.

Stable style guidance

  • A stable building should include an opening large enough for a mounted unit (recommend 2 wide by 3 tall)
  • At least 2 x building level positions within the building should be designated with the "stall" tag, designating a horse stall.
  • Mounted units can open gates, but cannot open doors, so the building area that includes the stalls should be accessed via gate, if enclosed. The minecolonies gates work well for this.

Cavalry

  • Extends Knight combat AI
  • 20% Bonus to damage and range (given cost and maintenance of mounts)
  • Finds and mounts horses prior to combat. (First checks locally, then checks stable.)
  • Building patrol is changed to outside corner (rather than hut block) to accommodate door restrictions.

Cavalry Horse goals

  • They automatically assign themselves a home stable, if unassigned and one is found.
  • Return to the stable shortly after being dismounted.
  • Wandering is governed by whether or not they're already in a stable.

Review please

commit b266ab2
Merge: c063f18 1188343
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Feb 2 11:47:35 2026 -0500

    Merge branch 'version/main' into cavalry_mergemaster

commit c063f18
Author: Al Mele <amele@carolina.rr.com>
Date:   Sun Feb 1 10:20:03 2026 -0500

    Update blockhutstable.json

commit 3da935e
Author: Al Mele <amele@carolina.rr.com>
Date:   Fri Jan 30 16:46:39 2026 -0500

    Original gitignore

commit d63d1b4
Author: Al Mele <amele@carolina.rr.com>
Date:   Fri Jan 30 16:44:48 2026 -0500

    Original buildfiles

commit 1daf917
Author: Al Mele <amele@carolina.rr.com>
Date:   Fri Jan 30 16:10:58 2026 -0500

    Merge conflict resolution

commit 10870e2
Merge: 43cd715 7665b29
Author: Al Mele <amele@carolina.rr.com>
Date:   Fri Jan 30 15:02:48 2026 -0500

    Merge branch 'version/main' into cavalry_mergemaster

commit 43cd715
Merge: 98e7098 078f994
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Dec 15 10:18:22 2025 -0500

    Merge branch 'version/main' into cavalry_mergemaster

commit 98e7098
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Dec 15 10:17:21 2025 -0500

    Fix client/server sync

commit ac2295c
Author: Al Mele <amele@carolina.rr.com>
Date:   Fri Dec 12 17:45:42 2025 -0500

    Continued Animal Management Refactoring

commit d5ac3bc
Author: Al Mele <amele@carolina.rr.com>
Date:   Thu Dec 11 21:46:30 2025 -0500

    Further animal management wiring.

commit fcc690d
Author: Al Mele <amele@carolina.rr.com>
Date:   Tue Dec 9 18:24:16 2025 -0500

    AnimalManager refactoring

commit e7f1ebc
Merge: c5b09a4 bd39948
Author: Al Mele <amele@carolina.rr.com>
Date:   Tue Dec 9 14:27:25 2025 -0500

    Merge branch 'ldtteam:version/main' into cavalry_mergemaster

commit c5b09a4
Author: Al Mele <amele@carolina.rr.com>
Date:   Tue Dec 9 12:38:55 2025 -0500

    IAnimalData management skeleton

commit 07fd669
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Dec 8 12:34:53 2025 -0500

    Update AbstractEntityAIGuard.java

commit 75c146b
Merge: 47ac6a2 cd08ddc
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Dec 8 12:22:08 2025 -0500

    Merge branch 'version/main' into cavalry_mergemaster

commit 47ac6a2
Merge: e7da40e 8ecab65
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Nov 17 15:16:09 2025 -0500

    Merge branch 'version/main' into cavalry_mergemaster

commit e7da40e
Author: Al Mele <amele@carolina.rr.com>
Date:   Sun Nov 9 15:59:07 2025 -0500

    Remove IMinecoloniesPather

commit 9dba1bd
Merge: 85a359d 5ef2954
Author: Al Mele <amele@carolina.rr.com>
Date:   Sun Nov 9 13:49:26 2025 -0500

    Merge branch 'version/main' into cavalry_mergemaster

commit 85a359d
Merge: 197c2ae 5a61978
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Nov 3 10:16:24 2025 -0500

    Merge branch 'version/main' into cavalry_mergemaster

commit 197c2ae
Merge: 5e4f66f 314103d
Author: Al Mele <amele@carolina.rr.com>
Date:   Wed Oct 15 14:32:15 2025 -0400

    Merge branch 'ldtteam:version/main' into cavalry_mergemaster

commit 5e4f66f
Merge: 03a5b40 ebee2d9
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Oct 6 09:21:28 2025 -0400

    Merge branch 'cavalry_mergemaster' of https://github.com/armele/minecolonies into cavalry_mergemaster

commit ebee2d9
Merge: e3ac9d4 d782fb4
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Oct 6 09:20:17 2025 -0400

    Merge branch 'ldtteam:version/main' into cavalry_mergemaster

commit 03a5b40
Merge: e3ac9d4 8dfacfa
Author: Al Mele <amele@carolina.rr.com>
Date:   Sat Oct 4 07:49:31 2025 -0400

    Merge branch 'version/main' into cavalry_mergemaster

commit e3ac9d4
Author: Al Mele <amele@carolina.rr.com>
Date:   Mon Sep 29 14:17:24 2025 -0400

    Code Review from Cavalry 1 of 4

commit d4bee4c
Merge: c0d50f7 766b606
Author: Al Mele <amele@carolina.rr.com>
Date:   Sun Sep 28 18:17:21 2025 -0400

    Merge branch 'version/main' into cavalry_mergemaster

commit c0d50f7
Author: Al Mele <amele@carolina.rr.com>
Date:   Fri Sep 26 07:04:04 2025 -0400

    Fix horse damage split.

commit 8e06d47
Author: Al Mele <amele@carolina.rr.com>
Date:   Thu Sep 25 21:32:25 2025 -0400

    Squashed commit of the following:

    commit 66a8b80
    Merge: cbc3f44 ca74d97
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Thu Sep 25 19:19:22 2025 -0400

        Merge branch 'ldtteam:version/main' into cavalry

    commit cbc3f44
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Thu Sep 25 19:18:58 2025 -0400

        Cavalry Testing Updates

    commit 78bbf8f
    Merge: e1f6d9a 202c5c5
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Wed Sep 24 08:49:49 2025 -0400

        Merge branch 'ldtteam:version/main' into cavalry

    commit e1f6d9a
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Sat Sep 20 18:56:17 2025 -0400

        Cavalry gate opening

    commit 01950c3
    Merge: dafc784 a9fc65b
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Sat Sep 20 08:27:48 2025 -0400

        Merge branch 'ldtteam:version/main' into cavalry

    commit dafc784
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Sat Sep 20 08:27:27 2025 -0400

        Horse Upkeep

    commit 39aec24
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Fri Sep 19 10:06:54 2025 -0400

        Refactor cavalry overlay names

    commit f28a8d1
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Fri Sep 19 02:31:45 2025 -0400

        Cavalry tuning

    commit cfa05df
    Merge: dfe0187 5ef6643
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Thu Sep 18 13:51:25 2025 -0400

        Merge branch 'ldtteam:version/main' into cavalry

    commit dfe0187
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Wed Sep 17 17:02:56 2025 -0400

        Stable and Stablemaster basics

    commit e2563b8
    Merge: 21443fa 8cff9ca
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Mon Sep 15 15:57:30 2025 -0400

        Merge branch 'ldtteam:version/main' into cavalry

    commit 21443fa
    Merge: ce06af8 1ebb18c
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Sat Sep 13 06:32:08 2025 -0400

        Merge branch 'ldtteam:version/main' into cavalry

    commit ce06af8
    Merge: 01e5e85 0f2ec92
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Thu Sep 4 20:43:48 2025 -0400

        Merge branch 'ldtteam:version/main' into cavalry

    commit 01e5e85
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Thu Sep 4 20:43:17 2025 -0400

        Cavalry adaptations

    commit 74d4567
    Merge: 0a9dedf 7f820b3
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Mon Sep 1 12:26:36 2025 -0400

        Merge branch 'version/main' into cavalry

    commit 0a9dedf
    Author: Al Mele <amele@carolina.rr.com>
    Date:   Sun Aug 31 23:11:33 2025 -0400

        Initial job and AI for cavalry.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 3, 2026

In order for this pull request to be merged, make sure you test whether your changes work.

If the changes are working as intended, remove the https://github.com/ldtteam/minecolonies/labels/undefined label from the pull request.
As long as this label is on the pull request, it will not be merged.
If your pull request made no changes to the source code, the label will not be automatically added to the pull request.

Contributors, please review this pull request!

@armele
Copy link
Copy Markdown
Contributor Author

armele commented Feb 3, 2026

I have tested these changes. Please remove the "Untested" label. Thanks!

@Raycoms Raycoms removed the Untested label Feb 22, 2026
Recipe for spear
Make spear an acceptable weapon for Cavalry
Move work module to stable
Reduce damage bonus; give health bonus.
Create vulnerability to ranged damage.
 Implement "corner penalty"
Prioritize cavalry reacting to calls for help
@armele
Copy link
Copy Markdown
Contributor Author

armele commented Feb 27, 2026

Please remove the "Untested" label from this pull request. I have implemented the suggestions from the discussion on discord, and re-tested.

@armele
Copy link
Copy Markdown
Contributor Author

armele commented Mar 6, 2026

Please remove the "Untested" label. I have updated the patrol filter predicate to match the discussion in the discord (Stable and GateHouse only) and found and fixed a few missing string definitions - and retested.

@armele
Copy link
Copy Markdown
Contributor Author

armele commented Mar 20, 2026

Please remove the "Untested" label. I have updated from main and re-tested.

@Raycoms Raycoms removed the Untested label Mar 22, 2026
Comment thread src/main/java/com/minecolonies/core/colony/buildings/modules/BuildingModules.java Outdated
Comment thread src/main/java/com/minecolonies/core/entity/ai/cavalry/CavalryStrollGoal.java Outdated
Comment thread src/main/java/com/minecolonies/core/items/ItemSpear.java
@armele
Copy link
Copy Markdown
Contributor Author

armele commented Mar 23, 2026

Code review feedback has been addressed, and retested. Please remove the "untested" label.

@armele
Copy link
Copy Markdown
Contributor Author

armele commented Mar 29, 2026

Updated to drop base spear damage down to match sword damage and adjusted recipe to avoid mod conflicts.

The KnightCombatAI owns the final damage from the use of the spear (just as with sword), so research-based scaling and server config scaling applies.

Re-tested. Please review the "Untested" flag.

Copy link
Copy Markdown
Contributor

@someaddons someaddons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments to adress :)

Comment thread src/main/java/com/minecolonies/core/colony/jobs/JobCavalry.java Outdated
private long lastDismountTime = -1;

/**
* The number of nodes to look ahead when checking for ladder climbing.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

horse ladder climbing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually used to see if the requested path includes an upcoming ladder, in which case the rider will dismount.

Comment thread src/main/java/com/minecolonies/core/entity/other/cavalry/CavalryHorseEntity.java Outdated
final float alignedYaw = approachYaw(cavunit.getYRot(), horseYaw, RIDER_ALIGN_MAX_STEP_DEGREES);
cavunit.setYRot(alignedYaw);
cavunit.setYBodyRot(alignedYaw);
cavunit.setYHeadRot(alignedYaw);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the citizen looking at nearby entities still work?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it does not... I'll take a look at the LookHandler.

if ((dx * dx + dz * dz) > LOOK_AT_HORIZONTAL_EPSILON)
{
// Keep rider gaze level so vertical path steps do not force erratic turning.
cavunit.getLookControl().setLookAt(targetX, cavunit.getEyeY(), targetZ, 20.0F, 30.0F);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check out the "LookHandler" which we're using as custom look control for similar things, might make more sense to use its logic/move this logic there

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced this logic with LookHandler, and the cav units now eye me suspiciously when I loiter nearby.

@armele
Copy link
Copy Markdown
Contributor Author

armele commented Apr 15, 2026

Updated with adjustments per code review feedback (thanks - always feel like I learn from these), and re-tested. Please remove the "Untested" tag.

@armele
Copy link
Copy Markdown
Contributor Author

armele commented Apr 24, 2026

Please remove the "Untested" flag. Thanks!

@Raycoms Raycoms removed the Untested label Apr 24, 2026
MinecoloniesAdvancedPathNavigate pathNavigation = new MinecoloniesAdvancedPathNavigate(this, level);
pathNavigation.getPathingOptions().setEnterDoors(false);
pathNavigation.getPathingOptions().setEnterGates(true);
pathNavigation.getPathingOptions().setEnterGates(false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think gates should be fine when mounted on horse

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this location these options apply to the "horse without rider" scenario; the ridden options are applied in MineColoniesAdvancedPathNavigate.getOptionsForPathJob(), and the ability to enter gates is toggled there.

@armele
Copy link
Copy Markdown
Contributor Author

armele commented Apr 25, 2026

Addressed code review comments I'd previously missed, refactored the building work module (now allows cavalry units equal to building level, plus one stablemaster) and fixed patrolling to patrol in groups. Please remove the "Untested" label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants