From 6da38814d2d489a38601201e885521aa087fbc16 Mon Sep 17 00:00:00 2001 From: GearShocky Date: Fri, 4 Apr 2025 18:10:42 +0500 Subject: [PATCH] give rocket an owner --- .../kotlin/ru/dbotthepony/mc/otm/entity/RocketProjectile.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/RocketProjectile.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/RocketProjectile.kt index 86e304a96..f922289dc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/RocketProjectile.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/RocketProjectile.kt @@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.entity import net.minecraft.core.particles.ParticleTypes import net.minecraft.sounds.SoundEvent import net.minecraft.sounds.SoundEvents +import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.projectile.AbstractArrow import net.minecraft.world.item.ItemStack import net.minecraft.world.level.Level @@ -11,6 +12,7 @@ import net.minecraft.world.phys.EntityHitResult import ru.dbotthepony.mc.otm.registry.game.MEntityTypes class RocketProjectile(level: Level) : AbstractArrow(MEntityTypes.ROCKET, level) { + var owner: LivingEntity? = null init { setBaseDamage(5.0) @@ -29,7 +31,7 @@ class RocketProjectile(level: Level) : AbstractArrow(MEntityTypes.ROCKET, level) override fun onHitEntity(result: EntityHitResult) { if (!level().isClientSide) { - level().explode(null, x, y, z, 2.0f, Level.ExplosionInteraction.NONE) + level().explode(owner, x, y, z, 2.0f, Level.ExplosionInteraction.NONE) discard() } super.onHitEntity(result) @@ -37,7 +39,7 @@ class RocketProjectile(level: Level) : AbstractArrow(MEntityTypes.ROCKET, level) override fun onHitBlock(result: BlockHitResult) { if (!level().isClientSide) { - level().explode(null, x, y, z, 2.0f, Level.ExplosionInteraction.NONE) + level().explode(owner, x, y, z, 2.0f, Level.ExplosionInteraction.NONE) discard() } super.onHitBlock(result)