Pet Protect is a simple Minecraft mod that prevents players from accidentally attacking their own tamed pets, including wolves, cats, parrots, and horse-like entities (horses, donkeys, and mules). When a player attempts to attack their own pet or horse, the attack is canceled, ensuring that pets are safe from accidental damage by their owners.
- Prevents damage to all tameable entities (e.g., wolves, cats, parrots) by their owners.
- Prevents damage to horses and similar mobs (e.g., donkeys, mules) by their owners.
- Lightweight mod that only affects players attacking their own tamed pets.
- Works seamlessly in multiplayer servers.
- Download and install Fabric Loader for Minecraft 1.21 or above.
- Download Pet Protect
.jar
file from the releases section and place it in your Minecraftmods
folder. - Launch Minecraft with the Fabric profile and enjoy!
- Tame any pet (e.g., wolf, cat, parrot) or horse (or similar entity like a donkey).
- When you try to hit your own tamed pet, the attack will automatically be canceled.
- You can attack other pets or animals as usual, but your own tamed animals are protected.
To develop this mod, you'll need:
- Java Development Kit (JDK) (version 21)
- IntelliJ IDEA or another Java IDE
- Fabric Mod Development Kit (MDK)
- Gradle
- Clone the repository:
git clone https://github.com/MylesGit/petprotect
- Open the project in your IDE.
- Run the Gradle task to build the mod:
./gradlew build
- The mod
.jar
file will be located in thebuild/libs
folder.
- Main Class: The main logic is located in
src/main/java/net/myles124/petprotect/PetProtect.java
. - Event Registration: The mod uses the
AttackEntityCallback
event to listen for attacks on entities and cancel them if the player owns the pet.
Feel free to submit issues, suggestions, or pull requests to improve the mod!
This mod is licensed under the MIT License. You can freely use, modify, and distribute this mod as long as you include the original license file.