@@ -1006,11 +1006,13 @@ LL_TYPE_INSTANCE_HOOK(
10061006 HitResult const & res
10071007) {
10081008 IF_LISTENED (EVENT_TYPES::onProjectileHitEntity) {
1009- CallEventVoid (
1010- EVENT_TYPES::onProjectileHitEntity,
1011- EntityClass::newEntity (res.getEntity ()),
1012- EntityClass::newEntity (&owner)
1013- );
1009+ if (res.getEntity ()) {
1010+ CallEventVoid (
1011+ EVENT_TYPES::onProjectileHitEntity,
1012+ EntityClass::newEntity (res.getEntity ()),
1013+ EntityClass::newEntity (&owner)
1014+ );
1015+ }
10141016 }
10151017 IF_LISTENED_END (EVENT_TYPES::onProjectileHitEntity);
10161018 origin (owner, res);
@@ -1027,11 +1029,13 @@ LL_TYPE_INSTANCE_HOOK(
10271029 Actor const & projectile
10281030) {
10291031 IF_LISTENED (EVENT_TYPES::onProjectileHitBlock) {
1030- CallEventVoid (
1031- EVENT_TYPES::onProjectileHitBlock,
1032- BlockClass::newBlock (this , &pos, ®ion),
1033- EntityClass::newEntity (&const_cast <Actor&>(projectile))
1034- );
1032+ if (pos != BlockPos::ZERO && !this ->isAir ()) {
1033+ CallEventVoid (
1034+ EVENT_TYPES::onProjectileHitBlock,
1035+ BlockClass::newBlock (this , &pos, ®ion),
1036+ EntityClass::newEntity (&const_cast <Actor&>(projectile))
1037+ );
1038+ }
10351039 }
10361040 IF_LISTENED_END (EVENT_TYPES::onProjectileHitBlock);
10371041 origin (region, pos, projectile);
0 commit comments