Skip to content

Commit

Permalink
Update CapabilityHasPokemobs.java
Browse files Browse the repository at this point in the history
fixes a possible loop here
  • Loading branch information
Thutmose committed May 24, 2020
1 parent 69ff9c6 commit d08fdf5
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,10 @@ public void setPokemob(final int slot, final ItemStack cube)
public void onSetTarget(final LivingEntity target, final boolean ignoreCanBattle)
{
final LivingEntity old = this.getTarget();
// No calling this if we already have that target.
if (old == target) return;
// No calling this if we are the target.
if (target == this.getTrainer()) return;

if (!ignoreCanBattle && target != null && !this.canBattle(target, true).test()) return;

Expand All @@ -660,7 +663,6 @@ public void onSetTarget(final LivingEntity target, final boolean ignoreCanBattle
}

final IHasPokemobs other = TrainerCaps.getHasPokemobs(target);
System.out.println(other + " " + this.getTrainer().getDisplayName().getFormattedText());
if (other != null) other.onSetTarget(this.getTrainer(), true);

if (target != null && this.getAttackCooldown() <= 0)
Expand Down

0 comments on commit d08fdf5

Please sign in to comment.