Commit af668eda by Jonathan Thomas

Automatically tame best friends (who are tameable) and un-tame worst enemies!

parent 0c61d35a
Pipeline #12719 passed with stages
in 2 minutes 19 seconds
......@@ -10,6 +10,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
- New LEAD behavior, to guide a player to a random location (and show message when destination is reached)
- Best friends are now rideable! Right click with an empty hand. Excludes tameable entities (dogs, cats, etc...)
- Villager trades are now affected by friendship! Be nice!
- Automatically tame best friends (who are tameable) and un-tame worst enemies!
### Changed
- Large refactor of how MobEntity avoids targeting players when friendship > 0
......
......@@ -16,6 +16,7 @@ import com.owlmaddie.utils.ServerEntityFinder;
import com.owlmaddie.utils.VillagerEntityAccessor;
import net.minecraft.entity.boss.dragon.EnderDragonEntity;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
......@@ -367,6 +368,16 @@ public class ChatDataManager {
}
}
// Tame best friends and un-tame worst enemies
if (entity instanceof TameableEntity && this.friendship != new_friendship) {
TameableEntity tamableEntity = (TameableEntity) entity;
if (new_friendship == 3 && !tamableEntity.isTamed()) {
tamableEntity.setOwner(player);
} else if (new_friendship == -3 && tamableEntity.isTamed()) {
tamableEntity.setTamed(false);
}
}
this.friendship = new_friendship;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment