Skip to content

Commit

Permalink
rename and fix the javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Ecdcaeb authored Oct 26, 2024
1 parent fcc8be1 commit 451db5b
Showing 1 changed file with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,46 @@
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class LivingSetAttackTargetEvent extends LivingEvent
{

public class LivingSetAttackTargetEvent extends LivingEvent{
private final EntityLivingBase originalTarget;
private EntityLivingBase redirectedTarget;
private boolean isRedirected;
private boolean isModified;

public LivingSetAttackTargetEvent(EntityLivingBase entity, EntityLivingBase target)
{
super(entity);
this.originalTarget = target;
this.redirectedTarget = null;
this.isRedirected = false;
this.isModified = false;
}

/**
* Get the target that will be actually applied
**/
public EntityLivingBase getTarget()
{
return isRedirected?redirectedTarget:originalTarget;
return isRedirected ? redirectedTarget : originalTarget;
}


/**
* return the original attack target
**/
public EntityLivingBase getOriginalTarget(){
return originalTarget;
}

public void redirect(EntityLivingBase living){
this.redirectedTarget=living;
this.isRedirected=true;

/**
* Set the attack target of the living's
**/
public void setTarget(EntityLivingBase living){
this.redirectedTarget = living;
this.isModified = true;
}

/**
* Is the attack target is modified
**/
public boolean isModified(){
return this.isModified;
}

public boolean isRedirected(){ return this.isRedirected; }
}

0 comments on commit 451db5b

Please sign in to comment.