mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 16:55:12 +00:00
Fix IProjectile Events
Thank you @somehussar
This commit is contained in:
1 parent
782f21f1fe
commit
24d12e25a9
6 files changed
+57
-6
No files matched your search
@@ -1,18 +1,31 @@
|
||||
package noppes.npcs.scripted.event;
|
||||
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IProjectile;
|
||||
import noppes.npcs.api.event.IProjectileEvent;
|
||||
|
||||
public class ProjectileEvent extends CustomNPCsEvent {
|
||||
public class ProjectileEvent extends CustomNPCsEvent implements IProjectileEvent {
|
||||
public IProjectile projectile;
|
||||
public IEntity source;
|
||||
|
||||
public ProjectileEvent(IProjectile projectile) {
|
||||
this.projectile = projectile;
|
||||
this.source = projectile.getThrower();
|
||||
}
|
||||
|
||||
public IProjectile getProjectile() {
|
||||
return projectile;
|
||||
}
|
||||
|
||||
public IEntity getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* projectileTick
|
||||
*/
|
||||
public static class UpdateEvent extends ProjectileEvent {
|
||||
public static class UpdateEvent extends ProjectileEvent implements IProjectileEvent.UpdateEvent {
|
||||
public UpdateEvent(IProjectile projectile) {
|
||||
super(projectile);
|
||||
}
|
||||
@@ -21,7 +34,7 @@ public class ProjectileEvent extends CustomNPCsEvent {
|
||||
/**
|
||||
* projectileImpact
|
||||
*/
|
||||
public static class ImpactEvent extends ProjectileEvent {
|
||||
public static class ImpactEvent extends ProjectileEvent implements IProjectileEvent.ImpactEvent {
|
||||
/**
|
||||
* 0:entity, 1:block
|
||||
*/
|
||||
@@ -33,5 +46,21 @@ public class ProjectileEvent extends CustomNPCsEvent {
|
||||
this.type = type;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public IEntity getEntity() {
|
||||
if(type == 0)
|
||||
return (IEntity) target;
|
||||
return null;
|
||||
}
|
||||
|
||||
public IBlock getBlock() {
|
||||
if(type == 1)
|
||||
return (IBlock) target;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user