-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix MC-172047
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: HaHaWTH <[email protected]> | ||
Date: Fri, 15 Mar 2024 02:12:38 +0800 | ||
Subject: [PATCH] Fix-MC-172047 | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java | ||
index a90055fe8819a32180754b6060a0f88e81d1a3b6..35d4645ebad044c5c216bc7d0126a055d623ee9f 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java | ||
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java | ||
@@ -58,6 +58,7 @@ import net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal; | ||
import net.minecraft.world.entity.ai.goal.target.ResetUniversalAngerTargetGoal; | ||
import net.minecraft.world.entity.animal.horse.AbstractHorse; | ||
import net.minecraft.world.entity.animal.horse.Llama; | ||
+import net.minecraft.world.entity.decoration.ArmorStand; | ||
import net.minecraft.world.entity.monster.AbstractSkeleton; | ||
import net.minecraft.world.entity.monster.Creeper; | ||
import net.minecraft.world.entity.monster.Ghast; | ||
@@ -672,13 +673,33 @@ public class Wolf extends TamableAnimal implements NeutralMob { | ||
|
||
@Override | ||
public boolean wantsToAttack(LivingEntity target, LivingEntity owner) { | ||
- if (!(target instanceof Creeper) && !(target instanceof Ghast)) { | ||
+ if (!(target instanceof Creeper) && !(target instanceof Ghast) && !(target instanceof ArmorStand)) { // Leaf - Fix MC-172047 | ||
if (target instanceof Wolf) { | ||
Wolf entitywolf = (Wolf) target; | ||
- | ||
return !entitywolf.isTame() || entitywolf.getOwner() != owner; | ||
} else { | ||
- return target instanceof Player && owner instanceof Player && !((Player) owner).canHarmPlayer((Player) target) ? false : (target instanceof AbstractHorse && ((AbstractHorse) target).isTamed() ? false : !(target instanceof TamableAnimal) || !((TamableAnimal) target).isTame()); | ||
+ // Leaf start | ||
+ if (target instanceof Player) { | ||
+ Player targetPlayer = (Player) target; | ||
+ if (owner instanceof Player) { | ||
+ Player ownerPlayer = (Player) owner; | ||
+ if (!ownerPlayer.canHarmPlayer(targetPlayer)) { | ||
+ return false; | ||
+ } | ||
+ } | ||
+ } | ||
+ if (target instanceof AbstractHorse) { | ||
+ AbstractHorse targetHorse = (AbstractHorse) target; | ||
+ if (targetHorse.isTamed()) { | ||
+ return false; | ||
+ } | ||
+ } | ||
+ if (target instanceof TamableAnimal) { | ||
+ TamableAnimal tamableAnimalTarget = (TamableAnimal) target; | ||
+ return !tamableAnimalTarget.isTame(); | ||
+ } | ||
+ return true; | ||
+ // Leaf end | ||
} | ||
} else { | ||
return false; |