From 451db5b15a7d55dad5b4b6831bacf5bdda7c186e Mon Sep 17 00:00:00 2001 From: Hileb <107909747+Ecdcaeb@users.noreply.github.com> Date: Sat, 26 Oct 2024 20:14:33 +0800 Subject: [PATCH] rename and fix the javadoc --- .../living/LivingSetAttackTargetEvent.java | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java index 308ca6bb4..83766cc58 100644 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java @@ -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; } }