Skip to content

Commit ef8d9f4

Browse files
committed
Initial commit: add AutoTame mod for automatic horse-like animal taming
1 parent 13c3790 commit ef8d9f4

File tree

54 files changed

+297
-683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+297
-683
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ body:
5757
- type: input
5858
id: mod-version
5959
attributes:
60-
label: TemplateMod version
61-
description: The TemplateMod version(s) where this bug occurs in.
60+
label: AutoTame version
61+
description: The AutoTame version(s) where this bug occurs in.
6262
placeholder: 1.2.3
6363
validations:
6464
required: true

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,20 @@ jobs:
171171
uses: Kir-Antipov/mc-publish@v3.3
172172
with:
173173
# https://modrinth.com/settings/pats
174-
# modrinth-id: fo0Bar
175-
# modrinth-token: ${{ secrets.MODRINTH_API_TOKEN }}
174+
modrinth-id: 4BLiLbfu
175+
modrinth-token: ${{ secrets.MODRINTH_API_TOKEN }}
176176

177177
# https://legacy.curseforge.com/account/api-tokens
178-
# curseforge-id: 314159
179-
# curseforge-token: ${{ secrets.CF_API_TOKEN }}
178+
curseforge-id: 1349551
179+
curseforge-token: ${{ secrets.CF_API_TOKEN }}
180180

181181
github-tag: ${{ steps.release_info.outputs.tag_name }}
182182
github-token: ${{ secrets.GITHUB_TOKEN }}
183183

184184
files: ${{ steps.file_info.outputs.path }}
185185

186-
name: ${{ format('[{0}] {1} v{2} for mc{3}', matrix.mod_brand, steps.properties_g.outputs.mod_name, steps.properties_g.outputs.mod_version, steps.properties_v.outputs.minecraft_version) }}
187-
version: ${{ format('v{1}-mc{0}-{2}', steps.properties_v.outputs.minecraft_version, steps.properties_g.outputs.mod_version, matrix.mod_brand) }}
186+
name: ${{ format('[{0}] {1} v{2} for mc{3}', matrix.mod_brand, steps.properties_g.outputs.mod_name, steps.properties_g.outputs.mod_version, steps.properties_v.outputs.archive_mc_version) }}
187+
version: ${{ format('v{1}-mc{0}-{2}', steps.properties_v.outputs.archive_mc_version, steps.properties_g.outputs.mod_version, matrix.mod_brand) }}
188188
version-type: release
189189

190190
loaders: ${{ matrix.mod_brand }}

README.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
1-
**Mega hacky, still in dev, not elegant at all. Don't use!**
1+
# AutoTame
22

3-
## fabric-mod-template
3+
[🌏 简体中文](README.md) | [🌐 English](README_en.md)
44

5-
[![License](https://img.shields.io/github/license/Fallen-Breath/fabric-mod-template.svg)](http://www.gnu.org/licenses/lgpl-3.0.html)
6-
[![workflow](https://github.com/Fallen-Breath/fabric-mod-template/actions/workflows/gradle.yml/badge.svg)](https://github.com/Fallen-Breath/fabric-mod-template/actions/workflows/gradle.yml)
5+
**AutoTame** 是一个 **Minecraft 客户端模组**,用于简化原版 **驯服类马生物** 的操作。
76

8-
fallen's fabric mod template
9-
10-
If you find it helpful, a credit to this template in your project will be greatly appreciated
11-
12-
## To use
13-
14-
1. Clone / Use this template to get a new project
15-
2. Search `[FEATURE]` in the project, delete or uncomment those addons
16-
3. Setup the mod
17-
- Edit java package name
18-
- Edit [gradle.properties](gradle.properties) for mod id / name etc.
19-
- Edit mod name in [bug_report.yml](.github/ISSUE_TEMPLATE/bug_report.yml)
20-
- Edit [common.gradle](common.gradle) for mod file location constants
21-
- Change the Minecraft versions in [settings.json](settings.json), [build.gradle](build.gradle), and files in the [versions](versions) folder
22-
- Search `template` in the project to see if there are any missing unedited stuffs
23-
4. Edit [README](README.md) for the new mod
7+
在原版中,当玩家尝试驯服 **类马生物(如马、驴、羊驼等)** 失败后,需要再次手动操作,而本模组会 **自动重新尝试驯服,直到成功**

README_en.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# AutoTame
2+
3+
[🌏 简体中文](README.md) | [🌐 English](README_en.md)
4+
5+
**AutoTame** is a **Minecraft client-side mod** that simplifies the process of **taming horse-like animals**.
6+
7+
In vanilla Minecraft, if a player fails to tame **horse-like animals (such as horses, donkeys, and llamas)**, they need to try again manually. This mod **automatically retries until the animal is successfully tamed**.

build.gradle

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,78 +14,28 @@ plugins {
1414
preprocess {
1515
strictExtraMappings = false
1616

17-
def mc114_fabric = createNode('1.14.4-fabric', 1_14_04, '')
1817
def mc115_fabric = createNode('1.15.2-fabric', 1_15_02, '')
1918
def mc116_fabric = createNode('1.16.5-fabric', 1_16_05, '')
2019
def mc117_fabric = createNode('1.17.1-fabric', 1_17_01, '')
21-
def mc118_fabric = createNode('1.18.2-fabric', 1_18_02, '')
22-
def mc119_fabric = createNode('1.19.4-fabric', 1_19_04, '')
23-
def mc1204_fabric = createNode('1.20.4-fabric', 1_20_04, '')
2420
def mc1206_fabric = createNode('1.20.6-fabric', 1_20_06, '')
25-
def mc1211_fabric = createNode('1.21.1-fabric', 1_21_01, '')
26-
def mc1213_fabric = createNode('1.21.3-fabric', 1_21_03, '')
27-
def mc1214_fabric = createNode('1.21.4-fabric', 1_21_04, '')
28-
def mc1215_fabric = createNode('1.21.5-fabric', 1_21_05, '')
29-
def mc1216_fabric = createNode('1.21.6-fabric', 1_21_06, '')
30-
def mc1218_fabric = createNode('1.21.8-fabric', 1_21_08, '')
3121

3222
def mc115_forge = createNode('1.15.2-forge', 1_15_02, '')
3323
def mc116_forge = createNode('1.16.5-forge', 1_16_05, '')
3424
def mc117_forge = createNode('1.17.1-forge', 1_17_01, '')
35-
def mc118_forge = createNode('1.18.2-forge', 1_18_02, '')
36-
def mc119_forge = createNode('1.19.4-forge', 1_19_04, '')
37-
def mc1204_forge = createNode('1.20.4-forge', 1_20_04, '')
3825
def mc1206_forge = createNode('1.20.6-forge', 1_20_06, '')
39-
def mc1211_forge = createNode('1.21.1-forge', 1_21_01, '')
40-
def mc1213_forge = createNode('1.21.3-forge', 1_21_03, '')
41-
def mc1214_forge = createNode('1.21.4-forge', 1_21_04, '')
42-
def mc1215_forge = createNode('1.21.5-forge', 1_21_05, '')
43-
def mc1216_forge = createNode('1.21.6-forge', 1_21_06, '')
44-
def mc1218_forge = createNode('1.21.8-forge', 1_21_08, '')
4526

4627
def mc1206_neoforge = createNode('1.20.6-neoforge', 1_20_06, '')
47-
def mc1211_neoforge = createNode('1.21.1-neoforge', 1_21_01, '')
48-
def mc1213_neoforge = createNode('1.21.3-neoforge', 1_21_03, '')
49-
def mc1214_neoforge = createNode('1.21.4-neoforge', 1_21_04, '')
50-
def mc1215_neoforge = createNode('1.21.5-neoforge', 1_21_05, '')
51-
def mc1216_neoforge = createNode('1.21.6-neoforge', 1_21_06, '')
52-
def mc1218_neoforge = createNode('1.21.8-neoforge', 1_21_08, '')
5328

54-
mc114_fabric .link(mc115_fabric , null)
5529
mc115_fabric .link(mc116_fabric , null)
5630
mc116_fabric .link(mc117_fabric , null)
57-
mc117_fabric .link(mc118_fabric , null)
58-
mc118_fabric .link(mc119_fabric , null)
59-
mc119_fabric .link(mc1204_fabric, null)
60-
mc1204_fabric.link(mc1206_fabric, null)
61-
mc1206_fabric.link(mc1211_fabric , null)
62-
mc1211_fabric.link(mc1213_fabric , null)
63-
mc1213_fabric.link(mc1214_fabric , null)
64-
mc1214_fabric.link(mc1215_fabric , null)
65-
mc1215_fabric.link(mc1216_fabric , null)
66-
mc1216_fabric.link(mc1218_fabric , null)
31+
mc117_fabric .link(mc1206_fabric , null)
6732

6833
mc115_fabric .link(mc115_forge , null)
6934
mc116_fabric .link(mc116_forge , null)
7035
mc117_fabric .link(mc117_forge , null)
71-
mc118_fabric .link(mc118_forge , null)
72-
mc119_fabric .link(mc119_forge , null)
73-
mc1204_fabric.link(mc1204_forge, null)
7436
mc1206_fabric.link(mc1206_forge, null)
75-
mc1211_fabric.link(mc1211_forge, null)
76-
mc1213_fabric.link(mc1213_forge, null)
77-
mc1214_fabric.link(mc1214_forge, null)
78-
mc1215_fabric.link(mc1215_forge, null)
79-
mc1216_fabric.link(mc1216_forge, null)
80-
mc1218_fabric.link(mc1218_forge, null)
8137

8238
mc1206_fabric.link(mc1206_neoforge, null)
83-
mc1211_fabric.link(mc1211_neoforge, null)
84-
mc1213_fabric.link(mc1213_neoforge, null)
85-
mc1214_fabric.link(mc1214_neoforge, null)
86-
mc1215_fabric.link(mc1215_neoforge, null)
87-
mc1216_fabric.link(mc1216_neoforge, null)
88-
mc1218_fabric.link(mc1218_neoforge, null)
8939
}
9040

9141
tasks.register('buildAndGather') {

common.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ dependencies {
6767
// include(annotationProcessor(implementation("io.github.llamalad7:mixinextras-${mod_brand}:${project.mixinextras_version}")))
6868
}
6969

70-
String MOD_ICON_PATH = 'assets/template_mod/icon.png'
71-
String MIXIN_CONFIG_PATH = 'template_mod.mixins.json'
72-
String LANG_DIR = 'assets/template_mod/lang'
70+
String MOD_ICON_PATH = 'assets/autotame/icon.png'
71+
String MIXIN_CONFIG_PATH = 'autotame.mixins.json'
72+
String LANG_DIR = 'assets/autotame/lang'
7373
JavaVersion JAVA_COMPATIBILITY
7474
if (mcVersion >= 12005 && !(mcVersion < 12100 && mod_brand == 'forge')) {
7575
JAVA_COMPATIBILITY = JavaVersion.VERSION_21
@@ -127,8 +127,8 @@ if (System.getenv("JITPACK") == "true") {
127127
fullArtifactVersion = artifactVersion + artifactVersionSuffix
128128
} else {
129129
base.archivesName = project.archives_base_name
130-
fullProjectVersion = 'v' + project.mod_version + '-mc' + project.minecraft_version + '-' + mod_brand + modVersionSuffix
131-
fullArtifactVersion = artifactVersion + '-mc' + project.minecraft_version + '-' + mod_brand + artifactVersionSuffix
130+
fullProjectVersion = 'v' + project.mod_version + '-mc' + project.archive_mc_version + '-' + mod_brand + modVersionSuffix
131+
fullArtifactVersion = artifactVersion + '-mc' + project.archive_mc_version + '-' + mod_brand + artifactVersionSuffix
132132
}
133133
version = fullProjectVersion
134134

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ org.gradle.jvmargs = -Xmx6G
33
org.gradle.parallel=true
44

55
# Mod Properties
6-
mod_id = template_mod
7-
mod_name = TemplateMod
6+
mod_id = autotame
7+
mod_name = AutoTame
88
mod_version = 1.0.0
99
maven_group = me.asone
10-
archives_base_name = template_mod
10+
archives_base_name = autotame
1111

1212
# Global Dependencies
1313
# https://github.com/Fallen-Breath/conditional-mixin
14-
conditionalmixin_version = 0.6.4
14+
# conditionalmixin_version = 0.6.4
1515

1616
# https://github.com/LlamaLad7/MixinExtras
1717
# mixinextras_version=0.3.6

settings.json

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,15 @@
11
{
22
"versions": [
3-
"1.14.4-fabric",
43
"1.15.2-fabric",
54
"1.16.5-fabric",
65
"1.17.1-fabric",
7-
"1.18.2-fabric",
8-
"1.19.4-fabric",
9-
"1.20.4-fabric",
106
"1.20.6-fabric",
11-
"1.21.1-fabric",
12-
"1.21.3-fabric",
13-
"1.21.4-fabric",
14-
"1.21.5-fabric",
15-
"1.21.6-fabric",
16-
"1.21.8-fabric",
177

188
"1.15.2-forge",
199
"1.16.5-forge",
2010
"1.17.1-forge",
21-
"1.18.2-forge",
22-
"1.19.4-forge",
23-
"1.20.4-forge",
2411
"1.20.6-forge",
25-
"1.21.1-forge",
26-
"1.21.3-forge",
27-
"1.21.4-forge",
28-
"1.21.5-forge",
29-
"1.21.6-forge",
30-
"1.21.8-forge",
3112

32-
"1.20.6-neoforge",
33-
"1.21.1-neoforge",
34-
"1.21.3-neoforge",
35-
"1.21.4-neoforge",
36-
"1.21.5-neoforge",
37-
"1.21.6-neoforge",
38-
"1.21.8-neoforge"
13+
"1.20.6-neoforge"
3914
]
4015
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* This file is part of the AutoTame project, licensed under the
3+
* GNU Lesser General Public License v3.0
4+
*
5+
* Copyright (C) 2025 As_One and contributors
6+
*
7+
* AutoTame is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Lesser General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* AutoTame is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public License
18+
* along with AutoTame. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
21+
package me.asone.autotame;
22+
23+
//#if FABRIC
24+
import net.fabricmc.api.ModInitializer;
25+
//#elseif FORGE
26+
//$$ import net.minecraftforge.fml.common.Mod;
27+
//#elseif NEOFORGE
28+
//$$ import net.neoforged.fml.common.Mod;
29+
//#endif
30+
31+
32+
//#if FORGE_LIKE
33+
//$$ @Mod(AutoTame.MOD_ID)
34+
//#endif
35+
public class AutoTame
36+
//#if FABRIC
37+
implements ModInitializer
38+
//#endif
39+
{
40+
public static final String MOD_ID = "autotame";
41+
42+
//#if FABRIC
43+
@Override
44+
public void onInitialize() {}
45+
//#elseif FORGE_LIKE
46+
//$$ public AutoTame() {}
47+
//#endif
48+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* This file is part of the AutoTame project, licensed under the
3+
* GNU Lesser General Public License v3.0
4+
*
5+
* Copyright (C) 2025 As_One and contributors
6+
*
7+
* AutoTame is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Lesser General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* AutoTame is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public License
18+
* along with AutoTame. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
21+
package me.asone.autotame;
22+
23+
import net.minecraft.client.MinecraftClient;
24+
import net.minecraft.entity.passive.HorseBaseEntity;
25+
import net.minecraft.util.Hand;
26+
27+
public class HorseEventTrigger {
28+
private static long statusTime = -1, ridingTime = -1;
29+
private static HorseBaseEntity statusHorse, ridingHorse;
30+
private static final long TIME_WINDOW = 100L;
31+
32+
private static final int DELAY_TICKS = 2;
33+
private static HorseBaseEntity delayedHorse = null;
34+
private static int remainingTicks = 0;
35+
36+
public enum Source {UPDATE_STATUS, STOP_RIDING}
37+
38+
public static void onEvent(HorseBaseEntity horse, Source src) {
39+
long now = System.currentTimeMillis();
40+
if (src == Source.UPDATE_STATUS) {
41+
statusTime = now;
42+
statusHorse = horse;
43+
} else if (src == Source.STOP_RIDING) {
44+
ridingTime = now;
45+
ridingHorse = horse;
46+
}
47+
48+
if (Math.abs(statusTime - ridingTime) > TIME_WINDOW || statusHorse == null || statusHorse != ridingHorse)
49+
return;
50+
51+
delayedHorse = horse;
52+
remainingTicks = DELAY_TICKS;
53+
clear();
54+
}
55+
56+
public static void tick() {
57+
if (delayedHorse == null) return;
58+
remainingTicks--;
59+
if (remainingTicks <= 0) {
60+
trigger(delayedHorse);
61+
delayedHorse = null;
62+
remainingTicks = 0;
63+
}
64+
}
65+
66+
private static void clear() {
67+
statusTime = ridingTime = -1;
68+
statusHorse = ridingHorse = null;
69+
}
70+
71+
private static void trigger(HorseBaseEntity horse) {
72+
MinecraftClient client = MinecraftClient.getInstance();
73+
74+
if (!client.player.getMainHandStack().isEmpty() || !horse.isAlive()) return;
75+
76+
client.interactionManager.interactEntity(client.player, horse, Hand.MAIN_HAND);
77+
}
78+
}

0 commit comments

Comments
 (0)