diff --git a/build.gradle b/build.gradle index 16d8b0e56..a1879f7de 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ configurations { apply plugin: 'forge' -version = "1.9-beta3" +version = "1.9-beta3.2" group= "com.kamkeel.customnpc-plus" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "CustomNPC-Plus" diff --git a/src/api b/src/api index 8c064246f..fd31facd1 160000 --- a/src/api +++ b/src/api @@ -1 +1 @@ -Subproject commit 8c064246f81db155b323ff6289bac1d6c2ad7fd5 +Subproject commit fd31facd1260abe590cffe48fe3fd41c18f03f02 diff --git a/src/main/java/noppes/npcs/EventHooks.java b/src/main/java/noppes/npcs/EventHooks.java index 0f590bb3a..ea784ccd4 100644 --- a/src/main/java/noppes/npcs/EventHooks.java +++ b/src/main/java/noppes/npcs/EventHooks.java @@ -262,6 +262,14 @@ public class EventHooks { script.run(EnumScriptType.PROJECTILE_TICK, event); } } + + EntityLivingBase thrower = projectile.getThrower(); + if(thrower != null){ + if(thrower instanceof EntityNPCInterface){ + ((EntityNPCInterface) thrower).script.callScript(EnumScriptType.PROJECTILE_TICK, event); + } + } + NpcAPI.EVENT_BUS.post(event); } @@ -272,6 +280,14 @@ public class EventHooks { script.run(EnumScriptType.PROJECTILE_IMPACT, event); } } + + EntityLivingBase thrower = projectile.getThrower(); + if(thrower != null){ + if(thrower instanceof EntityNPCInterface){ + ((EntityNPCInterface) thrower).script.callScript(EnumScriptType.PROJECTILE_IMPACT, event); + } + } + NpcAPI.EVENT_BUS.post(event); } diff --git a/src/main/java/noppes/npcs/entity/EntityProjectile.java b/src/main/java/noppes/npcs/entity/EntityProjectile.java index bd50a1aaa..f97c908bd 100644 --- a/src/main/java/noppes/npcs/entity/EntityProjectile.java +++ b/src/main/java/noppes/npcs/entity/EntityProjectile.java @@ -29,6 +29,7 @@ import noppes.npcs.DataStats; import noppes.npcs.EventHooks; import noppes.npcs.api.IPos; import noppes.npcs.api.IWorld; +import noppes.npcs.api.entity.IEntity; import noppes.npcs.api.entity.IProjectile; import noppes.npcs.constants.EnumParticleType; import noppes.npcs.constants.EnumPotionType; @@ -449,7 +450,8 @@ public class EntityProjectile extends EntityThrowable { if (!this.worldObj.isRemote) { ProjectileEvent.ImpactEvent event; if (movingobjectposition.entityHit != null) { - event = new ProjectileEvent.ImpactEvent((IProjectile) NpcAPI.Instance().getIEntity(this), 0, movingobjectposition.entityHit); + IEntity target = NpcAPI.Instance().getIEntity(movingobjectposition.entityHit); + event = new ProjectileEvent.ImpactEvent((IProjectile) NpcAPI.Instance().getIEntity(this), 0, target); } else { IPos pos = NpcAPI.Instance().getIPos(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); IWorld world = NpcAPI.Instance().getIWorld(this.worldObj); diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptProjectile.java b/src/main/java/noppes/npcs/scripted/entity/ScriptProjectile.java index e22bdb8f4..b6b32db12 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptProjectile.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptProjectile.java @@ -79,6 +79,10 @@ public class ScriptProjectile extends ScriptEntity