@@ -1006,11 +1006,13 @@ LL_TYPE_INSTANCE_HOOK(
1006
1006
HitResult const & res
1007
1007
) {
1008
1008
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
+ }
1014
1016
}
1015
1017
IF_LISTENED_END (EVENT_TYPES::onProjectileHitEntity);
1016
1018
origin (owner, res);
@@ -1027,11 +1029,13 @@ LL_TYPE_INSTANCE_HOOK(
1027
1029
Actor const & projectile
1028
1030
) {
1029
1031
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
+ }
1035
1039
}
1036
1040
IF_LISTENED_END (EVENT_TYPES::onProjectileHitBlock);
1037
1041
origin (region, pos, projectile);
0 commit comments