mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 05:02:18 +00:00
Add throwable impact event (#3071)
This commit is contained in:
1 parent
5eeda79234
commit
f76af6103e
3 files changed
+54
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
/**
|
||||
* This event is fired before an {@link EntityThrowable} calls its {@link EntityThrowable#onImpact} method.
|
||||
* This event is fired via {@link net.minecraftforge.common.ForgeHooks#onThrowableImpact}.
|
||||
* This event is cancelable. When canceled, {@link EntityThrowable#onImpact} will not be called.
|
||||
* Killing or other handling of the entity after event cancellation is up to the modder.
|
||||
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
@Cancelable
|
||||
public class ThrowableImpactEvent extends EntityEvent
|
||||
{
|
||||
private final EntityThrowable throwable;
|
||||
private final RayTraceResult ray;
|
||||
|
||||
public ThrowableImpactEvent(EntityThrowable throwable, RayTraceResult ray)
|
||||
{
|
||||
super(throwable);
|
||||
this.throwable = throwable;
|
||||
this.ray = ray;
|
||||
}
|
||||
|
||||
public EntityThrowable getEntityThrowable()
|
||||
{
|
||||
return throwable;
|
||||
}
|
||||
|
||||
public RayTraceResult getRayTraceResult()
|
||||
{
|
||||
return ray;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user